QGIS API Documentation 3.36.0-Maidenhead (09951dc0acf)
Loading...
Searching...
No Matches
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
21#include "qgsmeshdataset.h"
22
35{
36 public:
37
47 const QString &description = QString(),
48 const QString &meshLayerParameterName = QString(),
49 QSet<int> supportedDataType = QSet<int>(),
50 bool optional = false );
51
53 QString type() const override;
54 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
55 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
56 QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonOutputType::PythonQgsProcessingAlgorithmSubclass ) const override;
57 QStringList dependsOnOtherParameters() const override;
58 QVariantMap toVariantMap() const override;
59 bool fromVariantMap( const QVariantMap &map ) override;
60
62 static QString typeName() { return QStringLiteral( "meshdatasetgroups" ); }
63
65 QString meshLayerParameterName() const;
66
69
71 static QList<int> valueAsDatasetGroup( const QVariant &value );
72
73 private:
74 QString mMeshLayerParameterName;
75 QSet<int> mSupportedDataType;
76
77 static bool valueIsAcceptable( const QVariant &input, bool allowEmpty );
78};
79
80#ifndef SIP_RUN
82
89class CORE_EXPORT QgsProcessingParameterTypeMeshDatasetGroups : public QgsProcessingParameterType
90{
91 public:
92 QgsProcessingParameterDefinition *create( const QString &name ) const override SIP_FACTORY
93 {
95 }
96
97 QString description() const override
98 {
99 return QCoreApplication::translate( "Processing", "An input allowing selection dataset groups from a mesh layer" );
100 }
101
102 QString name() const override
103 {
104 return QCoreApplication::translate( "Processing", "Mesh Dataset Groups" );
105 }
106
107 QString id() const override
108 {
110 }
111
112 QString pythonImportString() const override
113 {
114 return QStringLiteral( "from qgis.core import QgsProcessingParameterMeshDatasetGroups" );
115 }
116
117 QString className() const override
118 {
119 return QStringLiteral( "QgsProcessingParameterMeshDatasetGroups" );
120 }
121
122 QStringList acceptedPythonTypes() const override
123 {
124 return QStringList() << QObject::tr( "list[int]: list of dataset group indexes, see QgsProcessingParameterMeshDatasetGroups docs" );
125 }
126};
127
129#endif //SIP_RUN
130
146{
147 public:
148
157 const QString &name,
158 const QString &description = QString(),
159 const QString &meshLayerParameterName = QString(),
160 const QString &datasetGroupParameterName = QString() );
161
163 QString type() const override;
164 bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
165 QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
166 QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonOutputType::PythonQgsProcessingAlgorithmSubclass ) const override;
167 QStringList dependsOnOtherParameters() const override;
168 QVariantMap toVariantMap() const override;
169 bool fromVariantMap( const QVariantMap &map ) override;
170
172 static QString typeName() { return QStringLiteral( "meshdatasettime" ); }
173
175 QString meshLayerParameterName() const;
176
179
187 static QString valueAsTimeType( const QVariant &value );
188
195 static QgsMeshDatasetIndex timeValueAsDatasetIndex( const QVariant &value );
196
203 static QDateTime timeValueAsDefinedDateTime( const QVariant &value );
204
205 private:
206 QString mMeshLayerParameterName;
207 QString mDatasetGroupParameterName;
208
209 static bool valueIsAcceptable( const QVariant &input, bool allowEmpty );
210};
211
212#ifndef SIP_RUN
214
221class CORE_EXPORT QgsProcessingParameterTypeMeshDatasetTime: public QgsProcessingParameterType
222{
223 public:
224 QgsProcessingParameterDefinition *create( const QString &name ) const override SIP_FACTORY
225 {
226 return new QgsProcessingParameterMeshDatasetTime( name );
227 }
228
229 QString description() const override
230 {
231 return QCoreApplication::translate( "Processing", "An input allowing selection of dataset index from a mesh layer by time setting" );
232 }
233
234 QString name() const override
235 {
236 return QCoreApplication::translate( "Processing", "Mesh Dataset Time" );
237 }
238
239 QString id() const override
240 {
242 }
243
244 QString pythonImportString() const override
245 {
246 return QStringLiteral( "from qgis.core import QgsProcessingParameterMeshDatasetTime" );
247 }
248
249 QString className() const override
250 {
251 return QStringLiteral( "QgsProcessingParameterMeshDatasetTime" );
252 }
253
254 QStringList acceptedPythonTypes() const override
255 {
256 return QStringList() << QObject::tr( "dict{}: dictionary, see QgsProcessingParameterMeshDatasetTime docs" );
257 }
258};
259
261#endif //SIP_RUN
262
263
264#endif // QGSPROCESSINGPARAMETERMESHDATASET_H
DataType
Location of where data is specified for datasets in the dataset group.
QgsMeshDatasetIndex is index that identifies the dataset group (e.g.
Contains information about the context in which a processing algorithm is executed.
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.
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