QGIS API Documentation 3.43.0-Master (56aa1fd18d7)
qgsprocessingparametermeshdataset.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsprocessingparametermeshdataset.h
3 ---------------------
4 Date : October 2020
5 Copyright : (C) 2020 by Vincent Cloarec
6 Email : vcloarec at gmail dot com
7 ***************************************************************************
8 * *
9 * This program is free software; you can redistribute it and/or modify *
10 * it under the terms of the GNU General Public License as published by *
11 * the Free Software Foundation; either version 2 of the License, or *
12 * (at your option) any later version. *
13 * *
14 ***************************************************************************/
15
16#ifndef QGSPROCESSINGPARAMETERMESHDATASET_H
17#define QGSPROCESSINGPARAMETERMESHDATASET_H
18
22#include "qgsmeshdataset.h"
23
36{
37 public:
38
48 const QString &description = QString(),
49 const QString &meshLayerParameterName = QString(),
50 QSet<int> supportedDataType = QSet<int>(),
51 bool optional = false );
52
54 QString type() const override;
55 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
56 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
57 QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonOutputType::PythonQgsProcessingAlgorithmSubclass ) const override;
58 QStringList dependsOnOtherParameters() const override;
59 QVariantMap toVariantMap() const override;
60 bool fromVariantMap( const QVariantMap &map ) override;
61
63 static QString typeName() { return QStringLiteral( "meshdatasetgroups" ); }
64
66 QString meshLayerParameterName() const;
67
70
72 static QList<int> valueAsDatasetGroup( const QVariant &value );
73
74 private:
75 QString mMeshLayerParameterName;
76 QSet<int> mSupportedDataType;
77
78 static bool valueIsAcceptable( const QVariant &input, bool allowEmpty );
79};
80
81#ifndef SIP_RUN
83
90class CORE_EXPORT QgsProcessingParameterTypeMeshDatasetGroups : public QgsProcessingParameterType
91{
92 public:
93 QgsProcessingParameterDefinition *create( const QString &name ) const override SIP_FACTORY
94 {
96 }
97
98 QString description() const override
99 {
100 return QCoreApplication::translate( "Processing", "An input allowing selection dataset groups from a mesh layer" );
101 }
102
103 QString name() const override
104 {
105 return QCoreApplication::translate( "Processing", "Mesh Dataset Groups" );
106 }
107
108 QString id() const override
109 {
111 }
112
113 QString pythonImportString() const override
114 {
115 return QStringLiteral( "from qgis.core import QgsProcessingParameterMeshDatasetGroups" );
116 }
117
118 QString className() const override
119 {
120 return QStringLiteral( "QgsProcessingParameterMeshDatasetGroups" );
121 }
122
123 QStringList acceptedPythonTypes() const override
124 {
125 return QStringList() << QObject::tr( "list[int]: list of dataset group indexes, see QgsProcessingParameterMeshDatasetGroups docs" );
126 }
127
128 QStringList acceptedParameterTypes() const override
129 {
133 }
134
135 QStringList acceptedOutputTypes() const override
136 {
137 return QStringList() << QgsProcessingOutputString::typeName()
139 }
140};
141
143#endif //SIP_RUN
144
160{
161 public:
162
171 const QString &name,
172 const QString &description = QString(),
173 const QString &meshLayerParameterName = QString(),
174 const QString &datasetGroupParameterName = QString() );
175
177 QString type() const override;
178 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
179 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
180 QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonOutputType::PythonQgsProcessingAlgorithmSubclass ) const override;
181 QStringList dependsOnOtherParameters() const override;
182 QVariantMap toVariantMap() const override;
183 bool fromVariantMap( const QVariantMap &map ) override;
184
186 static QString typeName() { return QStringLiteral( "meshdatasettime" ); }
187
189 QString meshLayerParameterName() const;
190
193
201 static QString valueAsTimeType( const QVariant &value );
202
209 static QgsMeshDatasetIndex timeValueAsDatasetIndex( const QVariant &value );
210
217 static QDateTime timeValueAsDefinedDateTime( const QVariant &value );
218
219 private:
220 QString mMeshLayerParameterName;
221 QString mDatasetGroupParameterName;
222
223 static bool valueIsAcceptable( const QVariant &input, bool allowEmpty );
224};
225
226#ifndef SIP_RUN
228
235class CORE_EXPORT QgsProcessingParameterTypeMeshDatasetTime: public QgsProcessingParameterType
236{
237 public:
238 QgsProcessingParameterDefinition *create( const QString &name ) const override SIP_FACTORY
239 {
240 return new QgsProcessingParameterMeshDatasetTime( name );
241 }
242
243 QString description() const override
244 {
245 return QCoreApplication::translate( "Processing", "An input allowing selection of dataset index from a mesh layer by time setting" );
246 }
247
248 QString name() const override
249 {
250 return QCoreApplication::translate( "Processing", "Mesh Dataset Time" );
251 }
252
253 QString id() const override
254 {
256 }
257
258 QString pythonImportString() const override
259 {
260 return QStringLiteral( "from qgis.core import QgsProcessingParameterMeshDatasetTime" );
261 }
262
263 QString className() const override
264 {
265 return QStringLiteral( "QgsProcessingParameterMeshDatasetTime" );
266 }
267
268 QStringList acceptedPythonTypes() const override
269 {
270 return QStringList() << QObject::tr( "dict{}: dictionary, see QgsProcessingParameterMeshDatasetTime docs" );
271 }
272
273 QStringList acceptedParameterTypes() const override
274 {
275 return QStringList()
279 }
280
281 QStringList acceptedOutputTypes() const override
282 {
283 return QStringList()
285 }
286};
287
289#endif //SIP_RUN
290
291
292#endif // QGSPROCESSINGPARAMETERMESHDATASET_H
DataType
Location of where data is specified for datasets in the dataset group.
An index that identifies the dataset group (e.g.
Contains information about the context in which a processing algorithm is executed.
static QString typeName()
Returns the type name for the output class.
static QString typeName()
Returns the type name for the output class.
static QString typeName()
Returns the type name for the parameter class.
Base class for the definition of processing parameters.
QString description() const
Returns the description for the parameter.
QString name() const
Returns the name of the parameter.
A parameter for processing algorithms that need a list of mesh dataset groups.
QgsProcessingParameterMeshDatasetGroups(const QString &name, const QString &description=QString(), const QString &meshLayerParameterName=QString(), QSet< int > supportedDataType=QSet< int >(), bool optional=false)
Constructor.
static QString typeName()
Returns the type name for the parameter class.
static QList< int > valueAsDatasetGroup(const QVariant &value)
Returns the value as a list if dataset group indexes.
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
QString meshLayerParameterName() const
Returns the name of the mesh layer parameter.
bool isDataTypeSupported(QgsMeshDatasetGroupMetadata::DataType dataType) const
Returns whether the data type is supported by the parameter.
A parameter for processing algorithms that need a list of mesh dataset index from time parameter.
QgsProcessingParameterMeshDatasetTime(const QString &name, const QString &description=QString(), const QString &meshLayerParameterName=QString(), const QString &datasetGroupParameterName=QString())
Constructor.
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
static QString valueAsTimeType(const QVariant &value)
Returns the dataset value time type as a string : current-context-time : the time is store in the pro...
QString datasetGroupParameterName() const
Returns the name of the dataset groups parameter.
QString meshLayerParameterName() const
Returns the name of the mesh layer parameter.
static QgsMeshDatasetIndex timeValueAsDatasetIndex(const QVariant &value)
Returns the value as a QgsMeshDatasetIndex if the value has "dataset-time-step" type.
static QString typeName()
Returns the type name for the parameter class.
static QDateTime timeValueAsDefinedDateTime(const QVariant &value)
Returns the value as a QDateTime if the value has "defined-date-time" type.
static QString typeName()
Returns the type name for the parameter class.
static QString typeName()
Returns the type name for the parameter class.
Makes metadata of processing parameters available.
Contains enumerations and other constants for use in processing algorithms and parameters.
#define SIP_FACTORY
Definition qgis_sip.h:76
const QString & typeName