QGIS API Documentation 4.0.0-Norrköping (1ddcee3d0e4)
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:
43
45 void setInputVertices( const QList<int> verticesIndexes );
46
48 void setInputFaces( const QList<int> faceIndexes );
49
51 QString message() const;
52
54 void clear();
55
60 virtual bool isFinished() const;
61
63 virtual QString text() const;
64
65 protected:
66 QList<int> mInputVertices;
67 QList<int> mInputFaces;
68 QString mMessage;
69 bool mIsFinished = false;
70
77
78 friend class QgsMeshEditor;
79};
80
97{
98 public:
100
101 QString text() const override;
102
103 private:
104 QgsTopologicalMesh::Changes apply( QgsMeshEditor *meshEditor ) override;
105
106 struct FaceRefinement
107 {
108 QList<int> newVerticesLocalIndex; // new vertices in the same order of the vertex index (ccw)
109 QList<bool> refinedFaceNeighbor;
110 QList<bool> borderFaceNeighbor;
111 int newCenterVertexIndex;
112 QList<int> newFacesChangesIndex;
113 };
114
115 struct BorderFace
116 {
117 QList<bool> refinedFacesNeighbor;
118 QList<bool> borderFacesNeighbor;
119 QList<bool> unchangeFacesNeighbor;
120 QList<int> newVerticesLocalIndex;
121 QList<int> edgeFace; //global index of the dirst face exposed on edge
122 };
123
125 void createNewVerticesAndRefinedFaces( QgsMeshEditor *meshEditor, QSet<int> &facesToRefine, QHash<int, FaceRefinement> &facesRefinement );
126
127 bool createNewBorderFaces( QgsMeshEditor *meshEditor, const QSet<int> &facesToRefine, QHash<int, FaceRefinement> &facesRefinement, QHash<int, BorderFace> &borderFaces );
128
129 friend class TestQgsMeshEditor;
130};
131
132
156{
157 public:
159
160 QString text() const override;
161
167 void setExpressions( const QString &expressionX, const QString &expressionY, const QString &expressionZ );
168
179 bool calculate( QgsMeshLayer *layer, QgsProject *project = nullptr );
180
186 QgsMeshVertex transformedVertex( QgsMeshLayer *layer, int vertexIndex ) const;
187
198 void setZFromTerrain( bool enable );
199
200 private:
201 QString mExpressionX;
202 QString mExpressionY;
203 QString mExpressionZ;
204 QHash<int, int> mChangingVertexMap;
205 bool mZFromTerrain = false;
206
207 QgsTopologicalMesh::Changes apply( QgsMeshEditor *meshEditor ) override;
208
209 friend class TestQgsMeshEditor;
210};
211
212#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:113
Contains topological differences between two states of a topological mesh, only accessible from the Q...
#define SIP_SKIP
Definition qgis_sip.h:133
#define SIP_ABSTRACT
Definition qgis_sip.h:220
QgsPoint QgsMeshVertex
xyz coords of vertex