QGIS API Documentation 3.37.0-Master (fdefdf9c27f)
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
46
48 void setInputVertices( const QList<int> verticesIndexes );
49
51 void setInputFaces( const QList<int> faceIndexes );
52
54 QString message() const;
55
57 void clear();
58
63 virtual bool isFinished() const;
64
66 virtual QString text() const;
67
68 protected:
69 QList<int> mInputVertices;
70 QList<int> mInputFaces;
71 QString mMessage;
72 bool mIsFinished = false;
73
80
81 friend class QgsMeshEditor;
82};
83
97{
98 public:
99
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
168
169 QString text() const override;
170
176 void setExpressions( const QString &expressionX, const QString &expressionY, const QString &expressionZ );
177
185 bool calculate( QgsMeshLayer *layer );
186
192 QgsMeshVertex transformedVertex( QgsMeshLayer *layer, int vertexIndex ) const;
193
194 private:
195 QString mExpressionX;
196 QString mExpressionY;
197 QString mExpressionZ;
198 QHash<int, int> mChangingVertexMap;
199
200 QgsTopologicalMesh::Changes apply( QgsMeshEditor *meshEditor ) override;
201
202 friend class TestQgsMeshEditor;
203};
204
205#endif // QGSMESHADVANCEDEDITING_H
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
Abstract class that can be derived to implement advanced editing on mesh.
virtual QgsTopologicalMesh::Changes apply(QgsMeshEditor *meshEditor)=0
Apply a change to mesh Editor.
virtual ~QgsMeshAdvancedEditing()
Destructor.
QgsMeshAdvancedEditing()
Constructor.
Class that can do a refinement of faces of a mesh.
QgsMeshEditRefineFaces()
Constructor.
Class that makes edit operation on a mesh.
Definition: qgsmesheditor.h:68
Represents a mesh layer supporting display of data on structured or unstructured meshes.
Definition: qgsmeshlayer.h:101
Class that can transform vertices of a mesh by expression.
QgsMeshTransformVerticesByExpression()=default
Constructor.
Point geometry type, with support for z-dimension and m-values.
Definition: qgspoint.h:49
Base class for providing feedback from a processing algorithm.
Class that contains topological differences between two states of a topological mesh,...
#define SIP_SKIP
Definition: qgis_sip.h:126
#define SIP_ABSTRACT
Definition: qgis_sip.h:213