QGIS API Documentation 3.41.0-Master (45a0abf3bec)
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
184 bool calculate( QgsMeshLayer *layer );
185
191 QgsMeshVertex transformedVertex( QgsMeshLayer *layer, int vertexIndex ) const;
192
193 private:
194 QString mExpressionX;
195 QString mExpressionY;
196 QString mExpressionZ;
197 QHash<int, int> mChangingVertexMap;
198
199 QgsTopologicalMesh::Changes apply( QgsMeshEditor *meshEditor ) override;
200
201 friend class TestQgsMeshEditor;
202};
203
204#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()
Class that can do a refinement of faces of a mesh.
Class that makes edit operation on a mesh.
Represents a mesh layer supporting display of data on structured or unstructured meshes.
Class that can transform vertices of a mesh by expression.
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