QGIS API Documentation  3.0.2-Girona (307d082)
qgsprocessingparameters.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsprocessingparameters.h
3  -------------------------
4  begin : April 2017
5  copyright : (C) 2017 by Nyall Dawson
6  email : nyall dot dawson 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 QGSPROCESSINGPARAMETERS_H
19 #define QGSPROCESSINGPARAMETERS_H
20 
21 #include "qgis_core.h"
22 #include "qgis.h"
23 #include "qgsprocessing.h"
24 #include "qgsproperty.h"
26 #include "qgsfeaturesource.h"
27 #include <QMap>
28 #include <limits>
29 
31 class QgsRasterLayer;
32 class QgsVectorLayer;
33 class QgsFeatureSink;
38 
49 {
50  public:
51 
55  QgsProcessingFeatureSourceDefinition( const QString &source = QString(), bool selectedFeaturesOnly = false )
56  : source( QgsProperty::fromValue( source ) )
57  , selectedFeaturesOnly( selectedFeaturesOnly )
58  {}
59 
63  QgsProcessingFeatureSourceDefinition( const QgsProperty &source, bool selectedFeaturesOnly = false )
64  : source( source )
65  , selectedFeaturesOnly( selectedFeaturesOnly )
66  {}
67 
72 
77 
79  {
80  return source == other.source && selectedFeaturesOnly == other.selectedFeaturesOnly;
81  }
82 
84  {
85  return !( *this == other );
86  }
87 
89  operator QVariant() const
90  {
91  return QVariant::fromValue( *this );
92  }
93 
94 };
95 
97 
98 
108 {
109  public:
110 
116  QgsProcessingOutputLayerDefinition( const QString &sink = QString(), QgsProject *destinationProject = nullptr )
117  : sink( QgsProperty::fromValue( sink ) )
118  , destinationProject( destinationProject )
119  {}
120 
126  QgsProcessingOutputLayerDefinition( const QgsProperty &sink, QgsProject *destinationProject = nullptr )
127  : sink( sink )
128  , destinationProject( destinationProject )
129  {}
130 
135 
141  QgsProject *destinationProject = nullptr;
142 
147 
154  QVariantMap createOptions;
155 
156 
158  operator QVariant() const
159  {
160  return QVariant::fromValue( *this );
161  }
162 
163 };
164 
165 Q_DECLARE_METATYPE( QgsProcessingOutputLayerDefinition )
166 
167 
168 
169 
170 //
171 // Parameter definitions
172 //
173 
174 
187 {
188 
189 #ifdef SIP_RUN
191  if ( sipCpp->type() == QgsProcessingParameterBoolean::typeName() )
192  sipType = sipType_QgsProcessingParameterBoolean;
193  else if ( sipCpp->type() == QgsProcessingParameterCrs::typeName() )
194  sipType = sipType_QgsProcessingParameterCrs;
195  else if ( sipCpp->type() == QgsProcessingParameterMapLayer::typeName() )
196  sipType = sipType_QgsProcessingParameterMapLayer;
197  else if ( sipCpp->type() == QgsProcessingParameterExtent::typeName() )
198  sipType = sipType_QgsProcessingParameterExtent;
199  else if ( sipCpp->type() == QgsProcessingParameterPoint::typeName() )
200  sipType = sipType_QgsProcessingParameterPoint;
201  else if ( sipCpp->type() == QgsProcessingParameterFile::typeName() )
202  sipType = sipType_QgsProcessingParameterFile;
203  else if ( sipCpp->type() == QgsProcessingParameterMatrix::typeName() )
204  sipType = sipType_QgsProcessingParameterMatrix;
205  else if ( sipCpp->type() == QgsProcessingParameterMultipleLayers::typeName() )
206  sipType = sipType_QgsProcessingParameterMultipleLayers;
207  else if ( sipCpp->type() == QgsProcessingParameterNumber::typeName() )
208  sipType = sipType_QgsProcessingParameterNumber;
209  else if ( sipCpp->type() == QgsProcessingParameterRange::typeName() )
210  sipType = sipType_QgsProcessingParameterRange;
211  else if ( sipCpp->type() == QgsProcessingParameterRasterLayer::typeName() )
212  sipType = sipType_QgsProcessingParameterRasterLayer;
213  else if ( sipCpp->type() == QgsProcessingParameterEnum::typeName() )
214  sipType = sipType_QgsProcessingParameterEnum;
215  else if ( sipCpp->type() == QgsProcessingParameterString::typeName() )
216  sipType = sipType_QgsProcessingParameterString;
217  else if ( sipCpp->type() == QgsProcessingParameterExpression::typeName() )
218  sipType = sipType_QgsProcessingParameterExpression;
219  else if ( sipCpp->type() == QgsProcessingParameterVectorLayer::typeName() )
220  sipType = sipType_QgsProcessingParameterVectorLayer;
221  else if ( sipCpp->type() == QgsProcessingParameterField::typeName() )
222  sipType = sipType_QgsProcessingParameterField;
223  else if ( sipCpp->type() == QgsProcessingParameterFeatureSource::typeName() )
224  sipType = sipType_QgsProcessingParameterFeatureSource;
225  else if ( sipCpp->type() == QgsProcessingParameterFeatureSink::typeName() )
226  sipType = sipType_QgsProcessingParameterFeatureSink;
227  else if ( sipCpp->type() == QgsProcessingParameterVectorDestination::typeName() )
228  sipType = sipType_QgsProcessingParameterVectorDestination;
229  else if ( sipCpp->type() == QgsProcessingParameterRasterDestination::typeName() )
230  sipType = sipType_QgsProcessingParameterRasterDestination;
231  else if ( sipCpp->type() == QgsProcessingParameterFileDestination::typeName() )
232  sipType = sipType_QgsProcessingParameterFileDestination;
233  else if ( sipCpp->type() == QgsProcessingParameterFolderDestination::typeName() )
234  sipType = sipType_QgsProcessingParameterFolderDestination;
235  else if ( sipCpp->type() == QgsProcessingParameterBand::typeName() )
236  sipType = sipType_QgsProcessingParameterBand;
237  else
238  sipType = nullptr;
239  SIP_END
240 #endif
241 
242  public:
243 
245  enum Flag
246  {
247  FlagAdvanced = 1 << 1,
248  FlagHidden = 1 << 2,
249  FlagOptional = 1 << 3,
250  };
251  Q_DECLARE_FLAGS( Flags, Flag )
252 
253 
256  QgsProcessingParameterDefinition( const QString &name, const QString &description = QString(), const QVariant &defaultValue = QVariant(),
257  bool optional = false );
258 
259  virtual ~QgsProcessingParameterDefinition() = default;
260 
264  virtual QgsProcessingParameterDefinition *clone() const = 0 SIP_FACTORY;
265 
269  virtual QString type() const = 0;
270 
276  virtual bool isDestination() const { return false; }
277 
283  QString name() const { return mName; }
284 
290  void setName( const QString &name ) { mName = name; }
291 
297  QString description() const { return mDescription; }
298 
304  void setDescription( const QString &description ) { mDescription = description; }
305 
310  QVariant defaultValue() const { return mDefault; }
311 
317  void setDefaultValue( const QVariant &value ) { mDefault = value; }
318 
323  Flags flags() const { return mFlags; }
324 
329  void setFlags( Flags flags ) { mFlags = flags; }
330 
338  virtual bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const;
339 
345  virtual QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const;
346 
351  virtual QString asScriptCode() const;
352 
358  virtual QVariantMap toVariantMap() const;
359 
365  virtual bool fromVariantMap( const QVariantMap &map );
366 
373  SIP_SKIP QVariantMap metadata() const { return mMetadata; }
374 
380  QVariantMap &metadata() { return mMetadata; }
381 
387  void setMetadata( const QVariantMap &metadata ) { mMetadata = metadata; }
388 
393  virtual QStringList dependsOnOtherParameters() const { return QStringList(); }
394 
400  QgsProcessingAlgorithm *algorithm() const;
401 
407  QgsProcessingProvider *provider() const;
408 
413  virtual QString toolTip() const;
414 
422  bool isDynamic() const { return mIsDynamic; }
423 
431  void setIsDynamic( bool dynamic ) { mIsDynamic = dynamic; }
432 
439  QgsPropertyDefinition dynamicPropertyDefinition() const { return mPropertyDefinition; }
440 
447  void setDynamicPropertyDefinition( const QgsPropertyDefinition &definition ) { mPropertyDefinition = definition; }
448 
460  QString dynamicLayerParameterName() const { return mDynamicLayerParameterName; }
461 
473  void setDynamicLayerParameterName( const QString &name ) { mDynamicLayerParameterName = name; }
474 
475  protected:
476 
478  QString mName;
479 
481  QString mDescription;
482 
484  QVariant mDefault;
485 
487  Flags mFlags;
488 
490  QVariantMap mMetadata;
491 
493  QgsProcessingAlgorithm *mAlgorithm = nullptr;
494 
496  bool mIsDynamic = false;
497 
500 
503 
504  // To allow access to mAlgorithm. We don't want a public setter for this!
506 
507 };
508 
509 Q_DECLARE_OPERATORS_FOR_FLAGS( QgsProcessingParameterDefinition::Flags )
510 
511 typedef QList< const QgsProcessingParameterDefinition * > QgsProcessingParameterDefinitions;
513 
532 class CORE_EXPORT QgsProcessingParameters
533 {
534 
535  public:
536 
541  static bool isDynamic( const QVariantMap &parameters, const QString &name );
542 
546  static QString parameterAsString( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, const QgsProcessingContext &context );
547 
551  static QString parameterAsExpression( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, const QgsProcessingContext &context );
552 
556  static double parameterAsDouble( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, const QgsProcessingContext &context );
557 
561  static int parameterAsInt( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, const QgsProcessingContext &context );
562 
566  static int parameterAsEnum( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, const QgsProcessingContext &context );
567 
571  static QList<int> parameterAsEnums( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, const QgsProcessingContext &context );
572 
576  static bool parameterAsBool( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, const QgsProcessingContext &context );
577 
591  static QgsFeatureSink *parameterAsSink( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters,
592  const QgsFields &fields, QgsWkbTypes::Type geometryType, const QgsCoordinateReferenceSystem &crs,
593  QgsProcessingContext &context, QString &destinationIdentifier SIP_OUT ) SIP_FACTORY;
594 
603  static QgsProcessingFeatureSource *parameterAsSource( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context ) SIP_FACTORY;
604 
617  static QString parameterAsCompatibleSourceLayerPath( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters,
618  QgsProcessingContext &context, const QStringList &compatibleFormats, const QString &preferredFormat = QString( "shp" ), QgsProcessingFeedback *feedback = nullptr );
619 
627  static QgsMapLayer *parameterAsLayer( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context );
628 
636  static QgsRasterLayer *parameterAsRasterLayer( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context );
637 
641  static QString parameterAsOutputLayer( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context );
642 
646  static QString parameterAsFileOutput( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context );
647 
655  static QgsVectorLayer *parameterAsVectorLayer( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context );
656 
660  static QgsCoordinateReferenceSystem parameterAsCrs( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context );
661 
671  static QgsRectangle parameterAsExtent( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context,
673 
685  static QgsGeometry parameterAsExtentGeometry( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context,
687 
693  static QgsCoordinateReferenceSystem parameterAsExtentCrs( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context );
694 
702  static QgsPointXY parameterAsPoint( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context,
704 
710  static QgsCoordinateReferenceSystem parameterAsPointCrs( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context );
711 
715  static QString parameterAsFile( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context );
716 
721  static QVariantList parameterAsMatrix( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context );
722 
726  static QList< QgsMapLayer *> parameterAsLayerList( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context );
727 
731  static QList<double> parameterAsRange( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context );
732 
736  static QStringList parameterAsFields( const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context );
737 
743  static QgsProcessingParameterDefinition *parameterFromVariantMap( const QVariantMap &map ) SIP_FACTORY;
744 
748  static QString descriptionFromName( const QString &name );
749 
755  static QgsProcessingParameterDefinition *parameterFromScriptCode( const QString &code ) SIP_FACTORY;
756 
757  private:
758 
759  static bool parseScriptCodeParameterOptions( const QString &code, bool &isOptional, QString &name, QString &type, QString &definition );
760 };
761 
762 
763 
770 class CORE_EXPORT QgsProcessingParameterBoolean : public QgsProcessingParameterDefinition
771 {
772  public:
773 
777  QgsProcessingParameterBoolean( const QString &name, const QString &description = QString(), const QVariant &defaultValue = QVariant(),
778  bool optional = false );
779 
783  static QString typeName() { return QStringLiteral( "boolean" ); }
784  QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
785  QString type() const override { return typeName(); }
786  QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
787  QString asScriptCode() const override;
788 
792  static QgsProcessingParameterBoolean *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
793 };
794 
801 class CORE_EXPORT QgsProcessingParameterCrs : public QgsProcessingParameterDefinition
802 {
803  public:
804 
808  QgsProcessingParameterCrs( const QString &name, const QString &description = QString(), const QVariant &defaultValue = QVariant(),
809  bool optional = false );
810 
814  static QString typeName() { return QStringLiteral( "crs" ); }
815  QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
816  QString type() const override { return typeName(); }
817  bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
818  QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
819 
823  static QgsProcessingParameterCrs *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
824 
825 };
826 
833 class CORE_EXPORT QgsProcessingParameterMapLayer : public QgsProcessingParameterDefinition
834 {
835  public:
836 
840  QgsProcessingParameterMapLayer( const QString &name, const QString &description = QString(), const QVariant &defaultValue = QVariant(),
841  bool optional = false );
842 
846  static QString typeName() { return QStringLiteral( "layer" ); }
847  QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
848  QString type() const override { return typeName(); }
849  bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
850  QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
851 
855  static QgsProcessingParameterMapLayer *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
856 
857 };
858 
865 class CORE_EXPORT QgsProcessingParameterExtent : public QgsProcessingParameterDefinition
866 {
867  public:
868 
872  QgsProcessingParameterExtent( const QString &name, const QString &description = QString(), const QVariant &defaultValue = QVariant(),
873  bool optional = false );
874 
878  static QString typeName() { return QStringLiteral( "extent" ); }
879  QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
880  QString type() const override { return typeName(); }
881  bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
882  QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
883 
887  static QgsProcessingParameterExtent *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
888 
889 };
890 
891 
898 class CORE_EXPORT QgsProcessingParameterPoint : public QgsProcessingParameterDefinition
899 {
900  public:
901 
905  QgsProcessingParameterPoint( const QString &name, const QString &description = QString(), const QVariant &defaultValue = QVariant(),
906  bool optional = false );
907 
911  static QString typeName() { return QStringLiteral( "point" ); }
912  QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
913  QString type() const override { return typeName(); }
914  bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
915  QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
916 
920  static QgsProcessingParameterPoint *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
921 
922 };
923 
930 class CORE_EXPORT QgsProcessingParameterFile : public QgsProcessingParameterDefinition
931 {
932  public:
933 
935  enum Behavior
936  {
937  File = 0,
939  };
940 
944  QgsProcessingParameterFile( const QString &name, const QString &description = QString(), Behavior behavior = File, const QString &extension = QString(), const QVariant &defaultValue = QVariant(),
945  bool optional = false );
946 
950  static QString typeName() { return QStringLiteral( "file" ); }
951  QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
952  QString type() const override { return typeName(); }
953  bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
954  QString asScriptCode() const override;
955 
960  Behavior behavior() const { return mBehavior; }
961 
966  void setBehavior( Behavior behavior ) { mBehavior = behavior; }
967 
972  QString extension() const { return mExtension; }
973 
978  void setExtension( const QString &extension ) { mExtension = extension; }
979 
980  QVariantMap toVariantMap() const override;
981  bool fromVariantMap( const QVariantMap &map ) override;
982 
986  static QgsProcessingParameterFile *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition, Behavior behavior = File ) SIP_FACTORY;
987 
988  private:
989 
990  Behavior mBehavior = File;
991  QString mExtension;
992 };
993 
1000 class CORE_EXPORT QgsProcessingParameterMatrix : public QgsProcessingParameterDefinition
1001 {
1002  public:
1003 
1007  QgsProcessingParameterMatrix( const QString &name, const QString &description = QString(), int numberRows = 3,
1008  bool hasFixedNumberRows = false, const QStringList &headers = QStringList(),
1009  const QVariant &defaultValue = QVariant(),
1010  bool optional = false );
1011 
1015  static QString typeName() { return QStringLiteral( "matrix" ); }
1016  QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
1017  QString type() const override { return typeName(); }
1018  bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
1019  QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
1020 
1025  QStringList headers() const;
1026 
1031  void setHeaders( const QStringList &headers );
1032 
1039  int numberRows() const;
1040 
1047  void setNumberRows( int rows );
1048 
1054  bool hasFixedNumberRows() const;
1055 
1061  void setHasFixedNumberRows( bool hasFixedNumberRows );
1062 
1063  QVariantMap toVariantMap() const override;
1064  bool fromVariantMap( const QVariantMap &map ) override;
1065 
1069  static QgsProcessingParameterMatrix *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
1070 
1071  private:
1072 
1073  QStringList mHeaders;
1074  int mNumberRows = 3;
1075  bool mFixedNumberRows = false;
1076 
1077 };
1078 
1085 class CORE_EXPORT QgsProcessingParameterMultipleLayers : public QgsProcessingParameterDefinition
1086 {
1087  public:
1088 
1092  QgsProcessingParameterMultipleLayers( const QString &name, const QString &description = QString(), QgsProcessing::SourceType layerType = QgsProcessing::TypeVectorAnyGeometry,
1093  const QVariant &defaultValue = QVariant(),
1094  bool optional = false );
1095 
1099  static QString typeName() { return QStringLiteral( "multilayer" ); }
1100  QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
1101  QString type() const override { return typeName(); }
1102  bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
1103  QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
1104  QString asScriptCode() const override;
1105 
1110  QgsProcessing::SourceType layerType() const;
1111 
1116  void setLayerType( QgsProcessing::SourceType type );
1117 
1123  int minimumNumberInputs() const;
1124 
1130  void setMinimumNumberInputs( int minimum );
1131 
1132  QVariantMap toVariantMap() const override;
1133  bool fromVariantMap( const QVariantMap &map ) override;
1134 
1138  static QgsProcessingParameterMultipleLayers *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
1139 
1140  private:
1141 
1143  int mMinimumNumberInputs = 0;
1144 
1145 };
1146 
1153 class CORE_EXPORT QgsProcessingParameterNumber : public QgsProcessingParameterDefinition
1154 {
1155  public:
1156 
1158  enum Type
1159  {
1162  };
1163 
1167  explicit QgsProcessingParameterNumber( const QString &name, const QString &description = QString(),
1168  Type type = Integer,
1169  const QVariant &defaultValue = QVariant(),
1170  bool optional = false,
1171  double minValue = -DBL_MAX + 1,
1172  double maxValue = DBL_MAX
1173  );
1174 
1178  static QString typeName() { return QStringLiteral( "number" ); }
1179  QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
1180  QString type() const override { return typeName(); }
1181  bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
1182  QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
1183  QString toolTip() const override;
1184 
1189  double minimum() const;
1190 
1195  void setMinimum( double minimum );
1196 
1201  double maximum() const;
1202 
1207  void setMaximum( double maximum );
1208 
1213  Type dataType() const;
1214 
1219  void setDataType( Type type );
1220 
1221  QVariantMap toVariantMap() const override;
1222  bool fromVariantMap( const QVariantMap &map ) override;
1223 
1227  static QgsProcessingParameterNumber *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
1228 
1229  private:
1230 
1231  double mMin = -DBL_MAX + 1;
1232  double mMax = DBL_MAX;
1233  Type mDataType = Integer;
1234 };
1235 
1242 class CORE_EXPORT QgsProcessingParameterRange : public QgsProcessingParameterDefinition
1243 {
1244  public:
1245 
1249  QgsProcessingParameterRange( const QString &name, const QString &description = QString(),
1251  const QVariant &defaultValue = QVariant(),
1252  bool optional = false );
1253 
1257  static QString typeName() { return QStringLiteral( "range" ); }
1258  QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
1259  QString type() const override { return typeName(); }
1260  bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
1261  QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
1262 
1267  QgsProcessingParameterNumber::Type dataType() const;
1268 
1273  void setDataType( QgsProcessingParameterNumber::Type dataType );
1274 
1275  QVariantMap toVariantMap() const override;
1276  bool fromVariantMap( const QVariantMap &map ) override;
1277 
1281  static QgsProcessingParameterRange *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
1282 
1283  private:
1284 
1286 };
1287 
1294 class CORE_EXPORT QgsProcessingParameterRasterLayer : public QgsProcessingParameterDefinition
1295 {
1296  public:
1297 
1301  QgsProcessingParameterRasterLayer( const QString &name, const QString &description = QString(), const QVariant &defaultValue = QVariant(),
1302  bool optional = false );
1303 
1307  static QString typeName() { return QStringLiteral( "raster" ); }
1308  QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
1309  QString type() const override { return typeName(); }
1310  bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
1311  QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
1312 
1316  static QgsProcessingParameterRasterLayer *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
1317 
1318 };
1319 
1326 class CORE_EXPORT QgsProcessingParameterEnum : public QgsProcessingParameterDefinition
1327 {
1328  public:
1329 
1333  QgsProcessingParameterEnum( const QString &name, const QString &description = QString(), const QStringList &options = QStringList(),
1334  bool allowMultiple = false,
1335  const QVariant &defaultValue = QVariant(),
1336  bool optional = false );
1337 
1341  static QString typeName() { return QStringLiteral( "enum" ); }
1342  QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
1343  QString type() const override { return typeName(); }
1344  bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
1345  QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
1346  QString asScriptCode() const override;
1347 
1352  QStringList options() const;
1353 
1358  void setOptions( const QStringList &options );
1359 
1364  bool allowMultiple() const;
1365 
1370  void setAllowMultiple( bool allowMultiple );
1371 
1372  QVariantMap toVariantMap() const override;
1373  bool fromVariantMap( const QVariantMap &map ) override;
1374 
1378  static QgsProcessingParameterEnum *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
1379 
1380  private:
1381 
1382  QStringList mOptions;
1383  bool mAllowMultiple = false;
1384 
1385 };
1386 
1393 class CORE_EXPORT QgsProcessingParameterString : public QgsProcessingParameterDefinition
1394 {
1395  public:
1396 
1400  QgsProcessingParameterString( const QString &name, const QString &description = QString(), const QVariant &defaultValue = QVariant(),
1401  bool multiLine = false,
1402  bool optional = false );
1403 
1407  static QString typeName() { return QStringLiteral( "string" ); }
1408  QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
1409  QString type() const override { return typeName(); }
1410  QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
1411  QString asScriptCode() const override;
1412 
1417  bool multiLine() const;
1418 
1423  void setMultiLine( bool multiLine );
1424 
1425  QVariantMap toVariantMap() const override;
1426  bool fromVariantMap( const QVariantMap &map ) override;
1427 
1431  static QgsProcessingParameterString *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
1432 
1433  private:
1434 
1435  bool mMultiLine = false;
1436 
1437 };
1438 
1445 class CORE_EXPORT QgsProcessingParameterExpression : public QgsProcessingParameterDefinition
1446 {
1447  public:
1448 
1452  QgsProcessingParameterExpression( const QString &name, const QString &description = QString(), const QVariant &defaultValue = QVariant(),
1453  const QString &parentLayerParameterName = QString(),
1454  bool optional = false );
1455 
1459  static QString typeName() { return QStringLiteral( "expression" ); }
1460  QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
1461  QString type() const override { return typeName(); }
1462  QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
1463  QStringList dependsOnOtherParameters() const override;
1464 
1469  QString parentLayerParameterName() const;
1470 
1475  void setParentLayerParameterName( const QString &parentLayerParameterName );
1476 
1477  QVariantMap toVariantMap() const override;
1478  bool fromVariantMap( const QVariantMap &map ) override;
1479 
1483  static QgsProcessingParameterExpression *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
1484 
1485  private:
1486 
1487  QString mParentLayerParameterName;
1488 
1489 };
1490 
1491 
1499 {
1500  public:
1501 
1505  QgsProcessingParameterLimitedDataTypes( const QList< int > &types = QList< int >() );
1506 
1511  QList< int > dataTypes() const;
1512 
1517  void setDataTypes( const QList< int > &types );
1518 
1519  protected:
1520 
1522  QList< int > mDataTypes;
1523 };
1524 
1532 class CORE_EXPORT QgsProcessingParameterVectorLayer : public QgsProcessingParameterDefinition, public QgsProcessingParameterLimitedDataTypes
1533 {
1534  public:
1535 
1539  QgsProcessingParameterVectorLayer( const QString &name,
1540  const QString &description = QString(),
1541  const QList< int > &types = QList< int >(),
1542  const QVariant &defaultValue = QVariant(),
1543  bool optional = false );
1544 
1548  static QString typeName() { return QStringLiteral( "vector" ); }
1549  QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
1550  QString type() const override { return typeName(); }
1551  bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
1552  QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
1553 
1554  QVariantMap toVariantMap() const override;
1555  bool fromVariantMap( const QVariantMap &map ) override;
1556 
1560  static QgsProcessingParameterVectorLayer *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
1561 
1562 };
1563 
1570 class CORE_EXPORT QgsProcessingParameterField : public QgsProcessingParameterDefinition
1571 {
1572  public:
1573 
1576  {
1577  Any = -1,
1578  Numeric = 0,
1579  String = 1,
1580  DateTime = 2
1581  };
1582 
1586  QgsProcessingParameterField( const QString &name, const QString &description = QString(), const QVariant &defaultValue = QVariant(),
1587  const QString &parentLayerParameterName = QString(),
1588  DataType type = Any,
1589  bool allowMultiple = false,
1590  bool optional = false );
1591 
1595  static QString typeName() { return QStringLiteral( "field" ); }
1596  QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
1597  QString type() const override { return typeName(); }
1598  bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
1599  QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
1600  QString asScriptCode() const override;
1601  QStringList dependsOnOtherParameters() const override;
1602 
1607  QString parentLayerParameterName() const;
1608 
1613  void setParentLayerParameterName( const QString &parentLayerParameterName );
1614 
1619  DataType dataType() const;
1620 
1625  void setDataType( DataType type );
1626 
1631  bool allowMultiple() const;
1632 
1637  void setAllowMultiple( bool allowMultiple );
1638 
1639  QVariantMap toVariantMap() const override;
1640  bool fromVariantMap( const QVariantMap &map ) override;
1641 
1645  static QgsProcessingParameterField *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
1646 
1647  private:
1648 
1649  QString mParentLayerParameterName;
1650  DataType mDataType = Any;
1651  bool mAllowMultiple = false;
1652 
1653 };
1654 
1655 
1662 class CORE_EXPORT QgsProcessingParameterFeatureSource : public QgsProcessingParameterDefinition, public QgsProcessingParameterLimitedDataTypes
1663 {
1664  public:
1665 
1669  QgsProcessingParameterFeatureSource( const QString &name, const QString &description = QString(),
1670  const QList< int > &types = QList< int >(),
1671  const QVariant &defaultValue = QVariant(), bool optional = false );
1672 
1676  static QString typeName() { return QStringLiteral( "source" ); }
1677  QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
1678  QString type() const override { return typeName(); }
1679  bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
1680  QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
1681  QString asScriptCode() const override;
1682 
1683  QVariantMap toVariantMap() const override;
1684  bool fromVariantMap( const QVariantMap &map ) override;
1685 
1689  static QgsProcessingParameterFeatureSource *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
1690 
1691 };
1692 
1700 class CORE_EXPORT QgsProcessingDestinationParameter : public QgsProcessingParameterDefinition
1701 {
1702  public:
1703 
1707  QgsProcessingDestinationParameter( const QString &name, const QString &description = QString(), const QVariant &defaultValue = QVariant(),
1708  bool optional = false );
1709 
1710  bool isDestination() const override { return true; }
1711  QVariantMap toVariantMap() const override;
1712  bool fromVariantMap( const QVariantMap &map ) override;
1713 
1718  virtual QgsProcessingOutputDefinition *toOutputDefinition() const = 0 SIP_FACTORY;
1719 
1725  bool supportsNonFileBasedOutput() const { return mSupportsNonFileBasedOutputs; }
1726 
1732  void setSupportsNonFileBasedOutput( bool supportsNonFileBasedOutput ) { mSupportsNonFileBasedOutputs = supportsNonFileBasedOutput; }
1733 
1738  virtual QString defaultFileExtension() const = 0;
1739 
1745  virtual QString generateTemporaryDestination() const;
1746 
1752  bool createByDefault() const;
1753 
1759  void setCreateByDefault( bool createByDefault );
1760 
1761  private:
1762 
1763  bool mSupportsNonFileBasedOutputs = true;
1764  bool mCreateByDefault = true;
1765 
1766 };
1767 
1768 
1778 {
1779  public:
1780 
1784  QgsProcessingParameterFeatureSink( const QString &name, const QString &description = QString(), QgsProcessing::SourceType type = QgsProcessing::TypeVectorAnyGeometry, const QVariant &defaultValue = QVariant(),
1785  bool optional = false );
1786 
1790  static QString typeName() { return QStringLiteral( "sink" ); }
1791  QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
1792  QString type() const override { return typeName(); }
1793  bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
1794  QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
1795  QString asScriptCode() const override;
1797  QString defaultFileExtension() const override;
1798 
1803  QgsProcessing::SourceType dataType() const;
1804 
1809  bool hasGeometry() const;
1810 
1815  void setDataType( QgsProcessing::SourceType type );
1816 
1817  QVariantMap toVariantMap() const override;
1818  bool fromVariantMap( const QVariantMap &map ) override;
1819  QString generateTemporaryDestination() const override;
1820 
1824  static QgsProcessingParameterFeatureSink *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
1825 
1826  private:
1827 
1829 };
1830 
1831 
1843 {
1844  public:
1845 
1849  QgsProcessingParameterVectorDestination( const QString &name, const QString &description = QString(), QgsProcessing::SourceType type = QgsProcessing::TypeVectorAnyGeometry, const QVariant &defaultValue = QVariant(),
1850  bool optional = false );
1851 
1855  static QString typeName() { return QStringLiteral( "vectorDestination" ); }
1856  QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
1857  QString type() const override { return typeName(); }
1858  bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
1859  QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
1860  QString asScriptCode() const override;
1862  QString defaultFileExtension() const override;
1863 
1868  QgsProcessing::SourceType dataType() const;
1869 
1874  bool hasGeometry() const;
1875 
1880  void setDataType( QgsProcessing::SourceType type );
1881 
1882  QVariantMap toVariantMap() const override;
1883  bool fromVariantMap( const QVariantMap &map ) override;
1884 
1888  static QgsProcessingParameterVectorDestination *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
1889 
1890 
1891  private:
1892 
1894 };
1895 
1904 {
1905  public:
1906 
1910  QgsProcessingParameterRasterDestination( const QString &name, const QString &description = QString(),
1911  const QVariant &defaultValue = QVariant(),
1912  bool optional = false );
1913 
1917  static QString typeName() { return QStringLiteral( "rasterDestination" ); }
1918  QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
1919  QString type() const override { return typeName(); }
1920  bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
1921  QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
1923  QString defaultFileExtension() const override;
1924 
1928  static QgsProcessingParameterRasterDestination *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
1929 };
1930 
1939 {
1940  public:
1941 
1945  QgsProcessingParameterFileDestination( const QString &name, const QString &description = QString(),
1946  const QString &fileFilter = QString(),
1947  const QVariant &defaultValue = QVariant(),
1948  bool optional = false );
1949 
1953  static QString typeName() { return QStringLiteral( "fileDestination" ); }
1954  QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
1955  QString type() const override { return typeName(); }
1956  bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
1957  QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
1959  QString defaultFileExtension() const override;
1960 
1965  QString fileFilter() const;
1966 
1971  void setFileFilter( const QString &filter );
1972 
1973  QVariantMap toVariantMap() const override;
1974  bool fromVariantMap( const QVariantMap &map ) override;
1975 
1979  static QgsProcessingParameterFileDestination *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
1980 
1981 
1982  private:
1983 
1984  QString mFileFilter;
1985 };
1986 
1996 {
1997  public:
1998 
2002  QgsProcessingParameterFolderDestination( const QString &name, const QString &description = QString(),
2003  const QVariant &defaultValue = QVariant(),
2004  bool optional = false );
2005 
2009  static QString typeName() { return QStringLiteral( "folderDestination" ); }
2010  QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
2011  QString type() const override { return typeName(); }
2012  bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
2014  QString defaultFileExtension() const override;
2015 
2019  static QgsProcessingParameterFolderDestination *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
2020 
2021 };
2022 
2029 class CORE_EXPORT QgsProcessingParameterBand : public QgsProcessingParameterDefinition
2030 {
2031  public:
2032 
2036  QgsProcessingParameterBand( const QString &name, const QString &description = QString(), const QVariant &defaultValue = QVariant(),
2037  const QString &parentLayerParameterName = QString(),
2038  bool optional = false );
2039 
2043  static QString typeName() { return QStringLiteral( "band" ); }
2044  QgsProcessingParameterDefinition *clone() const override SIP_FACTORY;
2045  QString type() const override { return typeName(); }
2046  bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
2047  QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const override;
2048  QString asScriptCode() const override;
2049  QStringList dependsOnOtherParameters() const override;
2050 
2055  QString parentLayerParameterName() const;
2056 
2061  void setParentLayerParameterName( const QString &parentLayerParameterName );
2062 
2063  QVariantMap toVariantMap() const override;
2064  bool fromVariantMap( const QVariantMap &map ) override;
2065 
2069  static QgsProcessingParameterBand *fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) SIP_FACTORY;
2070 
2071  private:
2072 
2073  QString mParentLayerParameterName;
2074 };
2075 
2076 // clazy:excludeall=qstring-allocations
2077 
2078 #endif // QGSPROCESSINGPARAMETERS_H
2079 
2080 
QString type() const override
Unique parameter type name.
QgsProperty sink
Sink/layer definition.
A boolean parameter for processing algorithms.
QList< const QgsProcessingParameterDefinition *> QgsProcessingParameterDefinitions
List of processing parameters.
static QString typeName()
Returns the type name for the parameter class.
QgsPropertyDefinition dynamicPropertyDefinition() const
Returns the property definition for dynamic properties.
An input file or folder parameter for processing algorithms.
A parameter for processing algorithms which accepts multiple map layers.
virtual QString asScriptCode() const
Returns the parameter definition encoded in a string which can be used within a Python processing scr...
A rectangle specified with double values.
Definition: qgsrectangle.h:39
Base class for all map layer types.
Definition: qgsmaplayer.h:56
QString type() const override
Unique parameter type name.
static QString typeName()
Returns the type name for the parameter class.
QVariantMap & metadata()
Returns the parameter&#39;s freeform metadata.
Base class for providing feedback from a processing algorithm.
virtual bool fromVariantMap(const QVariantMap &map)
Restores this parameter to a QVariantMap.
Encapsulates settings relating to a feature sink or output raster layer for a processing algorithm...
QgsProcessingFeatureSourceDefinition(const QString &source=QString(), bool selectedFeaturesOnly=false)
Constructor for QgsProcessingFeatureSourceDefinition, accepting a static string source.
QString type() const override
Unique parameter type name.
QString type() const override
Unique parameter type name.
void setIsDynamic(bool dynamic)
Sets whether the parameter is dynamic, and can support data-defined values (i.e.
QString type() const override
Unique parameter type name.
A vector layer or feature source field parameter for processing algorithms.
void setDynamicLayerParameterName(const QString &name)
Sets the name for the parameter for a layer linked to a dynamic parameter, or an empty string if this...
QString mDynamicLayerParameterName
Linked vector layer parameter name for dynamic properties.
static QString typeName()
Returns the type name for the parameter class.
QVariantMap metadata() const
Returns the parameter&#39;s freeform metadata.
static QString typeName()
Returns the type name for the parameter class.
This class provides qgis with the ability to render raster datasets onto the mapcanvas.
static QString typeName()
Returns the type name for the parameter class.
QString type() const override
Unique parameter type name.
QString type() const override
Unique parameter type name.
A map layer parameter for processing algorithms.
A class to represent a 2D point.
Definition: qgspointxy.h:43
An expression parameter for processing algorithms.
static QString typeName()
Returns the type name for the parameter class.
QString type() const override
Unique parameter type name.
bool isDestination() const override
Returns true if this parameter represents a file or layer destination, e.g.
An interface for objects which accept features via addFeature(s) methods.
QString type() const override
Unique parameter type name.
static QString typeName()
Returns the type name for the parameter class.
static QString typeName()
Returns the type name for the parameter class.
QVariantMap mMetadata
Freeform metadata for parameter. Mostly used by widget wrappers to customise their appearance and beh...
QgsFeatureSource subclass which proxies methods to an underlying QgsFeatureSource, modifying results according to the settings in a QgsProcessingContext.
Container of fields for a vector layer.
Definition: qgsfields.h:42
A geometry is the spatial representation of a feature.
Definition: qgsgeometry.h:111
Abstract base class for processing providers.
virtual QVariantMap toVariantMap() const
Saves this parameter to a QVariantMap.
void setFlags(Flags flags)
Sets the flags associated with the parameter.
A raster band parameter for Processing algorithms.
QString type() const override
Unique parameter type name.
virtual QString valueAsPythonString(const QVariant &value, QgsProcessingContext &context) const
Returns a string version of the parameter input value, which is suitable for use as an input paramete...
static QString typeName()
Returns the type name for the parameter class.
QString type() const override
Unique parameter type name.
QString type() const override
Unique parameter type name.
static QString typeName()
Returns the type name for the parameter class.
Base class for all parameter definitions which represent file or layer destinations, e.g.
Abstract base class for processing algorithms.
Q_DECLARE_METATYPE(QModelIndex)
A feature sink output for processing algorithms.
bool operator==(const QgsProcessingFeatureSourceDefinition &other)
bool selectedFeaturesOnly
True if only selected features in the source should be used by algorithms.
A raster layer destination parameter, for specifying the destination path for a raster layer created ...
static QString typeName()
Returns the type name for the parameter class.
A numeric range parameter for processing algorithms.
bool operator!=(const QgsProcessingFeatureSourceDefinition &other)
void setDynamicPropertyDefinition(const QgsPropertyDefinition &definition)
Sets the property definition for dynamic properties.
static QString typeName()
Returns the type name for the parameter class.
static QString typeName()
Returns the type name for the parameter class.
static QString typeName()
Returns the type name for the parameter class.
Can be inherited by parameters which require limits to their acceptable data types.
A raster layer parameter for processing algorithms.
Type
The WKB type describes the number of dimensions a geometry has.
Definition: qgswkbtypes.h:67
void setDescription(const QString &description)
Sets the description for the parameter.
virtual QString toolTip() const
Returns a formatted tooltip for use with the parameter, which gives helpful information like paramete...
static QString typeName()
Returns the type name for the parameter class.
static QString typeName()
Returns the type name for the parameter class.
QgsProperty source
Source definition.
QString type() const override
Unique parameter type name.
An enum based parameter for processing algorithms, allowing for selection from predefined values...
Flags flags() const
Returns any flags associated with the parameter.
static QString typeName()
Returns the type name for the parameter class.
QVariant defaultValue() const
Returns the default value for the parameter.
#define SIP_SKIP
Definition: qgis_sip.h:119
QgsProcessingOutputLayerDefinition(const QgsProperty &sink, QgsProject *destinationProject=nullptr)
Constructor for QgsProcessingOutputLayerDefinition, accepting a QgsProperty sink/layer.
A collection of utilities for working with parameters when running a processing algorithm.
QString type() const override
Unique parameter type name.
#define SIP_END
Definition: qgis_sip.h:175
Reads and writes project states.
Definition: qgsproject.h:82
void setDefaultValue(const QVariant &value)
Sets the default value for the parameter.
QString type() const override
Unique parameter type name.
A vector layer (with or without geometry) parameter for processing algorithms.
virtual QString defaultFileExtension() const =0
Returns the default file extension for destination file paths associated with this parameter...
#define SIP_FACTORY
Definition: qgis_sip.h:69
A coordinate reference system parameter for processing algorithms.
A store for object properties.
Definition: qgsproperty.h:229
virtual QStringList dependsOnOtherParameters() const
Returns a list of other parameter names on which this parameter is dependent (e.g.
A rectangular map extent parameter for processing algorithms.
QString type() const override
Unique parameter type name.
A numeric parameter for processing algorithms.
A generic file based destination parameter, for specifying the destination path for a file (non-map l...
void setExtension(const QString &extension)
Sets a file extension for the parameter.
QString dynamicLayerParameterName() const
Returns the name of the parameter for a layer linked to a dynamic parameter, or an empty string if th...
Definition for a property.
Definition: qgsproperty.h:46
QString name() const
Returns the name of the parameter.
QList< int > mDataTypes
List of acceptable data types for the parameter.
Encapsulates settings relating to a feature source input to a processing algorithm.
bool supportsNonFileBasedOutput() const
Returns true if the destination parameter supports non filed-based outputs, such as memory layers or ...
Behavior behavior() const
Returns the parameter behavior (e.g.
QString type() const override
Unique parameter type name.
virtual bool isDestination() const
Returns true if this parameter represents a file or layer destination, e.g.
QString extension() const
Returns any specified file extension for the parameter.
QString type() const override
Unique parameter type name.
Base class for the definition of processing outputs.
void setName(const QString &name)
Sets the name of the parameter.
A vector layer destination parameter, for specifying the destination path for a vector layer created ...
QString type() const override
Unique parameter type name.
bool isDynamic() const
Returns true if the parameter supports is dynamic, and can support data-defined values (i...
A point parameter for processing algorithms.
static QString typeName()
Returns the type name for the parameter class.
An input feature source (such as vector layers) parameter for processing algorithms.
void setMetadata(const QVariantMap &metadata)
Sets the parameter&#39;s freeform metadata.
A folder destination parameter, for specifying the destination path for a folder created by the algor...
QString destinationName
Name to use for sink if it&#39;s to be loaded into a destination project.
#define SIP_OUT
Definition: qgis_sip.h:51
static QString typeName()
Returns the type name for the parameter class.
This class represents a coordinate reference system (CRS).
QgsProcessingOutputLayerDefinition(const QString &sink=QString(), QgsProject *destinationProject=nullptr)
Constructor for QgsProcessingOutputLayerDefinition, accepting a static sink/layer string...
Base class for the definition of processing parameters.
virtual bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const
Checks whether the specified input value is acceptable for the parameter.
#define SIP_CONVERT_TO_SUBCLASS_CODE(code)
Definition: qgis_sip.h:165
QVariantMap toVariantMap() const override
Saves this parameter to a QVariantMap.
QVariant mDefault
Default value for parameter.
SourceType
Data source types enum.
Definition: qgsprocessing.h:45
QgsPropertyDefinition mPropertyDefinition
Data defined property definition.
static QString typeName()
Returns the type name for the parameter class.
QgsProcessingFeatureSourceDefinition(const QgsProperty &source, bool selectedFeaturesOnly=false)
Constructor for QgsProcessingFeatureSourceDefinition, accepting a QgsProperty source.
static QString typeName()
Returns the type name for the parameter class.
virtual QString generateTemporaryDestination() const
Generates a temporary destination value for this parameter.
void setSupportsNonFileBasedOutput(bool supportsNonFileBasedOutput)
Sets whether the destination parameter supports non filed-based outputs, such as memory layers or dir...
static QString typeName()
Returns the type name for the parameter class.
An table (matrix) parameter for processing algorithms.
QString type() const override
Unique parameter type name.
QString mDescription
Parameter description.
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
void setBehavior(Behavior behavior)
Sets the parameter behavior (e.g.
Represents a vector layer which manages a vector based data sets.
Contains information about the context in which a processing algorithm is executed.
A string parameter for processing algorithms.
QString type() const override
Unique parameter type name.
QString description() const
Returns the description for the parameter.
virtual QgsProcessingParameterDefinition * clone() const =0
Creates a clone of the parameter definition.
virtual QgsProcessingOutputDefinition * toOutputDefinition() const =0
Returns a new QgsProcessingOutputDefinition corresponding to the definition of the destination parame...
Any vector layer with geometry.
Definition: qgsprocessing.h:48
QString type() const override
Unique parameter type name.
QVariantMap createOptions
Map of optional sink/layer creation options, which are passed to the underlying provider when creatin...
QString type() const override
Unique parameter type name.
static QString typeName()
Returns the type name for the parameter class.