QGIS API Documentation  3.26.3-Buenos Aires (65e4edfdad)
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 
24 class QgsMeshEditor;
27 
39 {
40  public:
41 
45  virtual ~QgsMeshAdvancedEditing();
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 
79  virtual QgsTopologicalMesh::Changes apply( QgsMeshEditor *meshEditor ) = 0; SIP_SKIP
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
QgsMeshAdvancedEditing
Abstract class that can be derived to implement advanced editing on mesh.
Definition: qgsmeshadvancedediting.h:38
QgsExpressionContext
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
Definition: qgsexpressioncontext.h:406
QgsTopologicalMesh::Changes
Class that contains topological differences between two states of a topological mesh,...
Definition: qgstopologicalmesh.h:96
QgsPoint
Point geometry type, with support for z-dimension and m-values.
Definition: qgspoint.h:48
QgsProcessingFeedback
Base class for providing feedback from a processing algorithm.
Definition: qgsprocessingfeedback.h:37
QgsMeshAdvancedEditing::text
virtual QString text() const
Returns a short text string describing what this advanced edit does. Default implementation return a ...
Definition: qgsmeshadvancedediting.cpp:60
QgsMeshAdvancedEditing::mInputFaces
QList< int > mInputFaces
Definition: qgsmeshadvancedediting.h:70
QgsMeshEditor
Class that makes edit operation on a mesh.
Definition: qgsmesheditor.h:67
QgsMeshEditRefineFaces
Class that can do a refinement of faces of a mesh. This refinement is operated only on faces with 3 o...
Definition: qgsmeshadvancedediting.h:96
qgstopologicalmesh.h
qgstriangularmesh.h
SIP_SKIP
#define SIP_SKIP
Definition: qgis_sip.h:126
QgsMeshLayer
Represents a mesh layer supporting display of data on structured or unstructured meshes.
Definition: qgsmeshlayer.h:98
QgsMeshTransformVerticesByExpression
Class that can transform vertices of a mesh by expression.
Definition: qgsmeshadvancedediting.h:162
QgsMeshAdvancedEditing::mInputVertices
QList< int > mInputVertices
Definition: qgsmeshadvancedediting.h:69
QgsMeshAdvancedEditing::mMessage
QString mMessage
Definition: qgsmeshadvancedediting.h:71
QgsMeshAdvancedEditing::apply
virtual QgsTopologicalMesh::Changes apply(QgsMeshEditor *meshEditor)=0
Apply a change to mesh Editor.
SIP_ABSTRACT
#define SIP_ABSTRACT
Definition: qgis_sip.h:208