QGIS API Documentation 3.38.0-Grenoble (exported)
Loading...
Searching...
No Matches
qgsalgorithmexportmesh.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsalgorithmexportmesh.h
3 ---------------------------
4 begin : October 2020
5 copyright : (C) 2020 by Vincent Cloarec
6 email : vcloarec at gmail dot com
7 ***************************************************************************/
8
9/***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
17
18#ifndef QGSALGORITHMEXPORTMESH_H
19#define QGSALGORITHMEXPORTMESH_H
20
21#define SIP_NO_FILE
22
24#include "qgsmeshdataset.h"
25#include "qgsmeshdataprovider.h"
26#include "qgstriangularmesh.h"
28
30
31struct DataGroup
32{
34 QgsMeshDataBlock datasetValues;
35 QgsMeshDataBlock activeFaces;
36 QgsMesh3DDataBlock dataset3dStakedValue; //will be filled only if data are 3d stacked
37};
38
39class QgsExportMeshOnElement : public QgsProcessingAlgorithm
40{
41
42 public:
43 QString group() const override;
44 QString groupId() const override;
45
46 protected:
47 void initAlgorithm( const QVariantMap &configuration = QVariantMap() ) override;
48 bool prepareAlgorithm( const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessingFeedback *feedback ) override;
49 QVariantMap processAlgorithm( const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessingFeedback *feedback ) override;
50 QgsMesh mNativeMesh;
51
52 private:
53
54 virtual QSet<int> supportedDataType() const = 0;
55 virtual Qgis::ProcessingSourceType sinkType() const = 0;
56 virtual Qgis::WkbType sinkGeometryType() const = 0;
57 virtual QgsGeometry meshElement( int index ) const = 0;
58 virtual QgsMesh::ElementType meshElementType() const = 0;
59
60 QList<DataGroup> mDataPerGroup;
61 QgsCoordinateTransform mTransform;
62 int mExportVectorOption = 2;
63 int mElementCount = 0;
64};
65
66class QgsExportMeshVerticesAlgorithm : public QgsExportMeshOnElement
67{
68 public:
69 QString shortHelpString() const override;
70 QString shortDescription() const override;
71 QString name() const override;
72 QString displayName() const override;
73
74 protected:
75 QgsProcessingAlgorithm *createInstance() const override;
76
77 private:
78 Qgis::WkbType sinkGeometryType() const override {return Qgis::WkbType::PointZ;}
79 QSet<int> supportedDataType() const override
80 {
82 }
84 QgsGeometry meshElement( int index ) const override;
85 QgsMesh::ElementType meshElementType()const override {return QgsMesh::Vertex;}
86};
87
88class QgsExportMeshFacesAlgorithm : public QgsExportMeshOnElement
89{
90 public:
91 QString shortHelpString() const override;
92 QString shortDescription() const override;
93 QString name() const override;
94 QString displayName() const override;
95
96 protected:
97 QgsProcessingAlgorithm *createInstance() const override;
98
99 private:
100 Qgis::WkbType sinkGeometryType() const override {return Qgis::WkbType::PolygonZ;}
101 QSet<int> supportedDataType() const override
102 {
103 return QSet<int>( {QgsMeshDatasetGroupMetadata::DataOnFaces} );
104 }
106 QgsGeometry meshElement( int index ) const override;
107 QgsMesh::ElementType meshElementType()const override {return QgsMesh::Face;}
108};
109
110class QgsExportMeshEdgesAlgorithm : public QgsExportMeshOnElement
111{
112 public:
113 QString shortHelpString() const override;
114 QString shortDescription() const override;
115 QString name() const override;
116 QString displayName() const override;
117
118 protected:
119 QgsProcessingAlgorithm *createInstance() const override;
120
121 private:
122 Qgis::WkbType sinkGeometryType() const override {return Qgis::WkbType::LineStringZ;}
123 QSet<int> supportedDataType() const override
124 {
125 return QSet<int>( {QgsMeshDatasetGroupMetadata::DataOnEdges} );
126 }
128 QgsGeometry meshElement( int index ) const override;
129 QgsMesh::ElementType meshElementType()const override {return QgsMesh::Edge;}
130};
131
132
133class QgsExportMeshOnGridAlgorithm : public QgsProcessingAlgorithm
134{
135
136 public:
137 QString name() const override;
138 QString displayName() const override;
139 QString group() const override;
140 QString groupId() const override;
141 QString shortHelpString() const override;
142 QString shortDescription() const override;
143
144 protected:
145 QgsProcessingAlgorithm *createInstance() const override;
146 void initAlgorithm( const QVariantMap &configuration = QVariantMap() ) override;
147 bool prepareAlgorithm( const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessingFeedback *feedback ) override;
148 QVariantMap processAlgorithm( const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessingFeedback *feedback ) override;
149
150 private:
151
152 QSet<int> supportedDataType();
153
154 QgsTriangularMesh mTriangularMesh;
155
156 QList<DataGroup> mDataPerGroup;
157 QgsCoordinateTransform mTransform;
158 int mExportVectorOption = 2;
159 QgsMeshRendererSettings mLayerRendererSettings;
160};
161
162class QgsMeshRasterizeAlgorithm : public QgsProcessingAlgorithm
163{
164
165 public:
166 QString name() const override;
167 QString displayName() const override;
168 QString group() const override;
169 QString groupId() const override;
170 QString shortHelpString() const override;
171 QString shortDescription() const override;
172
173 protected:
174 QgsProcessingAlgorithm *createInstance() const override;
175 void initAlgorithm( const QVariantMap &configuration = QVariantMap() ) override;
176 bool prepareAlgorithm( const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessingFeedback *feedback ) override;
177 QVariantMap processAlgorithm( const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessingFeedback *feedback ) override;
178
179 private:
180
181 QSet<int> supportedDataType();
182
183 QgsTriangularMesh mTriangularMesh;
184
185 QList<DataGroup> mDataPerGroup;
186 QgsCoordinateTransform mTransform;
187 QgsMeshRendererSettings mLayerRendererSettings;
188};
189
190class QgsMeshContoursAlgorithm : public QgsProcessingAlgorithm
191{
192
193 public:
194 QString name() const override;
195 QString displayName() const override;
196 QString group() const override;
197 QString groupId() const override;
198 QString shortHelpString() const override;
199 QString shortDescription() const override;
200
201 protected:
202 QgsProcessingAlgorithm *createInstance() const override;
203 void initAlgorithm( const QVariantMap &configuration = QVariantMap() ) override;
204 bool prepareAlgorithm( const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessingFeedback *feedback ) override;
205 QVariantMap processAlgorithm( const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessingFeedback *feedback ) override;
206
207 private:
208
209 QSet<int> supportedDataType()
210 {
211 return QSet<int>(
212 {
216 }
217
218 QgsTriangularMesh mTriangularMesh;
219 QgsMesh mNativeMesh;
220 QVector<double> mLevels;
221
222 QList<DataGroup> mDataPerGroup;
223 QgsCoordinateTransform mTransform;
224 QgsMeshRendererSettings mLayerRendererSettings;
225 QString mDateTimeString;
226
227};
228
229class QgsMeshExportCrossSection : public QgsProcessingAlgorithm
230{
231
232 public:
233 QString name() const override;
234 QString displayName() const override;
235 QString group() const override;
236 QString groupId() const override;
237 QString shortHelpString() const override;
238 QString shortDescription() const override;
239
240 protected:
241 QgsProcessingAlgorithm *createInstance() const override;
242 void initAlgorithm( const QVariantMap &configuration = QVariantMap() ) override;
243 bool prepareAlgorithm( const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessingFeedback *feedback ) override;
244 QVariantMap processAlgorithm( const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessingFeedback *feedback ) override;
245
246 private:
247
248 QSet<int> supportedDataType()
249 {
250 return QSet<int>(
251 {
255 }
256
257 QgsTriangularMesh mTriangularMesh;
258
259 QList<DataGroup> mDataPerGroup;
260 QgsCoordinateReferenceSystem mMeshLayerCrs;
261 QgsMeshRendererSettings mLayerRendererSettings;
262
263};
264
265class QgsMeshExportTimeSeries : public QgsProcessingAlgorithm
266{
267
268 public:
269 QString name() const override;
270 QString displayName() const override;
271 QString group() const override;
272 QString groupId() const override;
273 QString shortHelpString() const override;
274 QString shortDescription() const override;
275
276 protected:
277 QgsProcessingAlgorithm *createInstance() const override;
278 void initAlgorithm( const QVariantMap &configuration = QVariantMap() ) override;
279 bool prepareAlgorithm( const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessingFeedback *feedback ) override;
280 QVariantMap processAlgorithm( const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessingFeedback *feedback ) override;
281
282 private:
283
284 QSet<int> supportedDataType()
285 {
286 return QSet<int>(
287 {
291 }
292
293 QgsTriangularMesh mTriangularMesh;
294
295 QgsCoordinateReferenceSystem mMeshLayerCrs;
296 QgsMeshRendererSettings mLayerRendererSettings;
297
298 QList<int> mGroupIndexes;
299 QList<DataGroup> mDatasets;
300 QList<qint64> mRelativeTimeSteps;
301 QStringList mTimeStepString;
302 QMap<qint64, QMap<int, int>> mRelativeTimeToData;
303 QMap<int, QgsMeshDatasetGroupMetadata> mGroupsMetadata;
304
305};
306
307
309
310#endif // QGSALGORITHMEXPORTMESH_H
ProcessingSourceType
Processing data source types.
Definition qgis.h:2995
@ VectorPoint
Vector point layers.
@ VectorPolygon
Vector polygon layers.
@ VectorLine
Vector line layers.
WkbType
The WKB type describes the number of dimensions a geometry has.
Definition qgis.h:201
@ PointZ
PointZ.
@ LineStringZ
LineStringZ.
@ PolygonZ
PolygonZ.
This class represents a coordinate reference system (CRS).
Class for doing transforms between two map coordinate systems.
A geometry is the spatial representation of a feature.
QgsMesh3DDataBlock is a block of 3d stacked mesh data related N faces defined on base mesh frame.
QgsMeshDataBlock is a block of integers/doubles that can be used to retrieve: active flags (e....
QgsMeshDatasetGroupMetadata is a collection of dataset group metadata such as whether the data is vec...
@ DataOnEdges
Data is defined on edges.
@ DataOnFaces
Data is defined on faces.
@ DataOnVertices
Data is defined on vertices.
@ DataOnVolumes
Data is defined on volumes.
Represents all mesh renderer settings.
Abstract base class for processing algorithms.
virtual QgsProcessingAlgorithm * createInstance() const =0
Creates a new instance of the algorithm class.
virtual QString group() const
Returns the name of the group this algorithm belongs to.
virtual bool prepareAlgorithm(const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessingFeedback *feedback)
Prepares the algorithm to run using the specified parameters.
virtual QString groupId() const
Returns the unique ID of the group this algorithm belongs to.
virtual QString shortHelpString() const
Returns a localised short helper string for the algorithm.
virtual QString shortDescription() const
Returns an optional translated short description of the algorithm.
virtual QString displayName() const =0
Returns the translated algorithm name, which should be used for any user-visible display of the algor...
virtual QVariantMap processAlgorithm(const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessingFeedback *feedback)=0
Runs the algorithm using the specified parameters.
virtual void initAlgorithm(const QVariantMap &configuration=QVariantMap())=0
Initializes the algorithm using the specified configuration.
virtual QString name() const =0
Returns the algorithm name, used for identifying the algorithm.
Contains information about the context in which a processing algorithm is executed.
Base class for providing feedback from a processing algorithm.
Triangular/Derived Mesh is mesh with vertices in map coordinates.
Mesh - vertices, edges and faces.
ElementType
Defines type of mesh elements.