42 #include <QRegularExpression> 
   50   map.insert( QStringLiteral( 
"feature_limit" ), 
featureLimit );
 
   51   map.insert( QStringLiteral( 
"flags" ), 
static_cast< int >( 
flags ) );
 
   52   map.insert( QStringLiteral( 
"geometry_check" ), 
static_cast< int >( 
geometryCheck ) );
 
   60   featureLimit = map.value( QStringLiteral( 
"feature_limit" ), -1 ).toLongLong();
 
   61   flags = 
static_cast< Flags 
>( map.value( QStringLiteral( 
"flags" ), 0 ).toInt() );
 
   74   mRemappingDefinition = definition;
 
   81   map.insert( QStringLiteral( 
"create_options" ), 
createOptions );
 
   83     map.insert( QStringLiteral( 
"remapping" ), QVariant::fromValue( mRemappingDefinition ) );
 
   90   createOptions = map.value( QStringLiteral( 
"create_options" ) ).toMap();
 
   91   if ( map.contains( QStringLiteral( 
"remapping" ) ) )
 
   98     mUseRemapping = 
false;
 
  106          && mUseRemapping == other.mUseRemapping && mRemappingDefinition == other.mRemappingDefinition;
 
  111   return !( *
this == other );
 
  116   const QVariant val = parameters.value( name );
 
  136   QVariant val = value;
 
  140   if ( !val.isValid() )
 
  149       return destParam->generateTemporaryDestination();
 
  152   return val.toString();
 
  168   const QVariant val = value;
 
  172   if ( val.isValid() && !val.toString().isEmpty() )
 
  176       return val.toString();
 
  196   QVariant val = value;
 
  201   const double res = val.toDouble( &ok );
 
  207   return val.toDouble();
 
  223   QVariant val = value;
 
  228   double dbl = val.toDouble( &ok );
 
  233     dbl = val.toDouble( &ok );
 
  240     const double round = std::round( dbl );
 
  241     if ( round  > std::numeric_limits<int>::max() || round < -std::numeric_limits<int>::max() )
 
  246     return static_cast< int >( std::round( dbl ) );
 
  255     return QList< int >();
 
  263     return QList< int >();
 
  265   QList< int > resultList;
 
  266   const QVariant val = value;
 
  271     else if ( val.type() == QVariant::List )
 
  273       const QVariantList list = val.toList();
 
  274       for ( 
auto it = list.constBegin(); it != list.constEnd(); ++it )
 
  275         resultList << it->toInt();
 
  279       const QStringList parts = val.toString().split( 
';' );
 
  280       for ( 
auto it = parts.constBegin(); it != parts.constEnd(); ++it )
 
  281         resultList << it->toInt();
 
  285   if ( resultList.isEmpty() )
 
  290       if ( definition->
defaultValue().type() == QVariant::List )
 
  292         const QVariantList list = definition->
defaultValue().toList();
 
  293         for ( 
auto it = list.constBegin(); it != list.constEnd(); ++it )
 
  294           resultList << it->toInt();
 
  298         const QStringList parts = definition->
defaultValue().toString().split( 
';' );
 
  299         for ( 
auto it = parts.constBegin(); it != parts.constEnd(); ++it )
 
  300           resultList << it->toInt();
 
  321   QVariant val = value;
 
  325   QDateTime d = val.toDateTime();
 
  326   if ( !d.isValid() && val.type() == QVariant::String )
 
  328     d = QDateTime::fromString( val.toString() );
 
  335     d = val.toDateTime();
 
  337   if ( !d.isValid() && val.type() == QVariant::String )
 
  339     d = QDateTime::fromString( val.toString() );
 
  358   QVariant val = value;
 
  362   QDate d = val.toDate();
 
  363   if ( !d.isValid() && val.type() == QVariant::String )
 
  365     d = QDate::fromString( val.toString() );
 
  374   if ( !d.isValid() && val.type() == QVariant::String )
 
  376     d = QDate::fromString( val.toString() );
 
  395   QVariant val = value;
 
  401   if ( val.type() == QVariant::DateTime )
 
  402     d = val.toDateTime().time();
 
  406   if ( !d.isValid() && val.type() == QVariant::String )
 
  408     d = QTime::fromString( val.toString() );
 
  417   if ( !d.isValid() && val.type() == QVariant::String )
 
  419     d = QTime::fromString( val.toString() );
 
  440   if ( enumDef && val >= enumDef->
options().size() )
 
  460   QVariantList resultList;
 
  461   const QVariant val = value;
 
  464   else if ( val.type() == QVariant::List )
 
  466     const auto constToList = val.toList();
 
  467     for ( 
const QVariant &var : constToList )
 
  470   else if ( val.type() == QVariant::String )
 
  472     const auto constSplit = val.toString().split( 
',' );
 
  473     for ( 
const QString &var : constSplit )
 
  479   if ( resultList.isEmpty() )
 
  480     return QList< int >();
 
  482   if ( ( !val.isValid() || !resultList.at( 0 ).isValid() ) && definition )
 
  486     if ( definition->
defaultValue().type() == QVariant::List )
 
  488       const auto constToList = definition->
defaultValue().toList();
 
  489       for ( 
const QVariant &var : constToList )
 
  492     else if ( definition->
defaultValue().type() == QVariant::String )
 
  494       const auto constSplit = definition->
defaultValue().toString().split( 
',' );
 
  495       for ( 
const QString &var : constSplit )
 
  504   const auto constResultList = resultList;
 
  505   for ( 
const QVariant &var : constResultList )
 
  507     const int resInt = var.toInt();
 
  508     if ( !enumDef || resInt < enumDef->options().size() )
 
  531   if ( enumText.isEmpty() || !enumDef->
options().contains( enumText ) )
 
  540     return QStringList();
 
  548     return QStringList();
 
  550   const QVariant val = value;
 
  552   QStringList enumValues;
 
  554   std::function< void( 
const QVariant &var ) > processVariant;
 
  555   processVariant = [ &enumValues, &context, &definition, &processVariant ]( 
const QVariant & var )
 
  557     if ( var.type() == QVariant::List )
 
  559       const auto constToList = var.toList();
 
  560       for ( 
const QVariant &listVar : constToList )
 
  562         processVariant( listVar );
 
  565     else if ( var.type() == QVariant::StringList )
 
  567       const auto constToStringList = var.toStringList();
 
  568       for ( 
const QString &s : constToStringList )
 
  577       const QStringList parts = var.toString().split( 
',' );
 
  578       for ( 
const QString &s : parts )
 
  585   processVariant( val );
 
  591 #if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) 
  592   QSet<QString> subtraction = enumValues.toSet().subtract( enumDef->
options().toSet() );
 
  594   const QStringList options = enumDef->
options();
 
  595   const QSet<QString> subtraction = QSet<QString>( enumValues.begin(), enumValues.end() ).subtract( QSet<QString>( options.begin(), options.end() ) );
 
  598   if ( enumValues.isEmpty() || !subtraction.isEmpty() )
 
  630   const QVariant val = value;
 
  633   else if ( val.isValid() )
 
  646   const QVariant val = value;
 
  649   else if ( val.isValid() )
 
  657     QgsProcessingContext &context, QString &destinationIdentifier, QgsFeatureSink::SinkFlags sinkFlags,
 
  658     const QVariantMap &createOptions, 
const QStringList &datasourceOptions, 
const QStringList &layerOptions )
 
  663     val = parameters.value( definition->
name() );
 
  666   return parameterAsSink( definition, val, fields, geometryType, 
crs, context, destinationIdentifier, sinkFlags, createOptions, datasourceOptions, layerOptions );
 
  669 QgsFeatureSink *
QgsProcessingParameters::parameterAsSink( 
const QgsProcessingParameterDefinition *definition, 
const QVariant &value, 
const QgsFields &fields, 
QgsWkbTypes::Type geometryType, 
const QgsCoordinateReferenceSystem &
crs, 
QgsProcessingContext &context, QString &destinationIdentifier, QgsFeatureSink::SinkFlags sinkFlags, 
const QVariantMap &createOptions, 
const QStringList &datasourceOptions, 
const QStringList &layerOptions )
 
  671   QVariantMap options = createOptions;
 
  672   QVariant val = value;
 
  677   bool useRemapDefinition = 
false;
 
  689       useRemapDefinition = 
true;
 
  699   else if ( !val.isValid() || val.toString().isEmpty() )
 
  715     dest = val.toString();
 
  720       dest = destParam->generateTemporaryDestination();
 
  723   if ( dest.isEmpty() )
 
  726   std::unique_ptr< QgsFeatureSink > sink( 
QgsProcessingUtils::createFeatureSink( dest, context, fields, geometryType, 
crs, options, datasourceOptions, layerOptions, sinkFlags, useRemapDefinition ? &remapDefinition : 
nullptr ) );
 
  727   destinationIdentifier = dest;
 
  729   if ( destinationProject )
 
  731     if ( destName.isEmpty() && definition )
 
  737       outputName = definition->
name();
 
  741   return sink.release();
 
  765   QVariant val = parameters.value( definition->
name() );
 
  767   bool selectedFeaturesOnly = 
false;
 
  768   long long featureLimit = -1;
 
  790   vl = qobject_cast< QgsVectorLayer * >( qvariant_cast<QObject *>( val ) );
 
  799     else if ( !val.isValid() || val.toString().isEmpty() )
 
  805       vl = qobject_cast< QgsVectorLayer * >( qvariant_cast<QObject *>( val ) );
 
  811       layerRef = val.toString();
 
  816       if ( layerRef.isEmpty() )
 
  828            compatibleFormats, preferredFormat, context, feedback, *layerName, featureLimit );
 
  831            compatibleFormats, preferredFormat, context, feedback, featureLimit );
 
  841   QString *destLayer = layerName;
 
  856   return parameterAsLayer( definition, parameters.value( definition->
name() ), context, layerHint );
 
  864   QVariant val = value;
 
  870   if ( 
QgsMapLayer *layer = qobject_cast< QgsMapLayer * >( qvariant_cast<QObject *>( val ) ) )
 
  887   if ( !val.isValid() || val.toString().isEmpty() )
 
  893   if ( 
QgsMapLayer *layer = qobject_cast< QgsMapLayer * >( qvariant_cast<QObject *>( val ) ) )
 
  898   QString layerRef = val.toString();
 
  899   if ( layerRef.isEmpty() )
 
  902   if ( layerRef.isEmpty() )
 
  933     val = parameters.value( definition->
name() );
 
  940   QVariant val = value;
 
  958   else if ( definition && ( !val.isValid() || val.toString().isEmpty() ) )
 
  965     dest = val.toString();
 
  970       dest = destParam->generateTemporaryDestination();
 
  973   if ( destinationProject )
 
  976     if ( destName.isEmpty() && definition )
 
  981       outputName = definition->
name();
 
 1000     val = parameters.value( definition->
name() );
 
 1007   QVariant val = value;
 
 1017   if ( definition && val.canConvert<
QgsProperty>() )
 
 1021   else if ( definition && ( !val.isValid() || val.toString().isEmpty() ) )
 
 1028     dest = val.toString();
 
 1033       dest = destParam->generateTemporaryDestination();
 
 1053   return parameterAsCrs( definition, parameters.value( definition->
name() ), context );
 
 1078   QVariant val = value;
 
 1128   QgsMapLayer *layer = qobject_cast< QgsMapLayer * >( qvariant_cast<QObject *>( val ) );
 
 1134     rectText = val.toString();
 
 1136   if ( rectText.isEmpty() && !layer )
 
 1139   const QRegularExpression rx( QStringLiteral( 
"^(.*?)\\s*,\\s*(.*?),\\s*(.*?),\\s*(.*?)\\s*(?:\\[(.*)\\])?\\s*$" ) );
 
 1140   const QRegularExpressionMatch match = rx.match( rectText );
 
 1141   if ( match.hasMatch() )
 
 1143     bool xMinOk = 
false;
 
 1144     const double xMin = match.captured( 1 ).toDouble( &xMinOk );
 
 1145     bool xMaxOk = 
false;
 
 1146     const double xMax = match.captured( 2 ).toDouble( &xMaxOk );
 
 1147     bool yMinOk = 
false;
 
 1148     const double yMin = match.captured( 3 ).toDouble( &yMinOk );
 
 1149     bool yMaxOk = 
false;
 
 1150     const double yMax = match.captured( 4 ).toDouble( &yMaxOk );
 
 1151     if ( xMinOk && xMaxOk && yMinOk && yMaxOk )
 
 1202   QVariant val = parameters.value( definition->
name() );
 
 1210       g = g.densifyByCount( 20 );
 
 1246     rectText = val.toString();
 
 1248   if ( !rectText.isEmpty() )
 
 1250     const QRegularExpression rx( QStringLiteral( 
"^(.*?)\\s*,\\s*(.*?),\\s*(.*?),\\s*(.*?)\\s*(?:\\[(.*)\\])?\\s*$" ) );
 
 1251     const QRegularExpressionMatch match = rx.match( rectText );
 
 1252     if ( match.hasMatch() )
 
 1254       bool xMinOk = 
false;
 
 1255       const double xMin = match.captured( 1 ).toDouble( &xMinOk );
 
 1256       bool xMaxOk = 
false;
 
 1257       const double xMax = match.captured( 2 ).toDouble( &xMaxOk );
 
 1258       bool yMinOk = 
false;
 
 1259       const double yMin = match.captured( 3 ).toDouble( &yMinOk );
 
 1260       bool yMaxOk = 
false;
 
 1261       const double yMax = match.captured( 4 ).toDouble( &yMaxOk );
 
 1262       if ( xMinOk && xMaxOk && yMinOk && yMaxOk )
 
 1288   QgsMapLayer *layer = qobject_cast< QgsMapLayer * >( qvariant_cast<QObject *>( val ) );
 
 1317   const QVariant val = parameters.value( definition->
name() );
 
 1323   QVariant val = value;
 
 1351   QString valueAsString;
 
 1355     valueAsString = val.toString();
 
 1357   const QRegularExpression rx( QStringLiteral( 
"^(.*?)\\s*,\\s*(.*?),\\s*(.*?),\\s*(.*?)\\s*(?:\\[(.*)\\])?\\s*$" ) );
 
 1359   const QRegularExpressionMatch match = rx.match( valueAsString );
 
 1360   if ( match.hasMatch() )
 
 1386   if ( 
QgsMapLayer *layer = qobject_cast< QgsMapLayer * >( qvariant_cast<QObject *>( val ) ) )
 
 1387     return layer->crs();
 
 1389     return layer->crs();
 
 1391   if ( 
auto *lProject = context.
project() )
 
 1392     return lProject->crs();
 
 1410   const QVariant val = value;
 
 1440   if ( pointText.isEmpty() )
 
 1443   if ( pointText.isEmpty() )
 
 1446   const QRegularExpression rx( QStringLiteral( 
"^\\s*\\(?\\s*(.*?)\\s*,\\s*(.*?)\\s*(?:\\[(.*)\\])?\\s*\\)?\\s*$" ) );
 
 1449   const QRegularExpressionMatch match = rx.match( valueAsString );
 
 1450   if ( match.hasMatch() )
 
 1453     const double x = match.captured( 1 ).toDouble( &xOk );
 
 1455     const double y = match.captured( 2 ).toDouble( &yOk );
 
 1483   const QVariant val = parameters.value( definition->
name() );
 
 1498   const QRegularExpression rx( QStringLiteral( 
"^\\s*\\(?\\s*(.*?)\\s*,\\s*(.*?)\\s*(?:\\[(.*)\\])?\\s*\\)?\\s*$" ) );
 
 1501   const QRegularExpressionMatch match = rx.match( valueAsString );
 
 1502   if ( match.hasMatch() )
 
 1509   if ( 
auto *lProject = context.
project() )
 
 1510     return lProject->crs();
 
 1528   const QVariant val = value;
 
 1568       g = g.densifyByCount( 20 );
 
 1601   if ( valueAsString.isEmpty() )
 
 1604   if ( valueAsString.isEmpty() )
 
 1607   const QRegularExpression rx( QStringLiteral( 
"^\\s*(?:CRS=(.*);)?(.*?)$" ) );
 
 1609   const QRegularExpressionMatch match = rx.match( valueAsString );
 
 1610   if ( match.hasMatch() )
 
 1637   const QVariant val = parameters.value( definition->
name() );
 
 1671   const QRegularExpression rx( QStringLiteral( 
"^\\s*(?:CRS=(.*);)?(.*?)$" ) );
 
 1674   const QRegularExpressionMatch match = rx.match( valueAsString );
 
 1675   if ( match.hasMatch() )
 
 1682   if ( 
auto *lProject = context.
project() )
 
 1683     return lProject->crs();
 
 1694   if ( fileText.isEmpty() )
 
 1705   if ( fileText.isEmpty() )
 
 1713     return QVariantList();
 
 1721     return QVariantList();
 
 1723   QString resultString;
 
 1724   const QVariant val = value;
 
 1727   else if ( val.type() == QVariant::List )
 
 1728     return val.toList();
 
 1730     resultString = val.toString();
 
 1732   if ( resultString.isEmpty() )
 
 1735     if ( definition->
defaultValue().type() == QVariant::List )
 
 1741   QVariantList result;
 
 1742   const auto constSplit = resultString.split( 
',' );
 
 1745   for ( 
const QString &s : constSplit )
 
 1747     number = s.toDouble( &ok );
 
 1748     result << ( ok ? QVariant( number ) : s );
 
 1757     return QList<QgsMapLayer *>();
 
 1765     return QList<QgsMapLayer *>();
 
 1767   const QVariant val = value;
 
 1768   if ( 
QgsMapLayer *layer = qobject_cast< QgsMapLayer * >( qvariant_cast<QObject *>( val ) ) )
 
 1770     return QList<QgsMapLayer *>() << layer;
 
 1773   QList<QgsMapLayer *> layers;
 
 1775   std::function< void( 
const QVariant &var ) > processVariant;
 
 1776   processVariant = [ &layers, &context, &definition, &processVariant ]( 
const QVariant & var )
 
 1778     if ( var.type() == QVariant::List )
 
 1780       const auto constToList = var.toList();
 
 1781       for ( 
const QVariant &listVar : constToList )
 
 1783         processVariant( listVar );
 
 1786     else if ( var.type() == QVariant::StringList )
 
 1788       const auto constToStringList = var.toStringList();
 
 1789       for ( 
const QString &s : constToStringList )
 
 1791         processVariant( s );
 
 1800       const QVariant sink = fromVar.
sink;
 
 1806     else if ( 
QgsMapLayer *layer = qobject_cast< QgsMapLayer * >( qvariant_cast<QObject *>( var ) ) )
 
 1818   processVariant( val );
 
 1820   if ( layers.isEmpty() )
 
 1823     if ( 
QgsMapLayer *layer = qobject_cast< QgsMapLayer * >( qvariant_cast<QObject *>( definition->
defaultValue() ) ) )
 
 1827     else if ( definition->
defaultValue().type() == QVariant::List )
 
 1829       const auto constToList = definition->
defaultValue().toList();
 
 1830       for ( 
const QVariant &var : constToList )
 
 1832         if ( 
QgsMapLayer *layer = qobject_cast< QgsMapLayer * >( qvariant_cast<QObject *>( var ) ) )
 
 1838           processVariant( var );
 
 1852     return QStringList();
 
 1854   const QVariant val = value;
 
 1858   std::function< void( 
const QVariant &var ) > processVariant;
 
 1859   processVariant = [ &files, &context, &definition, &processVariant ]( 
const QVariant & var )
 
 1861     if ( var.type() == QVariant::List )
 
 1863       const auto constToList = var.toList();
 
 1864       for ( 
const QVariant &listVar : constToList )
 
 1866         processVariant( listVar );
 
 1869     else if ( var.type() == QVariant::StringList )
 
 1871       const auto constToStringList = var.toStringList();
 
 1872       for ( 
const QString &s : constToStringList )
 
 1874         processVariant( s );
 
 1881       files << var.toString();
 
 1885   processVariant( val );
 
 1887   if ( files.isEmpty() )
 
 1898     return QStringList();
 
 1906     return QList<double>();
 
 1914     return QList<double>();
 
 1916   QStringList resultStringList;
 
 1917   const QVariant val = value;
 
 1921   else if ( val.type() == QVariant::List )
 
 1923     const auto constToList = val.toList();
 
 1924     for ( 
const QVariant &var : constToList )
 
 1925       resultStringList << var.toString();
 
 1928     resultStringList << val.toString();
 
 1930   if ( ( resultStringList.isEmpty() || ( resultStringList.size() == 1 && resultStringList.at( 0 ).isEmpty() ) ) )
 
 1932     resultStringList.clear();
 
 1934     if ( definition->
defaultValue().type() == QVariant::List )
 
 1936       const auto constToList = definition->
defaultValue().toList();
 
 1937       for ( 
const QVariant &var : constToList )
 
 1938         resultStringList << var.toString();
 
 1941       resultStringList << definition->
defaultValue().toString();
 
 1944   if ( resultStringList.size() == 1 )
 
 1946     resultStringList = resultStringList.at( 0 ).split( 
',' );
 
 1949   if ( resultStringList.size() < 2 )
 
 1950     return QList< double >() << std::numeric_limits<double>::quiet_NaN()  << std::numeric_limits<double>::quiet_NaN() ;
 
 1952   QList< double > result;
 
 1954   double n = resultStringList.at( 0 ).toDouble( &ok );
 
 1958     result << std::numeric_limits<double>::quiet_NaN() ;
 
 1960   n = resultStringList.at( 1 ).toDouble( &ok );
 
 1964     result << std::numeric_limits<double>::quiet_NaN() ;
 
 1972     return QStringList();
 
 1974   const QStringList resultStringList;
 
 1981     return QStringList();
 
 1983   QStringList resultStringList;
 
 1984   const QVariant val = value;
 
 1985   if ( val.isValid() )
 
 1989     else if ( val.type() == QVariant::List )
 
 1991       const auto constToList = val.toList();
 
 1992       for ( 
const QVariant &var : constToList )
 
 1993         resultStringList << var.toString();
 
 1995     else if ( val.type() == QVariant::StringList )
 
 1997       resultStringList = val.toStringList();
 
 2000       resultStringList.append( val.toString().split( 
';' ) );
 
 2003   if ( ( resultStringList.isEmpty() || resultStringList.at( 0 ).isEmpty() ) )
 
 2005     resultStringList.clear();
 
 2009       if ( definition->
defaultValue().type() == QVariant::List )
 
 2011         const auto constToList = definition->
defaultValue().toList();
 
 2012         for ( 
const QVariant &var : constToList )
 
 2013           resultStringList << var.toString();
 
 2015       else if ( definition->
defaultValue().type() == QVariant::StringList )
 
 2017         resultStringList = definition->
defaultValue().toStringList();
 
 2020         resultStringList.append( definition->
defaultValue().toString().split( 
';' ) );
 
 2024   return resultStringList;
 
 2038   if ( layoutName.isEmpty() )
 
 2090   QVariant val = value;
 
 2095   if ( val.type() == QVariant::Color )
 
 2097     QColor 
c = val.value< QColor >();
 
 2099       if ( !colorParam->opacityEnabled() )
 
 2107     if ( definition->
defaultValue().type() == QVariant::Color )
 
 2113   if ( colorText.isEmpty() )
 
 2116   bool containsAlpha = 
false;
 
 2119     if ( 
c.isValid() && !colorParam->opacityEnabled() )
 
 2191   const QString type = map.value( QStringLiteral( 
"parameter_type" ) ).toString();
 
 2192   const QString name = map.value( QStringLiteral( 
"name" ) ).toString();
 
 2193   std::unique_ptr< QgsProcessingParameterDefinition > def;
 
 2264       def.reset( paramType->
create( name ) );
 
 2270   def->fromVariantMap( map );
 
 2271   return def.release();
 
 2276   QString desc = name;
 
 2277   desc.replace( 
'_', 
' ' );
 
 2283   bool isOptional = 
false;
 
 2287   if ( !parseScriptCodeParameterOptions( code, isOptional, name, type, definition ) )
 
 2292   if ( type == QLatin1String( 
"boolean" ) )
 
 2294   else if ( type == QLatin1String( 
"crs" ) )
 
 2296   else if ( type == QLatin1String( 
"layer" ) )
 
 2298   else if ( type == QLatin1String( 
"extent" ) )
 
 2300   else if ( type == QLatin1String( 
"point" ) )
 
 2302   else if ( type == QLatin1String( 
"geometry" ) )
 
 2304   else if ( type == QLatin1String( 
"file" ) )
 
 2306   else if ( type == QLatin1String( 
"folder" ) )
 
 2308   else if ( type == QLatin1String( 
"matrix" ) )
 
 2310   else if ( type == QLatin1String( 
"multiple" ) )
 
 2312   else if ( type == QLatin1String( 
"number" ) )
 
 2314   else if ( type == QLatin1String( 
"distance" ) )
 
 2316   else if ( type == QLatin1String( 
"duration" ) )
 
 2318   else if ( type == QLatin1String( 
"scale" ) )
 
 2320   else if ( type == QLatin1String( 
"range" ) )
 
 2322   else if ( type == QLatin1String( 
"raster" ) )
 
 2324   else if ( type == QLatin1String( 
"enum" ) )
 
 2326   else if ( type == QLatin1String( 
"string" ) )
 
 2328   else if ( type == QLatin1String( 
"authcfg" ) )
 
 2330   else if ( type == QLatin1String( 
"expression" ) )
 
 2332   else if ( type == QLatin1String( 
"field" ) )
 
 2334   else if ( type == QLatin1String( 
"vector" ) )
 
 2336   else if ( type == QLatin1String( 
"source" ) )
 
 2338   else if ( type == QLatin1String( 
"sink" ) )
 
 2340   else if ( type == QLatin1String( 
"vectordestination" ) )
 
 2342   else if ( type == QLatin1String( 
"rasterdestination" ) )
 
 2344   else if ( type == QLatin1String( 
"filedestination" ) )
 
 2346   else if ( type == QLatin1String( 
"folderdestination" ) )
 
 2348   else if ( type == QLatin1String( 
"band" ) )
 
 2350   else if ( type == QLatin1String( 
"mesh" ) )
 
 2352   else if ( type == QLatin1String( 
"layout" ) )
 
 2354   else if ( type == QLatin1String( 
"layoutitem" ) )
 
 2356   else if ( type == QLatin1String( 
"color" ) )
 
 2358   else if ( type == QLatin1String( 
"coordinateoperation" ) )
 
 2360   else if ( type == QLatin1String( 
"maptheme" ) )
 
 2362   else if ( type == QLatin1String( 
"datetime" ) )
 
 2364   else if ( type == QLatin1String( 
"providerconnection" ) )
 
 2366   else if ( type == QLatin1String( 
"databaseschema" ) )
 
 2368   else if ( type == QLatin1String( 
"databasetable" ) )
 
 2370   else if ( type == QLatin1String( 
"pointcloud" ) )
 
 2372   else if ( type == QLatin1String( 
"annotation" ) )
 
 2378 bool QgsProcessingParameters::parseScriptCodeParameterOptions( 
const QString &code, 
bool &isOptional, QString &name, QString &type, QString &definition )
 
 2380   const QRegularExpression re( QStringLiteral( 
"(?:#*)(.*?)=\\s*(.*)" ) );
 
 2381   QRegularExpressionMatch m = re.match( code );
 
 2382   if ( !m.hasMatch() )
 
 2385   name = m.captured( 1 );
 
 2386   QString tokens = m.captured( 2 );
 
 2387   if ( tokens.startsWith( QLatin1String( 
"optional" ), Qt::CaseInsensitive ) )
 
 2390     tokens.remove( 0, 8 ); 
 
 2397   tokens = tokens.trimmed();
 
 2399   const QRegularExpression re2( QStringLiteral( 
"(.*?)\\s+(.*)" ) );
 
 2400   m = re2.match( tokens );
 
 2401   if ( !m.hasMatch() )
 
 2403     type = tokens.toLower().trimmed();
 
 2408     type = m.captured( 1 ).toLower().trimmed();
 
 2409     definition = m.captured( 2 );
 
 2420   , mDescription( description )
 
 2422   , mDefault( defaultValue )
 
 2423   , mFlags( optional ? FlagOptional : 0 )
 
 2428   if ( !input.isValid() && !
mDefault.isValid() )
 
 2431   if ( ( input.type() == QVariant::String && input.toString().isEmpty() )
 
 2432        || ( !input.isValid() && 
mDefault.type() == QVariant::String && 
mDefault.toString().isEmpty() ) )
 
 2440   if ( !value.isValid() )
 
 2441     return QStringLiteral( 
"None" );
 
 2444     return QStringLiteral( 
"QgsProperty.fromExpression('%1')" ).arg( value.value< 
QgsProperty >().
asExpression() );
 
 2456   QString code = QStringLiteral( 
"##%1=" ).arg( 
mName );
 
 2458     code += QLatin1String( 
"optional " );
 
 2459   code += 
type() + 
' ';
 
 2461   return code.trimmed();
 
 2469     switch ( outputType )
 
 2473         QString code = t->className() + QStringLiteral( 
"('%1', %2" )
 
 2476           code += QLatin1String( 
", optional=True" );
 
 2492   map.insert( QStringLiteral( 
"parameter_type" ), 
type() );
 
 2493   map.insert( QStringLiteral( 
"name" ), 
mName );
 
 2494   map.insert( QStringLiteral( 
"description" ), 
mDescription );
 
 2495   map.insert( QStringLiteral( 
"help" ), 
mHelp );
 
 2496   map.insert( QStringLiteral( 
"default" ), 
mDefault );
 
 2497   map.insert( QStringLiteral( 
"defaultGui" ), 
mGuiDefault );
 
 2498   map.insert( QStringLiteral( 
"flags" ), 
static_cast< int >( 
mFlags ) );
 
 2499   map.insert( QStringLiteral( 
"metadata" ), 
mMetadata );
 
 2505   mName = map.value( QStringLiteral( 
"name" ) ).toString();
 
 2506   mDescription = map.value( QStringLiteral( 
"description" ) ).toString();
 
 2507   mHelp = map.value( QStringLiteral( 
"help" ) ).toString();
 
 2508   mDefault = map.value( QStringLiteral( 
"default" ) );
 
 2509   mGuiDefault = map.value( QStringLiteral( 
"defaultGui" ) );
 
 2510   mFlags = 
static_cast< Flags 
>( map.value( QStringLiteral( 
"flags" ) ).toInt() );
 
 2511   mMetadata = map.value( QStringLiteral( 
"metadata" ) ).toMap();
 
 2527   QString text = QStringLiteral( 
"<p><b>%1</b></p>" ).arg( 
description() );
 
 2528   if ( !
help().isEmpty() )
 
 2530     text += QStringLiteral( 
"<p>%1</p>" ).arg( 
help() );
 
 2532   text += QStringLiteral( 
"<p>%1</p>" ).arg( QObject::tr( 
"Python identifier: ‘%1’" ).arg( QStringLiteral( 
"<i>%1</i>" ).arg( 
name() ) ) );
 
 2547   if ( !val.isValid() )
 
 2548     return QStringLiteral( 
"None" );
 
 2552   return val.toBool() ? QStringLiteral( 
"True" ) : QStringLiteral( 
"False" );
 
 2557   QString code = QStringLiteral( 
"##%1=" ).arg( 
mName );
 
 2559     code += QLatin1String( 
"optional " );
 
 2560   code += 
type() + 
' ';
 
 2561   code += 
mDefault.toBool() ? QStringLiteral( 
"true" ) : QStringLiteral( 
"false" );
 
 2562   return code.trimmed();
 
 2583   if ( !input.isValid() )
 
 2605   if ( qobject_cast< QgsMapLayer * >( qvariant_cast<QObject *>( input ) ) )
 
 2608   if ( input.type() != QVariant::String || input.toString().isEmpty() )
 
 2616   if ( !value.isValid() )
 
 2617     return QStringLiteral( 
"None" );
 
 2622       return QStringLiteral( 
"QgsCoordinateReferenceSystem()" );
 
 2628     return QStringLiteral( 
"QgsProperty.fromExpression('%1')" ).arg( value.value< 
QgsProperty >().
asExpression() );
 
 2631   p.insert( 
name(), value );
 
 2658   if ( !input.isValid() )
 
 2666   if ( qobject_cast< QgsMapLayer * >( qvariant_cast<QObject *>( input ) ) )
 
 2671   if ( input.type() != QVariant::String || input.toString().isEmpty() )
 
 2689   if ( !val.isValid() )
 
 2690     return QStringLiteral( 
"None" );
 
 2696   p.insert( 
name(), val );
 
 2706   for ( 
const QString &raster : rasters )
 
 2708     if ( !vectors.contains( raster ) )
 
 2712   for ( 
const QString &mesh : meshFilters )
 
 2714     if ( !vectors.contains( mesh ) )
 
 2718   for ( 
const QString &pointCloud : pointCloudFilters )
 
 2720     if ( !vectors.contains( pointCloud ) )
 
 2721       vectors << pointCloud;
 
 2723   vectors.removeAll( QObject::tr( 
"All files (*.*)" ) );
 
 2724   std::sort( vectors.begin(), vectors.end() );
 
 2726   return QObject::tr( 
"All files (*.*)" ) + QStringLiteral( 
";;" ) + vectors.join( QLatin1String( 
";;" ) );
 
 2736   QString code = QStringLiteral( 
"##%1=" ).arg( 
mName );
 
 2738     code += QLatin1String( 
"optional " );
 
 2739   code += QLatin1String( 
"layer " );
 
 2746         code += QLatin1String( 
"hasgeometry " );
 
 2750         code += QLatin1String( 
"point " );
 
 2754         code += QLatin1String( 
"line " );
 
 2758         code += QLatin1String( 
"polygon " );
 
 2762         code += QLatin1String( 
"raster " );
 
 2766         code += QLatin1String( 
"mesh " );
 
 2770         code += QLatin1String( 
"plugin " );
 
 2774         code += QLatin1String( 
"pointcloud " );
 
 2778         code += QLatin1String( 
"annotation " );
 
 2784   return code.trimmed();
 
 2790   QString def = definition;
 
 2793     if ( def.startsWith( QLatin1String( 
"hasgeometry" ), Qt::CaseInsensitive ) )
 
 2796       def = def.mid( 12 );
 
 2799     else if ( def.startsWith( QLatin1String( 
"point" ), Qt::CaseInsensitive ) )
 
 2805     else if ( def.startsWith( QLatin1String( 
"line" ), Qt::CaseInsensitive ) )
 
 2811     else if ( def.startsWith( QLatin1String( 
"polygon" ), Qt::CaseInsensitive ) )
 
 2817     else if ( def.startsWith( QLatin1String( 
"raster" ), Qt::CaseInsensitive ) )
 
 2823     else if ( def.startsWith( QLatin1String( 
"mesh" ), Qt::CaseInsensitive ) )
 
 2829     else if ( def.startsWith( QLatin1String( 
"plugin" ), Qt::CaseInsensitive ) )
 
 2835     else if ( def.startsWith( QLatin1String( 
"pointcloud" ), Qt::CaseInsensitive ) )
 
 2838       def = def.mid( 11 );
 
 2841     else if ( def.startsWith( QLatin1String( 
"annotation" ), Qt::CaseInsensitive ) )
 
 2844       def = def.mid( 11 );
 
 2855   switch ( outputType )
 
 2859       QString code = QStringLiteral( 
"QgsProcessingParameterMapLayer('%1', %2" )
 
 2862         code += QLatin1String( 
", optional=True" );
 
 2869         QStringList options;
 
 2873         code += QStringLiteral( 
", types=[%1])" ).arg( options.join( 
',' ) );
 
 2877         code += QLatin1Char( 
')' );
 
 2894   map.insert( QStringLiteral( 
"data_types" ), types );
 
 2902   const QVariantList values = map.value( QStringLiteral( 
"data_types" ) ).toList();
 
 2903   for ( 
const QVariant &val : values )
 
 2923   if ( !input.isValid() )
 
 2956   if ( qobject_cast< QgsMapLayer * >( qvariant_cast<QObject *>( input ) ) )
 
 2959   if ( input.type() != QVariant::String || input.toString().isEmpty() )
 
 2968   const QRegularExpression rx( QStringLiteral( 
"^(.*?)\\s*,\\s*(.*?)\\s*,\\s*(.*?)\\s*,\\s*(.*?)\\s*(?:\\[(.*)\\])?\\s*$" ) );
 
 2969   const QRegularExpressionMatch match = rx.match( input.toString() );
 
 2970   if ( match.hasMatch() )
 
 2972     bool xMinOk = 
false;
 
 2973     ( void )match.captured( 1 ).toDouble( &xMinOk );
 
 2974     bool xMaxOk = 
false;
 
 2975     ( void )match.captured( 2 ).toDouble( &xMaxOk );
 
 2976     bool yMinOk = 
false;
 
 2977     ( void )match.captured( 3 ).toDouble( &yMinOk );
 
 2978     bool yMaxOk = 
false;
 
 2979     ( void )match.captured( 4 ).toDouble( &yMaxOk );
 
 2980     if ( xMinOk && xMaxOk && yMinOk && yMaxOk )
 
 2990   if ( !value.isValid() )
 
 2991     return QStringLiteral( 
"None" );
 
 2994     return QStringLiteral( 
"QgsProperty.fromExpression('%1')" ).arg( value.value< 
QgsProperty >().
asExpression() );
 
 3017       const QString wkt = g.
asWkt();
 
 3018       return QStringLiteral( 
"QgsGeometry.fromWkt('%1')" ).arg( wkt );
 
 3023   p.insert( 
name(), value );
 
 3049   if ( !input.isValid() )
 
 3070   if ( input.type() == QVariant::String )
 
 3072     if ( input.toString().isEmpty() )
 
 3076   const QRegularExpression rx( QStringLiteral( 
"^\\s*\\(?\\s*(.*?)\\s*,\\s*(.*?)\\s*(?:\\[(.*)\\])?\\s*\\)?\\s*$" ) );
 
 3078   const QRegularExpressionMatch match = rx.match( input.toString() );
 
 3079   if ( match.hasMatch() )
 
 3082     ( void )match.captured( 1 ).toDouble( &xOk );
 
 3084     ( void )match.captured( 2 ).toDouble( &yOk );
 
 3093   if ( !value.isValid() )
 
 3094     return QStringLiteral( 
"None" );
 
 3097     return QStringLiteral( 
"QgsProperty.fromExpression('%1')" ).arg( value.value< 
QgsProperty >().
asExpression() );
 
 3117       const QString wkt = g.
asWkt();
 
 3118       return QStringLiteral( 
"QgsGeometry.fromWkt('%1')" ).arg( wkt );
 
 3131     const QVariant &defaultValue, 
bool optional, 
const QList<int> &geometryTypes, 
bool allowMultipart )
 
 3133     mGeomTypes( geometryTypes ),
 
 3134     mAllowMultipart( allowMultipart )
 
 3146   if ( !input.isValid() )
 
 3158     return ( anyTypeAllowed || mGeomTypes.contains( input.value<
QgsGeometry>().
type() ) ) &&
 
 3159            ( mAllowMultipart || !input.value<
QgsGeometry>().isMultipart() );
 
 3188   if ( input.type() == QVariant::String )
 
 3190     if ( input.toString().isEmpty() )
 
 3195   const QRegularExpression rx( QStringLiteral( 
"^\\s*(?:CRS=(.*);)?(.*?)$" ) );
 
 3197   const QRegularExpressionMatch match = rx.match( input.toString() );
 
 3198   if ( match.hasMatch() )
 
 3203       return ( anyTypeAllowed || mGeomTypes.contains( g.
type() ) ) && ( mAllowMultipart || !g.
isMultipart() );
 
 3223   if ( !value.isValid() )
 
 3224     return QStringLiteral( 
"None" );
 
 3276   QString code = QStringLiteral( 
"##%1=" ).arg( 
mName );
 
 3278     code += QLatin1String( 
"optional " );
 
 3279   code += 
type() + 
' ';
 
 3281   for ( 
const int type : mGeomTypes )
 
 3286         code += QLatin1String( 
"point " );
 
 3290         code += QLatin1String( 
"line " );
 
 3294         code += QLatin1String( 
"polygon " );
 
 3298         code += QLatin1String( 
"unknown " );
 
 3304   return code.trimmed();
 
 3309   switch ( outputType )
 
 3313       QString code = QStringLiteral( 
"QgsProcessingParameterGeometry('%1', %2" )
 
 3316         code += QLatin1String( 
", optional=True" );
 
 3318       if ( !mGeomTypes.empty() )
 
 3325               return QStringLiteral( 
"PointGeometry" );
 
 3328               return QStringLiteral( 
"LineGeometry" );
 
 3331               return QStringLiteral( 
"PolygonGeometry" );
 
 3334               return QStringLiteral( 
"UnknownGeometry" );
 
 3337               return QStringLiteral( 
"NullGeometry" );
 
 3342         QStringList options;
 
 3343         options.reserve( mGeomTypes.size() );
 
 3344         for ( 
const int type : mGeomTypes )
 
 3348         code += QStringLiteral( 
", geometryTypes=[%1 ]" ).arg( options.join( 
',' ) );
 
 3351       if ( ! mAllowMultipart )
 
 3353         code += QLatin1String( 
", allowMultipart=False" );
 
 3368   for ( 
const int type : mGeomTypes )
 
 3372   map.insert( QStringLiteral( 
"geometrytypes" ), types );
 
 3373   map.insert( QStringLiteral( 
"multipart" ), mAllowMultipart );
 
 3381   const QVariantList values = map.value( QStringLiteral( 
"geometrytypes" ) ).toList();
 
 3382   for ( 
const QVariant &val : values )
 
 3384     mGeomTypes << val.toInt();
 
 3386   mAllowMultipart = map.value( QStringLiteral( 
"multipart" ) ).toBool();
 
 3397   , mBehavior( behavior )
 
 3398   , mExtension( fileFilter.isEmpty() ? extension : QString() )
 
 3399   , mFileFilter( fileFilter.isEmpty() && extension.isEmpty() ? QObject::tr( 
"All files (*.*)" ) : fileFilter )
 
 3411   if ( !input.isValid() )
 
 3419   const QString 
string = input.toString().trimmed();
 
 3421   if ( input.type() != QVariant::String || 
string.isEmpty() )
 
 3424   switch ( mBehavior )
 
 3428       if ( !mExtension.isEmpty() )
 
 3430         return string.endsWith( mExtension, Qt::CaseInsensitive );
 
 3432       else if ( !mFileFilter.isEmpty() )
 
 3450   QString code = QStringLiteral( 
"##%1=" ).arg( 
mName );
 
 3452     code += QLatin1String( 
"optional " );
 
 3453   code += ( mBehavior == 
File ? QStringLiteral( 
"file" ) : QStringLiteral( 
"folder" ) ) + 
' ';
 
 3455   return code.trimmed();
 
 3460   switch ( outputType )
 
 3465       QString code = QStringLiteral( 
"QgsProcessingParameterFile('%1', %2" )
 
 3468         code += QLatin1String( 
", optional=True" );
 
 3469       code += QStringLiteral( 
", behavior=%1" ).arg( mBehavior == 
File ? QStringLiteral( 
"QgsProcessingParameterFile.File" ) : QStringLiteral( 
"QgsProcessingParameterFile.Folder" ) );
 
 3470       if ( !mExtension.isEmpty() )
 
 3471         code += QStringLiteral( 
", extension='%1'" ).arg( mExtension );
 
 3472       if ( !mFileFilter.isEmpty() )
 
 3473         code += QStringLiteral( 
", fileFilter='%1'" ).arg( mFileFilter );
 
 3484   switch ( mBehavior )
 
 3488       if ( !mFileFilter.isEmpty() )
 
 3489         return mFileFilter != QObject::tr( 
"All files (*.*)" ) ? mFileFilter + QStringLiteral( 
";;" ) + QObject::tr( 
"All files (*.*)" ) : mFileFilter;
 
 3490       else if ( !mExtension.isEmpty() )
 
 3491         return QObject::tr( 
"%1 files" ).arg( mExtension.toUpper() ) + QStringLiteral( 
" (*." ) + mExtension.toLower() +  QStringLiteral( 
");;" ) + QObject::tr( 
"All files (*.*)" );
 
 3493         return QObject::tr( 
"All files (*.*)" );
 
 3505   mFileFilter.clear();
 
 3515   mFileFilter = filter;
 
 3522   map.insert( QStringLiteral( 
"behavior" ), mBehavior );
 
 3523   map.insert( QStringLiteral( 
"extension" ), mExtension );
 
 3524   map.insert( QStringLiteral( 
"filefilter" ), mFileFilter );
 
 3531   mBehavior = 
static_cast< Behavior >( map.value( QStringLiteral( 
"behavior" ) ).toInt() );
 
 3532   mExtension = map.value( QStringLiteral( 
"extension" ) ).toString();
 
 3533   mFileFilter = map.value( QStringLiteral( 
"filefilter" ) ).toString();
 
 3544   , mHeaders( headers )
 
 3545   , mNumberRows( numberRows )
 
 3546   , mFixedNumberRows( fixedNumberRows )
 
 3558   if ( !input.isValid() )
 
 3561   if ( input.type() == QVariant::String )
 
 3563     if ( input.toString().isEmpty() )
 
 3567   else if ( input.type() == QVariant::List )
 
 3569     if ( input.toList().isEmpty() )
 
 3573   else if ( input.type() == QVariant::Double || input.type() == QVariant::Int )
 
 3583   if ( !value.isValid() )
 
 3584     return QStringLiteral( 
"None" );
 
 3587     return QStringLiteral( 
"QgsProperty.fromExpression('%1')" ).arg( value.value< 
QgsProperty >().
asExpression() );
 
 3590   p.insert( 
name(), value );
 
 3598   switch ( outputType )
 
 3602       QString code = QStringLiteral( 
"QgsProcessingParameterMatrix('%1', %2" )
 
 3605         code += QLatin1String( 
", optional=True" );
 
 3606       code += QStringLiteral( 
", numberRows=%1" ).arg( mNumberRows );
 
 3607       code += QStringLiteral( 
", hasFixedNumberRows=%1" ).arg( mFixedNumberRows ? QStringLiteral( 
"True" ) : QStringLiteral( 
"False" ) );
 
 3610       headers.reserve( mHeaders.size() );
 
 3611       for ( 
const QString &h : mHeaders )
 
 3613       code += QStringLiteral( 
", headers=[%1]" ).arg( 
headers.join( 
',' ) );
 
 3645   return mFixedNumberRows;
 
 3650   mFixedNumberRows = fixedNumberRows;
 
 3656   map.insert( QStringLiteral( 
"headers" ), mHeaders );
 
 3657   map.insert( QStringLiteral( 
"rows" ), mNumberRows );
 
 3658   map.insert( QStringLiteral( 
"fixed_number_rows" ), mFixedNumberRows );
 
 3665   mHeaders = map.value( QStringLiteral( 
"headers" ) ).toStringList();
 
 3666   mNumberRows = map.value( QStringLiteral( 
"rows" ) ).toInt();
 
 3667   mFixedNumberRows = map.value( QStringLiteral( 
"fixed_number_rows" ) ).toBool();
 
 3678   , mLayerType( layerType )
 
 3690   if ( !input.isValid() )
 
 3695     if ( qobject_cast< QgsMapLayer * >( qvariant_cast<QObject *>( input ) ) )
 
 3701   if ( input.type() == QVariant::String )
 
 3703     if ( input.toString().isEmpty() )
 
 3706     if ( mMinimumNumberInputs > 1 )
 
 3717   else if ( input.type() == QVariant::List )
 
 3719     if ( input.toList().count() < mMinimumNumberInputs )
 
 3722     if ( mMinimumNumberInputs > input.toList().count() )
 
 3730       const auto constToList = input.toList();
 
 3731       for ( 
const QVariant &v : constToList )
 
 3733         if ( qobject_cast< QgsMapLayer * >( qvariant_cast<QObject *>( v ) ) )
 
 3742   else if ( input.type() == QVariant::StringList )
 
 3744     if ( input.toStringList().count() < mMinimumNumberInputs )
 
 3747     if ( mMinimumNumberInputs > input.toStringList().count() )
 
 3755       const auto constToStringList = input.toStringList();
 
 3756       for ( 
const QString &v : constToStringList )
 
 3769   if ( !value.isValid() )
 
 3770     return QStringLiteral( 
"None" );
 
 3773     return QStringLiteral( 
"QgsProperty.fromExpression('%1')" ).arg( value.value< 
QgsProperty >().
asExpression() );
 
 3778     if ( value.type() == QVariant::StringList )
 
 3780       const QStringList list = value.toStringList();
 
 3781       parts.reserve( list.count() );
 
 3782       for ( 
const QString &v : list )
 
 3785     else if ( value.type() == QVariant::List )
 
 3787       const QVariantList list = value.toList();
 
 3788       parts.reserve( list.count() );
 
 3789       for ( 
const QVariant &v : list )
 
 3792     if ( !parts.isEmpty() )
 
 3793       return parts.join( 
',' ).prepend( 
'[' ).append( 
']' );
 
 3798     p.insert( 
name(), value );
 
 3800     if ( !list.isEmpty() )
 
 3803       parts.reserve( list.count() );
 
 3808       return parts.join( 
',' ).prepend( 
'[' ).append( 
']' );
 
 3817   QString code = QStringLiteral( 
"##%1=" ).arg( 
mName );
 
 3819     code += QLatin1String( 
"optional " );
 
 3820   switch ( mLayerType )
 
 3823       code += QLatin1String( 
"multiple raster" );
 
 3827       code += QLatin1String( 
"multiple file" );
 
 3831       code += QLatin1String( 
"multiple vector" );
 
 3835   if ( 
mDefault.type() == QVariant::List )
 
 3838     const auto constToList = 
mDefault.toList();
 
 3839     for ( 
const QVariant &var : constToList )
 
 3841       parts << var.toString();
 
 3843     code += parts.join( 
',' );
 
 3845   else if ( 
mDefault.type() == QVariant::StringList )
 
 3847     code += 
mDefault.toStringList().join( 
',' );
 
 3853   return code.trimmed();
 
 3858   switch ( outputType )
 
 3862       QString code = QStringLiteral( 
"QgsProcessingParameterMultipleLayers('%1', %2" )
 
 3865         code += QLatin1String( 
", optional=True" );
 
 3869       code += QStringLiteral( 
", layerType=%1" ).arg( 
layerType );
 
 3880   const QStringList exts;
 
 3881   switch ( mLayerType )
 
 3884       return QObject::tr( 
"All files (*.*)" );
 
 3922   return mMinimumNumberInputs;
 
 3934   map.insert( QStringLiteral( 
"layer_type" ), mLayerType );
 
 3935   map.insert( QStringLiteral( 
"min_inputs" ), mMinimumNumberInputs );
 
 3943   mMinimumNumberInputs = map.value( QStringLiteral( 
"min_inputs" ) ).toInt();
 
 3949   QString 
type = definition;
 
 3951   const QRegularExpression re( QStringLiteral( 
"(.*?)\\s+(.*)" ) );
 
 3952   const QRegularExpressionMatch m = re.match( definition );
 
 3955     type = m.captured( 1 ).toLower().trimmed();
 
 3956     defaultVal = m.captured( 2 );
 
 3959   if ( 
type == QLatin1String( 
"vector" ) )
 
 3961   else if ( 
type == QLatin1String( 
"raster" ) )
 
 3963   else if ( 
type == QLatin1String( 
"file" ) )
 
 3976     QgsMessageLog::logMessage( QObject::tr( 
"Invalid number parameter \"%1\": min value %2 is >= max value %3!" ).arg( 
name ).arg( mMin ).arg( mMax ), QObject::tr( 
"Processing" ) );
 
 3987   QVariant input = value;
 
 3988   if ( !input.isValid() )
 
 4002   const double res = input.toDouble( &ok );
 
 4006   return !( res < mMin || res > mMax );
 
 4011   if ( !value.isValid() )
 
 4012     return QStringLiteral( 
"None" );
 
 4015     return QStringLiteral( 
"QgsProperty.fromExpression('%1')" ).arg( value.value< 
QgsProperty >().
asExpression() );
 
 4017   return value.toString();
 
 4024   if ( mMin > std::numeric_limits<double>::lowest() + 1 )
 
 4025     parts << QObject::tr( 
"Minimum value: %1" ).arg( mMin );
 
 4026   if ( mMax < std::numeric_limits<double>::max() )
 
 4027     parts << QObject::tr( 
"Maximum value: %1" ).arg( mMax );
 
 4029     parts << QObject::tr( 
"Default value: %1" ).arg( mDataType == 
Integer ? 
mDefault.toInt() : 
mDefault.toDouble() );
 
 4030   const QString extra = parts.join( QLatin1String( 
"<br />" ) );
 
 4031   if ( !extra.isEmpty() )
 
 4032     text += QStringLiteral( 
"<p>%1</p>" ).arg( extra );
 
 4038   switch ( outputType )
 
 4042       QString code = QStringLiteral( 
"QgsProcessingParameterNumber('%1', %2" )
 
 4045         code += QLatin1String( 
", optional=True" );
 
 4047       code += QStringLiteral( 
", type=%1" ).arg( mDataType == 
Integer ? QStringLiteral( 
"QgsProcessingParameterNumber.Integer" ) : QStringLiteral( 
"QgsProcessingParameterNumber.Double" ) );
 
 4049       if ( mMin != std::numeric_limits<double>::lowest() + 1 )
 
 4050         code += QStringLiteral( 
", minValue=%1" ).arg( mMin );
 
 4051       if ( mMax != std::numeric_limits<double>::max() )
 
 4052         code += QStringLiteral( 
", maxValue=%1" ).arg( mMax );
 
 4094   map.insert( QStringLiteral( 
"min" ), mMin );
 
 4095   map.insert( QStringLiteral( 
"max" ), mMax );
 
 4096   map.insert( QStringLiteral( 
"data_type" ), mDataType );
 
 4103   mMin = map.value( QStringLiteral( 
"min" ) ).toDouble();
 
 4104   mMax = map.value( QStringLiteral( 
"max" ) ).toDouble();
 
 4105   mDataType = 
static_cast< Type >( map.value( QStringLiteral( 
"data_type" ) ).toInt() );
 
 4112          : ( definition.toLower().trimmed() == QLatin1String( 
"none" ) ? QVariant() : definition ), isOptional );
 
 4129   if ( !input.isValid() )
 
 4137   if ( input.type() == QVariant::String )
 
 4139     const QStringList list = input.toString().split( 
',' );
 
 4140     if ( list.count() != 2 )
 
 4143     list.at( 0 ).toDouble( &ok );
 
 4145     list.at( 1 ).toDouble( &ok2 );
 
 4150   else if ( input.type() == QVariant::List )
 
 4152     if ( input.toList().count() != 2 )
 
 4156     input.toList().at( 0 ).toDouble( &ok );
 
 4158     input.toList().at( 1 ).toDouble( &ok2 );
 
 4169   if ( !value.isValid() )
 
 4170     return QStringLiteral( 
"None" );
 
 4173     return QStringLiteral( 
"QgsProperty.fromExpression('%1')" ).arg( value.value< 
QgsProperty >().
asExpression() );
 
 4176   p.insert( 
name(), value );
 
 4179   QStringList stringParts;
 
 4180   const auto constParts = parts;
 
 4181   for ( 
const double v : constParts )
 
 4183     stringParts << QString::number( v );
 
 4185   return stringParts.join( 
',' ).prepend( 
'[' ).append( 
']' );
 
 4190   switch ( outputType )
 
 4194       QString code = QStringLiteral( 
"QgsProcessingParameterRange('%1', %2" )
 
 4197         code += QLatin1String( 
", optional=True" );
 
 4199       code += QStringLiteral( 
", type=%1" ).arg( mDataType == 
QgsProcessingParameterNumber::Integer ? QStringLiteral( 
"QgsProcessingParameterNumber.Integer" ) : QStringLiteral( 
"QgsProcessingParameterNumber.Double" ) );
 
 4222   map.insert( QStringLiteral( 
"data_type" ), mDataType );
 
 4236                                           : ( definition.toLower().trimmed() == QLatin1String( 
"none" ) ? QVariant() : definition ), isOptional );
 
 4252   if ( !input.isValid() )
 
 4260   if ( qobject_cast< QgsRasterLayer * >( qvariant_cast<QObject *>( input ) ) )
 
 4263   if ( input.type() != QVariant::String || input.toString().isEmpty() )
 
 4281   if ( !val.isValid() )
 
 4282     return QStringLiteral( 
"None" );
 
 4288   p.insert( 
name(), val );
 
 4306   , mOptions( options )
 
 4307   , mAllowMultiple( allowMultiple )
 
 4308   , mUsesStaticStrings( usesStaticStrings )
 
 4320   QVariant input = value;
 
 4321   if ( !input.isValid() )
 
 4334   if ( mUsesStaticStrings )
 
 4336     if ( input.type() == QVariant::List )
 
 4338       if ( !mAllowMultiple )
 
 4341       const QVariantList values = input.toList();
 
 4345       for ( 
const QVariant &val : values )
 
 4347         if ( !mOptions.contains( val.toString() ) )
 
 4353     else if ( input.type() == QVariant::StringList )
 
 4355       if ( !mAllowMultiple )
 
 4358       const QStringList values = input.toStringList();
 
 4363       if ( values.count() > 1 && !mAllowMultiple )
 
 4366       for ( 
const QString &val : values )
 
 4368         if ( !mOptions.contains( val ) )
 
 4373     else if ( input.type() == QVariant::String )
 
 4375       const QStringList parts = input.toString().split( 
',' );
 
 4376       if ( parts.count() > 1 && !mAllowMultiple )
 
 4379       const auto constParts = parts;
 
 4380       for ( 
const QString &part : constParts )
 
 4382         if ( !mOptions.contains( part ) )
 
 4390     if ( input.type() == QVariant::List )
 
 4392       if ( !mAllowMultiple )
 
 4395       const QVariantList values = input.toList();
 
 4399       for ( 
const QVariant &val : values )
 
 4402         const int res = val.toInt( &ok );
 
 4405         else if ( res < 0 || res >= mOptions.count() )
 
 4411     else if ( input.type() == QVariant::String )
 
 4413       const QStringList parts = input.toString().split( 
',' );
 
 4414       if ( parts.count() > 1 && !mAllowMultiple )
 
 4417       const auto constParts = parts;
 
 4418       for ( 
const QString &part : constParts )
 
 4421         const int res = part.toInt( &ok );
 
 4424         else if ( res < 0 || res >= mOptions.count() )
 
 4429     else if ( input.type() == QVariant::Int || input.type() == QVariant::Double )
 
 4432       const int res = input.toInt( &ok );
 
 4435       else if ( res >= 0 && res < mOptions.count() )
 
 4445   if ( !value.isValid() )
 
 4446     return QStringLiteral( 
"None" );
 
 4449     return QStringLiteral( 
"QgsProperty.fromExpression('%1')" ).arg( value.value< 
QgsProperty >().
asExpression() );
 
 4451   if ( mUsesStaticStrings )
 
 4453     if ( value.type() == QVariant::StringList )
 
 4456       const QStringList constList = value.toStringList();
 
 4457       for ( 
const QString &val : constList )
 
 4461       return parts.join( 
',' ).prepend( 
'[' ).append( 
']' );
 
 4463     else if ( value.type() == QVariant::String )
 
 4466       const QStringList constList = value.toString().split( 
',' );
 
 4467       if ( constList.count() > 1 )
 
 4469         for ( 
const QString &val : constList )
 
 4473         return parts.join( 
',' ).prepend( 
'[' ).append( 
']' );
 
 4481     if ( value.type() == QVariant::List )
 
 4484       const auto constToList = value.toList();
 
 4485       for ( 
const QVariant &val : constToList )
 
 4487         parts << QString::number( static_cast< int >( val.toDouble() ) );
 
 4489       return parts.join( 
',' ).prepend( 
'[' ).append( 
']' );
 
 4491     else if ( value.type() == QVariant::String )
 
 4493       const QStringList parts = value.toString().split( 
',' );
 
 4494       if ( parts.count() > 1 )
 
 4496         return parts.join( 
',' ).prepend( 
'[' ).append( 
']' );
 
 4500     return QString::number( 
static_cast< int >( value.toDouble() ) );
 
 4506   if ( !value.isValid() )
 
 4512   if ( mUsesStaticStrings )
 
 4518     if ( value.type() == QVariant::List )
 
 4521       const QVariantList toList = value.toList();
 
 4522       parts.reserve( toList.size() );
 
 4523       for ( 
const QVariant &val : toList )
 
 4525         parts << mOptions.value( 
static_cast< int >( val.toDouble() ) );
 
 4527       return parts.join( 
',' );
 
 4529     else if ( value.type() == QVariant::String )
 
 4531       const QStringList parts = value.toString().split( 
',' );
 
 4532       QStringList comments;
 
 4533       if ( parts.count() > 1 )
 
 4535         for ( 
const QString &part : parts )
 
 4538           const int val = part.toInt( &ok );
 
 4540             comments << mOptions.value( val );
 
 4542         return comments.join( 
',' );
 
 4546     return mOptions.value( 
static_cast< int >( value.toDouble() ) );
 
 4552   QString code = QStringLiteral( 
"##%1=" ).arg( 
mName );
 
 4554     code += QLatin1String( 
"optional " );
 
 4555   code += QLatin1String( 
"enum " );
 
 4557   if ( mAllowMultiple )
 
 4558     code += QLatin1String( 
"multiple " );
 
 4560   if ( mUsesStaticStrings )
 
 4561     code += QLatin1String( 
"static " );
 
 4563   code += mOptions.join( 
';' ) + 
' ';
 
 4566   return code.trimmed();
 
 4571   switch ( outputType )
 
 4575       QString code = QStringLiteral( 
"QgsProcessingParameterEnum('%1', %2" )
 
 4578         code += QLatin1String( 
", optional=True" );
 
 4581       options.reserve( mOptions.size() );
 
 4582       for ( 
const QString &o : mOptions )
 
 4584       code += QStringLiteral( 
", options=[%1]" ).arg( 
options.join( 
',' ) );
 
 4586       code += QStringLiteral( 
", allowMultiple=%1" ).arg( mAllowMultiple ? QStringLiteral( 
"True" ) : QStringLiteral( 
"False" ) );
 
 4588       code += QStringLiteral( 
", usesStaticStrings=%1" ).arg( mUsesStaticStrings ? QStringLiteral( 
"True" ) : QStringLiteral( 
"False" ) );
 
 4611   return mAllowMultiple;
 
 4621   return mUsesStaticStrings;
 
 4632   map.insert( QStringLiteral( 
"options" ), mOptions );
 
 4633   map.insert( QStringLiteral( 
"allow_multiple" ), mAllowMultiple );
 
 4634   map.insert( QStringLiteral( 
"uses_static_strings" ), mUsesStaticStrings );
 
 4641   mOptions = map.value( QStringLiteral( 
"options" ) ).toStringList();
 
 4642   mAllowMultiple = map.value( QStringLiteral( 
"allow_multiple" ) ).toBool();
 
 4643   mUsesStaticStrings = map.value( QStringLiteral( 
"uses_static_strings" ) ).toBool();
 
 4650   QString def = definition;
 
 4652   bool multiple = 
false;
 
 4653   if ( def.startsWith( QLatin1String( 
"multiple" ), Qt::CaseInsensitive ) )
 
 4659   bool staticStrings = 
false;
 
 4660   if ( def.startsWith( QLatin1String( 
"static" ), Qt::CaseInsensitive ) )
 
 4662     staticStrings = 
true;
 
 4666   const QRegularExpression re( QStringLiteral( 
"(.*)\\s+(.*?)$" ) );
 
 4667   const QRegularExpressionMatch m = re.match( def );
 
 4668   QString values = def;
 
 4671     values = m.captured( 1 ).trimmed();
 
 4672     defaultVal = m.captured( 2 );
 
 4680   , mMultiLine( multiLine )
 
 4692   if ( !value.isValid() || value.isNull() )
 
 4693     return QStringLiteral( 
"None" );
 
 4696     return QStringLiteral( 
"QgsProperty.fromExpression('%1')" ).arg( value.value< 
QgsProperty >().
asExpression() );
 
 4698   const QString s = value.toString();
 
 4704   QString code = QStringLiteral( 
"##%1=" ).arg( 
mName );
 
 4706     code += QLatin1String( 
"optional " );
 
 4707   code += QLatin1String( 
"string " );
 
 4710     code += QLatin1String( 
"long " );
 
 4713   return code.trimmed();
 
 4718   switch ( outputType )
 
 4722       QString code = QStringLiteral( 
"QgsProcessingParameterString('%1', %2" )
 
 4725         code += QLatin1String( 
", optional=True" );
 
 4726       code += QStringLiteral( 
", multiLine=%1" ).arg( mMultiLine ? QStringLiteral( 
"True" ) : QStringLiteral( 
"False" ) );
 
 4749   map.insert( QStringLiteral( 
"multiline" ), mMultiLine );
 
 4756   mMultiLine = map.value( QStringLiteral( 
"multiline" ) ).toBool();
 
 4762   QString def = definition;
 
 4764   if ( def.startsWith( QLatin1String( 
"long" ), Qt::CaseInsensitive ) )
 
 4770   if ( def.startsWith( 
'"' ) || def.startsWith( 
'\'' ) )
 
 4772   if ( def.endsWith( 
'"' ) || def.endsWith( 
'\'' ) )
 
 4776   if ( def == QLatin1String( 
"None" ) )
 
 4799   if ( !value.isValid() )
 
 4800     return QStringLiteral( 
"None" );
 
 4802   const QString s = value.toString();
 
 4808   QString code = QStringLiteral( 
"##%1=" ).arg( 
mName );
 
 4810     code += QLatin1String( 
"optional " );
 
 4811   code += QLatin1String( 
"authcfg " );
 
 4814   return code.trimmed();
 
 4819   QString def = definition;
 
 4821   if ( def.startsWith( 
'"' ) || def.startsWith( 
'\'' ) )
 
 4823   if ( def.endsWith( 
'"' ) || def.endsWith( 
'\'' ) )
 
 4827   if ( def == QLatin1String( 
"None" ) )
 
 4840   , mParentLayerParameterName( parentLayerParameterName )
 
 4852   if ( !value.isValid() )
 
 4853     return QStringLiteral( 
"None" );
 
 4856     return QStringLiteral( 
"QgsProperty.fromExpression('%1')" ).arg( value.value< 
QgsProperty >().
asExpression() );
 
 4858   const QString s = value.toString();
 
 4864   QStringList depends;
 
 4865   if ( !mParentLayerParameterName.isEmpty() )
 
 4866     depends << mParentLayerParameterName;
 
 4872   switch ( outputType )
 
 4876       QString code = QStringLiteral( 
"QgsProcessingParameterExpression('%1', %2" )
 
 4879         code += QLatin1String( 
", optional=True" );
 
 4881       code += QStringLiteral( 
", parentLayerParameterName='%1'" ).arg( mParentLayerParameterName );
 
 4893   return mParentLayerParameterName;
 
 4904   map.insert( QStringLiteral( 
"parent_layer" ), mParentLayerParameterName );
 
 4911   mParentLayerParameterName = map.value( QStringLiteral( 
"parent_layer" ) ).toString();
 
 4952   if ( qobject_cast< QgsVectorLayer * >( qvariant_cast<QObject *>( var ) ) )
 
 4955   if ( var.type() != QVariant::String || var.toString().isEmpty() )
 
 4973   if ( !val.isValid() )
 
 4974     return QStringLiteral( 
"None" );
 
 4980   p.insert( 
name(), val );
 
 4988   switch ( outputType )
 
 4992       QString code = QStringLiteral( 
"QgsProcessingParameterVectorLayer('%1', %2" )
 
 4995         code += QLatin1String( 
", optional=True" );
 
 4999         QStringList options;
 
 5002         code += QStringLiteral( 
", types=[%1]" ).arg( options.join( 
',' ) );
 
 5036   map.insert( QStringLiteral( 
"data_types" ), types );
 
 5044   const QVariantList values = map.value( QStringLiteral( 
"data_types" ) ).toList();
 
 5045   for ( 
const QVariant &val : values )
 
 5058     const QVariant &defaultValue, 
bool optional )
 
 5089   if ( qobject_cast< QgsMeshLayer * >( qvariant_cast<QObject *>( var ) ) )
 
 5092   if ( var.type() != QVariant::String || var.toString().isEmpty() )
 
 5110   if ( !val.isValid() )
 
 5111     return QStringLiteral( 
"None" );
 
 5117   p.insert( 
name(), val );
 
 5135   , mParentLayerParameterName( parentLayerParameterName )
 
 5137   , mAllowMultiple( allowMultiple )
 
 5138   , mDefaultToAllFields( defaultToAllFields )
 
 5151   if ( !input.isValid() )
 
 5159   if ( input.type() == QVariant::List || input.type() == QVariant::StringList )
 
 5161     if ( !mAllowMultiple )
 
 5167   else if ( input.type() == QVariant::String )
 
 5169     if ( input.toString().isEmpty() )
 
 5172     const QStringList parts = input.toString().split( 
';' );
 
 5173     if ( parts.count() > 1 && !mAllowMultiple )
 
 5178     if ( input.toString().isEmpty() )
 
 5186   if ( !value.isValid() )
 
 5187     return QStringLiteral( 
"None" );
 
 5190     return QStringLiteral( 
"QgsProperty.fromExpression('%1')" ).arg( value.value< 
QgsProperty >().
asExpression() );
 
 5192   if ( value.type() == QVariant::List )
 
 5195     const auto constToList = value.toList();
 
 5196     for ( 
const QVariant &val : constToList )
 
 5200     return parts.join( 
',' ).prepend( 
'[' ).append( 
']' );
 
 5202   else if ( value.type() == QVariant::StringList )
 
 5205     const auto constToStringList = value.toStringList();
 
 5206     for ( 
const QString &s : constToStringList )
 
 5210     return parts.join( 
',' ).prepend( 
'[' ).append( 
']' );
 
 5218   QString code = QStringLiteral( 
"##%1=" ).arg( 
mName );
 
 5220     code += QLatin1String( 
"optional " );
 
 5221   code += QLatin1String( 
"field " );
 
 5223   switch ( mDataType )
 
 5226       code += QLatin1String( 
"numeric " );
 
 5230       code += QLatin1String( 
"string " );
 
 5234       code += QLatin1String( 
"datetime " );
 
 5241   if ( mAllowMultiple )
 
 5242     code += QLatin1String( 
"multiple " );
 
 5244   if ( mDefaultToAllFields )
 
 5245     code += QLatin1String( 
"default_to_all_fields " );
 
 5247   code += mParentLayerParameterName + 
' ';
 
 5250   return code.trimmed();
 
 5255   switch ( outputType )
 
 5259       QString code = QStringLiteral( 
"QgsProcessingParameterField('%1', %2" )
 
 5262         code += QLatin1String( 
", optional=True" );
 
 5265       switch ( mDataType )
 
 5268           dataType = QStringLiteral( 
"QgsProcessingParameterField.Any" );
 
 5272           dataType = QStringLiteral( 
"QgsProcessingParameterField.Numeric" );
 
 5276           dataType = QStringLiteral( 
"QgsProcessingParameterField.String" );
 
 5280           dataType = QStringLiteral( 
"QgsProcessingParameterField.DateTime" );
 
 5283       code += QStringLiteral( 
", type=%1" ).arg( 
dataType );
 
 5285       code += QStringLiteral( 
", parentLayerParameterName='%1'" ).arg( mParentLayerParameterName );
 
 5286       code += QStringLiteral( 
", allowMultiple=%1" ).arg( mAllowMultiple ? QStringLiteral( 
"True" ) : QStringLiteral( 
"False" ) );
 
 5290       if ( mDefaultToAllFields )
 
 5291         code += QLatin1String( 
", defaultToAllFields=True" );
 
 5303   QStringList depends;
 
 5304   if ( !mParentLayerParameterName.isEmpty() )
 
 5305     depends << mParentLayerParameterName;
 
 5311   return mParentLayerParameterName;
 
 5331   return mAllowMultiple;
 
 5341   return mDefaultToAllFields;
 
 5346   mDefaultToAllFields = enabled;
 
 5352   map.insert( QStringLiteral( 
"parent_layer" ), mParentLayerParameterName );
 
 5353   map.insert( QStringLiteral( 
"data_type" ), mDataType );
 
 5354   map.insert( QStringLiteral( 
"allow_multiple" ), mAllowMultiple );
 
 5355   map.insert( QStringLiteral( 
"default_to_all_fields" ), mDefaultToAllFields );
 
 5362   mParentLayerParameterName = map.value( QStringLiteral( 
"parent_layer" ) ).toString();
 
 5363   mDataType = 
static_cast< DataType >( map.value( QStringLiteral( 
"data_type" ) ).toInt() );
 
 5364   mAllowMultiple = map.value( QStringLiteral( 
"allow_multiple" ) ).toBool();
 
 5365   mDefaultToAllFields = map.value( QStringLiteral( 
"default_to_all_fields" ) ).toBool();
 
 5375   QString def = definition;
 
 5377   if ( def.startsWith( QLatin1String( 
"numeric " ), Qt::CaseInsensitive ) )
 
 5382   else if ( def.startsWith( QLatin1String( 
"string " ), Qt::CaseInsensitive ) )
 
 5387   else if ( def.startsWith( QLatin1String( 
"datetime " ), Qt::CaseInsensitive ) )
 
 5393   if ( def.startsWith( QLatin1String( 
"multiple" ), Qt::CaseInsensitive ) )
 
 5396     def = def.mid( 8 ).trimmed();
 
 5399   if ( def.startsWith( QLatin1String( 
"default_to_all_fields" ), Qt::CaseInsensitive ) )
 
 5402     def = def.mid( 21 ).trimmed();
 
 5405   const QRegularExpression re( QStringLiteral( 
"(.*?)\\s+(.*)$" ) );
 
 5406   const QRegularExpressionMatch m = re.match( def );
 
 5409     parent = m.captured( 1 ).trimmed();
 
 5410     def = m.captured( 2 );
 
 5435   QVariant var = input;
 
 5436   if ( !var.isValid() )
 
 5463   if ( qobject_cast< QgsVectorLayer * >( qvariant_cast<QObject *>( input ) ) )
 
 5468   if ( var.type() != QVariant::String || var.toString().isEmpty() )
 
 5486   if ( !value.isValid() )
 
 5487     return QStringLiteral( 
"None" );
 
 5495     QString geometryCheckString;
 
 5499         geometryCheckString = QStringLiteral( 
"QgsFeatureRequest.GeometryNoCheck" );
 
 5503         geometryCheckString = QStringLiteral( 
"QgsFeatureRequest.GeometrySkipInvalid" );
 
 5507         geometryCheckString = QStringLiteral( 
"QgsFeatureRequest.GeometryAbortOnInvalid" );
 
 5513     if ( fromVar.
flags & QgsProcessingFeatureSourceDefinition::Flag::FlagOverrideDefaultGeometryCheck )
 
 5514       flags << QStringLiteral( 
"QgsProcessingFeatureSourceDefinition.FlagOverrideDefaultGeometryCheck" );
 
 5515     if ( fromVar.
flags & QgsProcessingFeatureSourceDefinition::Flag::FlagCreateIndividualOutputPerInputFeature )
 
 5516       flags << QStringLiteral( 
"QgsProcessingFeatureSourceDefinition.FlagCreateIndividualOutputPerInputFeature" );
 
 5517     if ( !
flags.empty() )
 
 5518       flagString = 
flags.join( QLatin1String( 
" | " ) );
 
 5525         layerString = layer->source();
 
 5532                flagString.isEmpty() ? QString() : ( QStringLiteral( 
", flags=%1" ).arg( flagString ) ),
 
 5533                geometryCheckString );
 
 5544         return QStringLiteral( 
"QgsProcessingFeatureSourceDefinition(QgsProperty.fromExpression(%1), selectedFeaturesOnly=%2, featureLimit=%3%4, geometryCheck=%5)" )
 
 5548                      flagString.isEmpty() ? QString() : ( QStringLiteral( 
", flags=%1" ).arg( flagString ) ),
 
 5549                      geometryCheckString );
 
 5557   else if ( 
QgsVectorLayer *layer = qobject_cast< QgsVectorLayer * >( qvariant_cast<QObject *>( value ) ) )
 
 5562   QString layerString = value.toString();
 
 5566     layerString = layer->providerType() != QLatin1String( 
"ogr" ) && layer->providerType() != QLatin1String( 
"gdal" ) && layer->providerType() != QLatin1String( 
"mdal" ) ? 
QgsProcessingUtils::encodeProviderKeyAndUri( layer->providerType(), layer->source() ) : layer->source();
 
 5573   QString code = QStringLiteral( 
"##%1=" ).arg( 
mName );
 
 5575     code += QLatin1String( 
"optional " );
 
 5576   code += QLatin1String( 
"source " );
 
 5583         code += QLatin1String( 
"point " );
 
 5587         code += QLatin1String( 
"line " );
 
 5591         code += QLatin1String( 
"polygon " );
 
 5598   return code.trimmed();
 
 5603   switch ( outputType )
 
 5607       QString code = QStringLiteral( 
"QgsProcessingParameterFeatureSource('%1', %2" )
 
 5610         code += QLatin1String( 
", optional=True" );
 
 5614         QStringList options;
 
 5618         code += QStringLiteral( 
", types=[%1]" ).arg( options.join( 
',' ) );
 
 5635   : mDataTypes( types )
 
 5648   map.insert( QStringLiteral( 
"data_types" ), types );
 
 5656   const QVariantList values = map.value( QStringLiteral( 
"data_types" ) ).toList();
 
 5657   for ( 
const QVariant &val : values )
 
 5667   QString def = definition;
 
 5670     if ( def.startsWith( QLatin1String( 
"point" ), Qt::CaseInsensitive ) )
 
 5676     else if ( def.startsWith( QLatin1String( 
"line" ), Qt::CaseInsensitive ) )
 
 5682     else if ( def.startsWith( QLatin1String( 
"polygon" ), Qt::CaseInsensitive ) )
 
 5697   , mSupportsAppend( supportsAppend )
 
 5708   QVariant var = input;
 
 5709   if ( !var.isValid() )
 
 5731   if ( var.type() != QVariant::String )
 
 5734   if ( var.toString().isEmpty() )
 
 5742   if ( !value.isValid() )
 
 5743     return QStringLiteral( 
"None" );
 
 5746     return QStringLiteral( 
"QgsProperty.fromExpression('%1')" ).arg( value.value< 
QgsProperty >().
asExpression() );
 
 5757       return QStringLiteral( 
"QgsProperty.fromExpression('%1')" ).arg( fromVar.
sink.
asExpression() );
 
 5766   QString code = QStringLiteral( 
"##%1=" ).arg( 
mName );
 
 5768     code += QLatin1String( 
"optional " );
 
 5769   code += QLatin1String( 
"sink " );
 
 5771   switch ( mDataType )
 
 5774       code += QLatin1String( 
"point " );
 
 5778       code += QLatin1String( 
"line " );
 
 5782       code += QLatin1String( 
"polygon " );
 
 5786       code += QLatin1String( 
"table " );
 
 5794   return code.trimmed();
 
 5806     return lOriginalProvider->defaultVectorFileExtension( 
hasGeometry() );
 
 5810     return p->defaultVectorFileExtension( 
hasGeometry() );
 
 5820       return QStringLiteral( 
"dbf" );
 
 5827   switch ( outputType )
 
 5831       QString code = QStringLiteral( 
"QgsProcessingParameterFeatureSink('%1', %2" )
 
 5834         code += QLatin1String( 
", optional=True" );
 
 5838       code += QStringLiteral( 
", createByDefault=%1" ).arg( 
createByDefault() ? QStringLiteral( 
"True" ) : QStringLiteral( 
"False" ) );
 
 5839       if ( mSupportsAppend )
 
 5840         code += QLatin1String( 
", supportsAppend=True" );
 
 5853   QStringList filters;
 
 5854   for ( 
const QString &ext : exts )
 
 5856     filters << QObject::tr( 
"%1 files (*.%2)" ).arg( ext.toUpper(), ext.toLower() );
 
 5858   return filters.join( QLatin1String( 
";;" ) ) + QStringLiteral( 
";;" ) + QObject::tr( 
"All files (*.*)" );
 
 5867       return lOriginalProvider->supportedOutputVectorLayerExtensions();
 
 5869       return lOriginalProvider->supportedOutputTableExtensions();
 
 5874       return p->supportedOutputVectorLayerExtensions();
 
 5876       return p->supportedOutputTableExtensions();
 
 5891   switch ( mDataType )
 
 5920   map.insert( QStringLiteral( 
"data_type" ), mDataType );
 
 5921   map.insert( QStringLiteral( 
"supports_append" ), mSupportsAppend );
 
 5929   mSupportsAppend = map.value( QStringLiteral( 
"supports_append" ), false ).toBool();
 
 5936     return QStringLiteral( 
"memory:%1" ).arg( 
description() );
 
 5944   QString def = definition;
 
 5945   if ( def.startsWith( QLatin1String( 
"point" ), Qt::CaseInsensitive ) )
 
 5950   else if ( def.startsWith( QLatin1String( 
"line" ), Qt::CaseInsensitive ) )
 
 5955   else if ( def.startsWith( QLatin1String( 
"polygon" ), Qt::CaseInsensitive ) )
 
 5960   else if ( def.startsWith( QLatin1String( 
"table" ), Qt::CaseInsensitive ) )
 
 5971   return mSupportsAppend;
 
 5991   QVariant var = input;
 
 5992   if ( !var.isValid() )
 
 6014   if ( var.type() != QVariant::String )
 
 6017   if ( var.toString().isEmpty() )
 
 6025   if ( !value.isValid() )
 
 6026     return QStringLiteral( 
"None" );
 
 6029     return QStringLiteral( 
"QgsProperty.fromExpression('%1')" ).arg( value.value< 
QgsProperty >().
asExpression() );
 
 6040       return QStringLiteral( 
"QgsProperty.fromExpression('%1')" ).arg( fromVar.
sink.
asExpression() );
 
 6056     return lOriginalProvider->defaultRasterFileExtension();
 
 6060     return p->defaultRasterFileExtension();
 
 6071   QStringList filters;
 
 6072   for ( 
const QString &ext : exts )
 
 6074     filters << QObject::tr( 
"%1 files (*.%2)" ).arg( ext.toUpper(), ext.toLower() );
 
 6076   return filters.join( QLatin1String( 
";;" ) ) + QStringLiteral( 
";;" ) + QObject::tr( 
"All files (*.*)" );
 
 6083     return lOriginalProvider->supportedOutputRasterLayerExtensions();
 
 6087     return p->supportedOutputRasterLayerExtensions();
 
 6103   , mFileFilter( fileFilter.isEmpty() ? QObject::tr( 
"All files (*.*)" ) : fileFilter )
 
 6115   QVariant var = input;
 
 6116   if ( !var.isValid() )
 
 6138   if ( var.type() != QVariant::String )
 
 6141   if ( var.toString().isEmpty() )
 
 6151   if ( !value.isValid() )
 
 6152     return QStringLiteral( 
"None" );
 
 6155     return QStringLiteral( 
"QgsProperty.fromExpression('%1')" ).arg( value.value< 
QgsProperty >().
asExpression() );
 
 6166       return QStringLiteral( 
"QgsProperty.fromExpression('%1')" ).arg( fromVar.
sink.
asExpression() );
 
 6175   if ( !mFileFilter.isEmpty() && mFileFilter.contains( QStringLiteral( 
"htm" ), Qt::CaseInsensitive ) )
 
 6187   if ( mFileFilter.isEmpty() || mFileFilter == QObject::tr( 
"All files (*.*)" ) )
 
 6188     return QStringLiteral( 
"file" );
 
 6191   const QRegularExpression rx( QStringLiteral( 
".*?\\(\\*\\.([a-zA-Z0-9._]+).*" ) );
 
 6192   const QRegularExpressionMatch match = rx.match( mFileFilter );
 
 6193   if ( !match.hasMatch() )
 
 6194     return QStringLiteral( 
"file" );
 
 6196   return match.captured( 1 );
 
 6201   switch ( outputType )
 
 6205       QString code = QStringLiteral( 
"QgsProcessingParameterFileDestination('%1', %2" )
 
 6208         code += QLatin1String( 
", optional=True" );
 
 6212       code += QStringLiteral( 
", createByDefault=%1" ).arg( 
createByDefault() ? QStringLiteral( 
"True" ) : QStringLiteral( 
"False" ) );
 
 6224   return ( 
fileFilter().isEmpty() ? QString() : 
fileFilter() + QStringLiteral( 
";;" ) ) + QObject::tr( 
"All files (*.*)" );
 
 6240   map.insert( QStringLiteral( 
"file_filter" ), mFileFilter );
 
 6247   mFileFilter = map.value( QStringLiteral( 
"file_filter" ) ).toString();
 
 6268   QVariant var = input;
 
 6269   if ( !var.isValid() )
 
 6285   if ( var.type() != QVariant::String )
 
 6288   if ( var.toString().isEmpty() )
 
 6311   , mCreateByDefault( createByDefault )
 
 6319   map.insert( QStringLiteral( 
"supports_non_file_outputs" ), mSupportsNonFileBasedOutputs );
 
 6320   map.insert( QStringLiteral( 
"create_by_default" ), mCreateByDefault );
 
 6327   mSupportsNonFileBasedOutputs = map.value( QStringLiteral( 
"supports_non_file_outputs" ) ).toBool();
 
 6328   mCreateByDefault = map.value( QStringLiteral( 
"create_by_default" ), QStringLiteral( 
"1" ) ).toBool();
 
 6334   switch ( outputType )
 
 6341         QString code = t->className() + QStringLiteral( 
"('%1', %2" )
 
 6344           code += QLatin1String( 
", optional=True" );
 
 6346         code += QStringLiteral( 
", createByDefault=%1" ).arg( mCreateByDefault ? QStringLiteral( 
"True" ) : QStringLiteral( 
"False" ) );
 
 6361   return QObject::tr( 
"Default extension" ) + QStringLiteral( 
" (*." ) + 
defaultFileExtension() + 
')';
 
 6368   const QRegularExpression rx( QStringLiteral( 
"[.]" ) );
 
 6369   QString sanitizedName = 
name();
 
 6370   sanitizedName.replace( rx, QStringLiteral( 
"_" ) );
 
 6385     return lOriginalProvider->isSupportedOutputValue( value, 
this, context, error );
 
 6394   return mCreateByDefault;
 
 6416   QVariant var = input;
 
 6417   if ( !var.isValid() )
 
 6439   if ( var.type() != QVariant::String )
 
 6442   if ( var.toString().isEmpty() )
 
 6450   if ( !value.isValid() )
 
 6451     return QStringLiteral( 
"None" );
 
 6454     return QStringLiteral( 
"QgsProperty.fromExpression('%1')" ).arg( value.value< 
QgsProperty >().
asExpression() );
 
 6465       return QStringLiteral( 
"QgsProperty.fromExpression('%1')" ).arg( fromVar.
sink.
asExpression() );
 
 6474   QString code = QStringLiteral( 
"##%1=" ).arg( 
mName );
 
 6476     code += QLatin1String( 
"optional " );
 
 6477   code += QLatin1String( 
"vectorDestination " );
 
 6479   switch ( mDataType )
 
 6482       code += QLatin1String( 
"point " );
 
 6486       code += QLatin1String( 
"line " );
 
 6490       code += QLatin1String( 
"polygon " );
 
 6498   return code.trimmed();
 
 6510     return lOriginalProvider->defaultVectorFileExtension( 
hasGeometry() );
 
 6514     return p->defaultVectorFileExtension( 
hasGeometry() );
 
 6524       return QStringLiteral( 
"dbf" );
 
 6531   switch ( outputType )
 
 6535       QString code = QStringLiteral( 
"QgsProcessingParameterVectorDestination('%1', %2" )
 
 6538         code += QLatin1String( 
", optional=True" );
 
 6542       code += QStringLiteral( 
", createByDefault=%1" ).arg( 
createByDefault() ? QStringLiteral( 
"True" ) : QStringLiteral( 
"False" ) );
 
 6555   QStringList filters;
 
 6556   for ( 
const QString &ext : exts )
 
 6558     filters << QObject::tr( 
"%1 files (*.%2)" ).arg( ext.toUpper(), ext.toLower() );
 
 6560   return filters.join( QLatin1String( 
";;" ) ) + QStringLiteral( 
";;" ) + QObject::tr( 
"All files (*.*)" );
 
 6568       return lOriginalProvider->supportedOutputVectorLayerExtensions();
 
 6570       return lOriginalProvider->supportedOutputTableExtensions();
 
 6575       return p->supportedOutputVectorLayerExtensions();
 
 6577       return p->supportedOutputTableExtensions();
 
 6592   switch ( mDataType )
 
 6621   map.insert( QStringLiteral( 
"data_type" ), mDataType );
 
 6635   QString def = definition;
 
 6636   if ( def.startsWith( QLatin1String( 
"point" ), Qt::CaseInsensitive ) )
 
 6641   else if ( def.startsWith( QLatin1String( 
"line" ), Qt::CaseInsensitive ) )
 
 6646   else if ( def.startsWith( QLatin1String( 
"polygon" ), Qt::CaseInsensitive ) )
 
 6657   , mParentLayerParameterName( parentLayerParameterName )
 
 6658   , mAllowMultiple( allowMultiple )
 
 6670   if ( !input.isValid() )
 
 6678   if ( input.type() == QVariant::List || input.type() == QVariant::StringList )
 
 6680     if ( !mAllowMultiple )
 
 6689     const double res = input.toInt( &ok );
 
 6699   return mAllowMultiple;
 
 6709   if ( !value.isValid() )
 
 6710     return QStringLiteral( 
"None" );
 
 6713     return QStringLiteral( 
"QgsProperty.fromExpression('%1')" ).arg( value.value< 
QgsProperty >().
asExpression() );
 
 6715   if ( value.type() == QVariant::List )
 
 6718     const QVariantList values = value.toList();
 
 6719     for ( 
auto it = values.constBegin(); it != values.constEnd(); ++it )
 
 6721       parts << QString::number( static_cast< int >( it->toDouble() ) );
 
 6723     return parts.join( 
',' ).prepend( 
'[' ).append( 
']' );
 
 6725   else if ( value.type() == QVariant::StringList )
 
 6728     const QStringList values = value.toStringList();
 
 6729     for ( 
auto it = values.constBegin(); it != values.constEnd(); ++it )
 
 6731       parts << QString::number( static_cast< int >( it->toDouble() ) );
 
 6733     return parts.join( 
',' ).prepend( 
'[' ).append( 
']' );
 
 6736   return value.toString();
 
 6741   QString code = QStringLiteral( 
"##%1=" ).arg( 
mName );
 
 6743     code += QLatin1String( 
"optional " );
 
 6744   code += QLatin1String( 
"band " );
 
 6746   if ( mAllowMultiple )
 
 6747     code += QLatin1String( 
"multiple " );
 
 6749   code += mParentLayerParameterName + 
' ';
 
 6752   return code.trimmed();
 
 6757   QStringList depends;
 
 6758   if ( !mParentLayerParameterName.isEmpty() )
 
 6759     depends << mParentLayerParameterName;
 
 6765   switch ( outputType )
 
 6769       QString code = QStringLiteral( 
"QgsProcessingParameterBand('%1', %2" )
 
 6772         code += QLatin1String( 
", optional=True" );
 
 6774       code += QStringLiteral( 
", parentLayerParameterName='%1'" ).arg( mParentLayerParameterName );
 
 6775       code += QStringLiteral( 
", allowMultiple=%1" ).arg( mAllowMultiple ? QStringLiteral( 
"True" ) : QStringLiteral( 
"False" ) );
 
 6787   return mParentLayerParameterName;
 
 6798   map.insert( QStringLiteral( 
"parent_layer" ), mParentLayerParameterName );
 
 6799   map.insert( QStringLiteral( 
"allow_multiple" ), mAllowMultiple );
 
 6806   mParentLayerParameterName = map.value( QStringLiteral( 
"parent_layer" ) ).toString();
 
 6807   mAllowMultiple = map.value( QStringLiteral( 
"allow_multiple" ) ).toBool();
 
 6814   QString def = definition;
 
 6817   if ( def.startsWith( QLatin1String( 
"multiple" ), Qt::CaseInsensitive ) )
 
 6820     def = def.mid( 8 ).trimmed();
 
 6823   const QRegularExpression re( QStringLiteral( 
"(.*?)\\s+(.*)$" ) );
 
 6824   const QRegularExpressionMatch m = re.match( def );
 
 6827     parent = m.captured( 1 ).trimmed();
 
 6828     def = m.captured( 2 );
 
 6845   , mParentParameterName( parentParameterName )
 
 6862   QStringList depends;
 
 6863   if ( !mParentParameterName.isEmpty() )
 
 6864     depends << mParentParameterName;
 
 6870   switch ( outputType )
 
 6874       QString code = QStringLiteral( 
"QgsProcessingParameterDistance('%1', %2" )
 
 6877         code += QLatin1String( 
", optional=True" );
 
 6879       code += QStringLiteral( 
", parentParameterName='%1'" ).arg( mParentParameterName );
 
 6881       if ( 
minimum() != std::numeric_limits<double>::lowest() + 1 )
 
 6882         code += QStringLiteral( 
", minValue=%1" ).arg( 
minimum() );
 
 6883       if ( 
maximum() != std::numeric_limits<double>::max() )
 
 6884         code += QStringLiteral( 
", maxValue=%1" ).arg( 
maximum() );
 
 6895   return mParentParameterName;
 
 6906   map.insert( QStringLiteral( 
"parent" ), mParentParameterName );
 
 6907   map.insert( QStringLiteral( 
"default_unit" ), 
static_cast< int >( mDefaultUnit ) );
 
 6914   mParentParameterName = map.value( QStringLiteral( 
"parent" ) ).toString();
 
 6941   switch ( outputType )
 
 6945       QString code = QStringLiteral( 
"QgsProcessingParameterDuration('%1', %2" )
 
 6948         code += QLatin1String( 
", optional=True" );
 
 6950       if ( 
minimum() != std::numeric_limits<double>::lowest() + 1 )
 
 6951         code += QStringLiteral( 
", minValue=%1" ).arg( 
minimum() );
 
 6952       if ( 
maximum() != std::numeric_limits<double>::max() )
 
 6953         code += QStringLiteral( 
", maxValue=%1" ).arg( 
maximum() );
 
 6965   map.insert( QStringLiteral( 
"default_unit" ), 
static_cast< int >( mDefaultUnit ) );
 
 6999   switch ( outputType )
 
 7003       QString code = QStringLiteral( 
"QgsProcessingParameterScale('%1', %2" )
 
 7006         code += QLatin1String( 
", optional=True" );
 
 7018                                           : ( definition.toLower().trimmed() == QLatin1String( 
"none" ) ? QVariant() : definition ), isOptional );
 
 7037   if ( !value.isValid() || value.isNull() )
 
 7038     return QStringLiteral( 
"None" );
 
 7041     return QStringLiteral( 
"QgsProperty.fromExpression('%1')" ).arg( value.value< 
QgsProperty >().
asExpression() );
 
 7043   const QString s = value.toString();
 
 7049   QString code = QStringLiteral( 
"##%1=" ).arg( 
mName );
 
 7051     code += QLatin1String( 
"optional " );
 
 7052   code += QLatin1String( 
"layout " );
 
 7055   return code.trimmed();
 
 7060   switch ( outputType )
 
 7064       QString code = QStringLiteral( 
"QgsProcessingParameterLayout('%1', %2" )
 
 7067         code += QLatin1String( 
", optional=True" );
 
 7078   QString def = definition;
 
 7080   if ( def.startsWith( 
'"' ) || def.startsWith( 
'\'' ) )
 
 7082   if ( def.endsWith( 
'"' ) || def.endsWith( 
'\'' ) )
 
 7086   if ( def == QLatin1String( 
"None" ) )
 
 7099   , mParentLayoutParameterName( parentLayoutParameterName )
 
 7100   , mItemType( itemType )
 
 7112   if ( !value.isValid() || value.isNull() )
 
 7113     return QStringLiteral( 
"None" );
 
 7116     return QStringLiteral( 
"QgsProperty.fromExpression('%1')" ).arg( value.value< 
QgsProperty >().
asExpression() );
 
 7118   const QString s = value.toString();
 
 7124   QString code = QStringLiteral( 
"##%1=" ).arg( 
mName );
 
 7126     code += QLatin1String( 
"optional " );
 
 7127   code += QLatin1String( 
"layoutitem " );
 
 7128   if ( mItemType >= 0 )
 
 7129     code += QString::number( mItemType ) + 
' ';
 
 7131   code += mParentLayoutParameterName + 
' ';
 
 7134   return code.trimmed();
 
 7139   switch ( outputType )
 
 7143       QString code = QStringLiteral( 
"QgsProcessingParameterLayoutItem('%1', %2" )
 
 7146         code += QLatin1String( 
", optional=True" );
 
 7148       if ( mItemType >= 0 )
 
 7149         code += QStringLiteral( 
", itemType=%1" ).arg( mItemType );
 
 7151       code += QStringLiteral( 
", parentLayoutParameterName='%1'" ).arg( mParentLayoutParameterName );
 
 7164   map.insert( QStringLiteral( 
"parent_layout" ), mParentLayoutParameterName );
 
 7165   map.insert( QStringLiteral( 
"item_type" ), mItemType );
 
 7172   mParentLayoutParameterName = map.value( QStringLiteral( 
"parent_layout" ) ).toString();
 
 7173   mItemType = map.value( QStringLiteral( 
"item_type" ) ).toInt();
 
 7179   QStringList depends;
 
 7180   if ( !mParentLayoutParameterName.isEmpty() )
 
 7181     depends << mParentLayoutParameterName;
 
 7188   QString def = definition;
 
 7190   const QRegularExpression re( QStringLiteral( 
"(\\d+)?\\s*(.*?)\\s+(.*)$" ) );
 
 7191   const QRegularExpressionMatch m = re.match( def );
 
 7194     itemType = m.captured( 1 ).trimmed().isEmpty() ? -1 : m.captured( 1 ).trimmed().toInt();
 
 7195     parent = m.captured( 2 ).trimmed().isEmpty() ? m.captured( 3 ).trimmed() : m.captured( 2 ).trimmed();
 
 7196     def = !m.captured( 2 ).trimmed().isEmpty() ? m.captured( 3 ) : QString();
 
 7209   return mParentLayoutParameterName;
 
 7214   mParentLayoutParameterName = 
name;
 
 7233   , mAllowOpacity( opacityEnabled )
 
 7245   if ( !value.isValid() || value.isNull() )
 
 7246     return QStringLiteral( 
"None" );
 
 7249     return QStringLiteral( 
"QgsProperty.fromExpression('%1')" ).arg( value.value< 
QgsProperty >().
asExpression() );
 
 7251   if ( value.canConvert< QColor >() && !value.value< QColor >().isValid() )
 
 7252     return QStringLiteral( 
"QColor()" );
 
 7254   if ( value.canConvert< QColor >() )
 
 7256     const QColor 
c = value.value< QColor >();
 
 7257     if ( !mAllowOpacity || 
c.alpha() == 255 )
 
 7258       return QStringLiteral( 
"QColor(%1, %2, %3)" ).arg( 
c.red() ).arg( 
c.green() ).arg( 
c.blue() );
 
 7260       return QStringLiteral( 
"QColor(%1, %2, %3, %4)" ).arg( 
c.red() ).arg( 
c.green() ).arg( 
c.blue() ).arg( 
c.alpha() );
 
 7263   const QString s = value.toString();
 
 7269   QString code = QStringLiteral( 
"##%1=" ).arg( 
mName );
 
 7271     code += QLatin1String( 
"optional " );
 
 7272   code += QLatin1String( 
"color " );
 
 7274   if ( mAllowOpacity )
 
 7275     code += QLatin1String( 
"withopacity " );
 
 7278   return code.trimmed();
 
 7283   switch ( outputType )
 
 7287       QString code = QStringLiteral( 
"QgsProcessingParameterColor('%1', %2" )
 
 7290         code += QLatin1String( 
", optional=True" );
 
 7292       code += QStringLiteral( 
", opacityEnabled=%1" ).arg( mAllowOpacity ? QStringLiteral( 
"True" ) : QStringLiteral( 
"False" ) );
 
 7304   if ( !input.isValid() && ( 
mDefault.isValid() && ( !
mDefault.toString().isEmpty() || 
mDefault.value< QColor >().isValid() ) ) )
 
 7307   if ( !input.isValid() )
 
 7310   if ( input.type() == QVariant::Color )
 
 7319   if ( input.type() != QVariant::String || input.toString().isEmpty() )
 
 7322   bool containsAlpha = 
false;
 
 7329   map.insert( QStringLiteral( 
"opacityEnabled" ), mAllowOpacity );
 
 7336   mAllowOpacity = map.value( QStringLiteral( 
"opacityEnabled" ) ).toBool();
 
 7342   return mAllowOpacity;
 
 7347   mAllowOpacity = enabled;
 
 7352   QString def = definition;
 
 7354   bool allowOpacity = 
false;
 
 7355   if ( def.startsWith( QLatin1String( 
"withopacity" ), Qt::CaseInsensitive ) )
 
 7357     allowOpacity = 
true;
 
 7358     def = def.mid( 12 );
 
 7361   if ( def.startsWith( 
'"' ) || def.startsWith( 
'\'' ) )
 
 7363   if ( def.endsWith( 
'"' ) || def.endsWith( 
'\'' ) )
 
 7367   if ( def == QLatin1String( 
"None" ) )
 
 7378   , mSourceParameterName( sourceCrsParameterName )
 
 7379   , mDestParameterName( destinationCrsParameterName )
 
 7380   , mSourceCrs( staticSourceCrs )
 
 7381   , mDestCrs( staticDestinationCrs )
 
 7393   if ( !value.isValid() || value.isNull() )
 
 7394     return QStringLiteral( 
"None" );
 
 7399       return QStringLiteral( 
"QgsCoordinateReferenceSystem()" );
 
 7405     return QStringLiteral( 
"QgsProperty.fromExpression('%1')" ).arg( value.value< 
QgsProperty >().
asExpression() );
 
 7408   p.insert( 
name(), value );
 
 7413   const QString s = value.toString();
 
 7419   QString code = QStringLiteral( 
"##%1=" ).arg( 
mName );
 
 7421     code += QLatin1String( 
"optional " );
 
 7422   code += QLatin1String( 
"coordinateoperation " );
 
 7425   return code.trimmed();
 
 7430   switch ( outputType )
 
 7435       QString code = QStringLiteral( 
"QgsProcessingParameterCoordinateOperation('%1', %2" )
 
 7438         code += QLatin1String( 
", optional=True" );
 
 7439       if ( !mSourceParameterName.isEmpty() )
 
 7440         code += QStringLiteral( 
", sourceCrsParameterName=%1" ).arg( 
valueAsPythonString( mSourceParameterName, 
c ) );
 
 7441       if ( !mDestParameterName.isEmpty() )
 
 7442         code += QStringLiteral( 
", destinationCrsParameterName=%1" ).arg( 
valueAsPythonString( mDestParameterName, 
c ) );
 
 7444       if ( mSourceCrs.isValid() )
 
 7446       if ( mDestCrs.isValid() )
 
 7447         code += QStringLiteral( 
", staticDestinationCrs=%1" ).arg( 
valueAsPythonString( mDestCrs, 
c ) );
 
 7459   if ( !mSourceParameterName.isEmpty() )
 
 7460     res << mSourceParameterName;
 
 7461   if ( !mDestParameterName.isEmpty() )
 
 7462     res << mDestParameterName;
 
 7469   map.insert( QStringLiteral( 
"source_crs_parameter_name" ), mSourceParameterName );
 
 7470   map.insert( QStringLiteral( 
"dest_crs_parameter_name" ), mDestParameterName );
 
 7471   map.insert( QStringLiteral( 
"static_source_crs" ), mSourceCrs );
 
 7472   map.insert( QStringLiteral( 
"static_dest_crs" ), mDestCrs );
 
 7479   mSourceParameterName = map.value( QStringLiteral( 
"source_crs_parameter_name" ) ).toString();
 
 7480   mDestParameterName = map.value( QStringLiteral( 
"dest_crs_parameter_name" ) ).toString();
 
 7481   mSourceCrs = map.value( QStringLiteral( 
"static_source_crs" ) );
 
 7482   mDestCrs = map.value( QStringLiteral( 
"static_dest_crs" ) );
 
 7488   QString def = definition;
 
 7490   if ( def.startsWith( 
'"' ) || def.startsWith( 
'\'' ) )
 
 7492   if ( def.endsWith( 
'"' ) || def.endsWith( 
'\'' ) )
 
 7496   if ( def == QLatin1String( 
"None" ) )
 
 7521   if ( !input.isValid() && !
mDefault.isValid() )
 
 7524   if ( ( input.type() == QVariant::String && input.toString().isEmpty() )
 
 7525        || ( !input.isValid() && 
mDefault.type() == QVariant::String && 
mDefault.toString().isEmpty() ) )
 
 7533   if ( !value.isValid() )
 
 7534     return QStringLiteral( 
"None" );
 
 7537     return QStringLiteral( 
"QgsProperty.fromExpression('%1')" ).arg( value.value< 
QgsProperty >().
asExpression() );
 
 7544   QString code = QStringLiteral( 
"##%1=" ).arg( 
mName );
 
 7546     code += QLatin1String( 
"optional " );
 
 7547   code += QLatin1String( 
"maptheme " );
 
 7550   return code.trimmed();
 
 7555   switch ( outputType )
 
 7559       QString code = QStringLiteral( 
"QgsProcessingParameterMapTheme('%1', %2" )
 
 7562         code += QLatin1String( 
", optional=True" );
 
 7587   const QString parent;
 
 7589   QString def = definition;
 
 7590   if ( def.startsWith( 
'"' ) || def.startsWith( 
'\'' ) )
 
 7592   if ( def.endsWith( 
'"' ) || def.endsWith( 
'\'' ) )
 
 7614   if ( mMin.isValid() && mMax.isValid() && mMin >= mMax )
 
 7616     QgsMessageLog::logMessage( QObject::tr( 
"Invalid datetime parameter \"%1\": min value %2 is >= max value %3!" ).arg( 
name, mMin.toString(), mMax.toString() ), QObject::tr( 
"Processing" ) );
 
 7627   QVariant input = value;
 
 7628   if ( !input.isValid() )
 
 7641   if ( input.type() != QVariant::DateTime && input.type() != QVariant::Date && input.type() != QVariant::Time && input.type() != QVariant::String )
 
 7644   if ( ( input.type() == QVariant::DateTime || input.type() == QVariant::Date ) && mDataType == 
Time )
 
 7647   if ( input.type() == QVariant::String )
 
 7649     const QString s = input.toString();
 
 7653     input = QDateTime::fromString( s, Qt::ISODate );
 
 7654     if ( mDataType == 
Time )
 
 7656       if ( !input.toDateTime().isValid() )
 
 7657         input = QTime::fromString( s );
 
 7659         input = input.toDateTime().time();
 
 7663   if ( mDataType != 
Time )
 
 7665     const QDateTime res = input.toDateTime();
 
 7666     return res.isValid() && ( res >= mMin || !mMin.isValid() ) && ( res <= mMax || !mMax.isValid() );
 
 7670     const QTime res = input.toTime();
 
 7671     return res.isValid() && ( res >= mMin.time() || !mMin.isValid() ) && ( res <= mMax.time() || !mMax.isValid() );
 
 7677   if ( !value.isValid() )
 
 7678     return QStringLiteral( 
"None" );
 
 7681     return QStringLiteral( 
"QgsProperty.fromExpression('%1')" ).arg( value.value< 
QgsProperty >().
asExpression() );
 
 7683   if ( value.type() == QVariant::DateTime )
 
 7685     const QDateTime dt = value.toDateTime();
 
 7686     if ( !dt.isValid() )
 
 7687       return QStringLiteral( 
"QDateTime()" );
 
 7689       return QStringLiteral( 
"QDateTime(QDate(%1, %2, %3), QTime(%4, %5, %6))" ).arg( dt.date().year() )
 
 7690              .arg( dt.date().month() )
 
 7691              .arg( dt.date().day() )
 
 7692              .arg( dt.time().hour() )
 
 7693              .arg( dt.time().minute() )
 
 7694              .arg( dt.time().second() );
 
 7696   else if ( value.type() == QVariant::Date )
 
 7698     const QDate dt = value.toDate();
 
 7699     if ( !dt.isValid() )
 
 7700       return QStringLiteral( 
"QDate()" );
 
 7702       return QStringLiteral( 
"QDate(%1, %2, %3)" ).arg( dt.year() )
 
 7706   else if ( value.type() == QVariant::Time )
 
 7708     const QTime dt = value.toTime();
 
 7709     if ( !dt.isValid() )
 
 7710       return QStringLiteral( 
"QTime()" );
 
 7712       return QStringLiteral( 
"QTime(%4, %5, %6)" )
 
 7715              .arg( dt.second() );
 
 7717   return value.toString();
 
 7724   if ( mMin.isValid() )
 
 7725     parts << QObject::tr( 
"Minimum value: %1" ).arg( mMin.toString( Qt::ISODate ) );
 
 7726   if ( mMax.isValid() )
 
 7727     parts << QObject::tr( 
"Maximum value: %1" ).arg( mMax.toString( Qt::ISODate ) );
 
 7729     parts << QObject::tr( 
"Default value: %1" ).arg( mDataType == 
DateTime ? 
mDefault.toDateTime().toString( Qt::ISODate ) :
 
 7730           ( mDataType == 
Date ? 
mDefault.toDate().toString( Qt::ISODate ) : 
mDefault.toTime( ).toString() ) );
 
 7731   const QString extra = parts.join( QLatin1String( 
"<br />" ) );
 
 7732   if ( !extra.isEmpty() )
 
 7733     text += QStringLiteral( 
"<p>%1</p>" ).arg( extra );
 
 7739   switch ( outputType )
 
 7743       QString code = QStringLiteral( 
"QgsProcessingParameterDateTime('%1', %2" )
 
 7746         code += QLatin1String( 
", optional=True" );
 
 7748       code += QStringLiteral( 
", type=%1" ).arg( mDataType == 
DateTime ? QStringLiteral( 
"QgsProcessingParameterDateTime.DateTime" )
 
 7749               : mDataType == 
Date ? QStringLiteral( 
"QgsProcessingParameterDateTime.Date" )
 
 7750               : QStringLiteral( 
"QgsProcessingParameterDateTime.Time" ) );
 
 7753       if ( mMin.isValid() )
 
 7755       if ( mMax.isValid() )
 
 7797   map.insert( QStringLiteral( 
"min" ), mMin );
 
 7798   map.insert( QStringLiteral( 
"max" ), mMax );
 
 7799   map.insert( QStringLiteral( 
"data_type" ), mDataType );
 
 7806   mMin = map.value( QStringLiteral( 
"min" ) ).toDateTime();
 
 7807   mMax = map.value( QStringLiteral( 
"max" ) ).toDateTime();
 
 7808   mDataType = 
static_cast< Type >( map.value( QStringLiteral( 
"data_type" ) ).toInt() );
 
 7815          : ( definition.toLower().trimmed() == QLatin1String( 
"none" ) ? QVariant() : definition ), isOptional );
 
 7826   , mProviderId( provider )
 
 7839   if ( !input.isValid() && !
mDefault.isValid() )
 
 7842   if ( ( input.type() == QVariant::String && input.toString().isEmpty() )
 
 7843        || ( !input.isValid() && 
mDefault.type() == QVariant::String && 
mDefault.toString().isEmpty() ) )
 
 7851   if ( !value.isValid() )
 
 7852     return QStringLiteral( 
"None" );
 
 7855     return QStringLiteral( 
"QgsProperty.fromExpression('%1')" ).arg( value.value< 
QgsProperty >().
asExpression() );
 
 7862   QString code = QStringLiteral( 
"##%1=" ).arg( 
mName );
 
 7864     code += QLatin1String( 
"optional " );
 
 7865   code += QLatin1String( 
"providerconnection " );
 
 7866   code += mProviderId + 
' ';
 
 7869   return code.trimmed();
 
 7874   switch ( outputType )
 
 7878       QString code = QStringLiteral( 
"QgsProcessingParameterProviderConnection('%1', %2, '%3'" )
 
 7881         code += QLatin1String( 
", optional=True" );
 
 7895   map.insert( QStringLiteral( 
"provider" ), mProviderId );
 
 7902   mProviderId = map.value( QStringLiteral( 
"provider" ) ).toString();
 
 7908   const QString parent;
 
 7910   QString def = definition;
 
 7912   if ( def.contains( 
' ' ) )
 
 7914     provider = def.left( def.indexOf( 
' ' ) );
 
 7915     def = def.mid( def.indexOf( 
' ' ) + 1 );
 
 7923   if ( def.startsWith( 
'"' ) || def.startsWith( 
'\'' ) )
 
 7925   if ( def.endsWith( 
'"' ) || def.endsWith( 
'\'' ) )
 
 7943   , mParentConnectionParameterName( parentLayerParameterName )
 
 7956   if ( !input.isValid() && !
mDefault.isValid() )
 
 7959   if ( ( input.type() == QVariant::String && input.toString().isEmpty() )
 
 7960        || ( !input.isValid() && 
mDefault.type() == QVariant::String && 
mDefault.toString().isEmpty() ) )
 
 7968   if ( !value.isValid() )
 
 7969     return QStringLiteral( 
"None" );
 
 7972     return QStringLiteral( 
"QgsProperty.fromExpression('%1')" ).arg( value.value< 
QgsProperty >().
asExpression() );
 
 7979   QString code = QStringLiteral( 
"##%1=" ).arg( 
mName );
 
 7981     code += QLatin1String( 
"optional " );
 
 7982   code += QLatin1String( 
"databaseschema " );
 
 7984   code += mParentConnectionParameterName + 
' ';
 
 7987   return code.trimmed();
 
 7992   switch ( outputType )
 
 7996       QString code = QStringLiteral( 
"QgsProcessingParameterDatabaseSchema('%1', %2" )
 
 7999         code += QLatin1String( 
", optional=True" );
 
 8001       code += QStringLiteral( 
", connectionParameterName='%1'" ).arg( mParentConnectionParameterName );
 
 8015   QStringList depends;
 
 8016   if ( !mParentConnectionParameterName.isEmpty() )
 
 8017     depends << mParentConnectionParameterName;
 
 8023   return mParentConnectionParameterName;
 
 8028   mParentConnectionParameterName = 
name;
 
 8034   map.insert( QStringLiteral( 
"mParentConnectionParameterName" ), mParentConnectionParameterName );
 
 8041   mParentConnectionParameterName = map.value( QStringLiteral( 
"mParentConnectionParameterName" ) ).toString();
 
 8048   QString def = definition;
 
 8050   const QRegularExpression re( QStringLiteral( 
"(.*?)\\s+(.*)$" ) );
 
 8051   const QRegularExpressionMatch m = re.match( def );
 
 8054     parent = m.captured( 1 ).trimmed();
 
 8055     def = m.captured( 2 );
 
 8071     const QString &connectionParameterName,
 
 8072     const QString &schemaParameterName,
 
 8073     const QVariant &defaultValue, 
bool optional, 
bool allowNewTableNames )
 
 8075   , mParentConnectionParameterName( connectionParameterName )
 
 8076   , mParentSchemaParameterName( schemaParameterName )
 
 8077   , mAllowNewTableNames( allowNewTableNames )
 
 8090   if ( !input.isValid() && !
mDefault.isValid() )
 
 8093   if ( ( input.type() == QVariant::String && input.toString().isEmpty() )
 
 8094        || ( !input.isValid() && 
mDefault.type() == QVariant::String && 
mDefault.toString().isEmpty() ) )
 
 8102   if ( !value.isValid() )
 
 8103     return QStringLiteral( 
"None" );
 
 8106     return QStringLiteral( 
"QgsProperty.fromExpression('%1')" ).arg( value.value< 
QgsProperty >().
asExpression() );
 
 8113   QString code = QStringLiteral( 
"##%1=" ).arg( 
mName );
 
 8115     code += QLatin1String( 
"optional " );
 
 8116   code += QLatin1String( 
"databasetable " );
 
 8118   code += ( mParentConnectionParameterName.isEmpty() ? QStringLiteral( 
"none" ) : mParentConnectionParameterName ) + 
' ';
 
 8119   code += ( mParentSchemaParameterName.isEmpty() ? QStringLiteral( 
"none" ) : mParentSchemaParameterName ) + 
' ';
 
 8122   return code.trimmed();
 
 8127   switch ( outputType )
 
 8131       QString code = QStringLiteral( 
"QgsProcessingParameterDatabaseTable('%1', %2" )
 
 8134         code += QLatin1String( 
", optional=True" );
 
 8136       if ( mAllowNewTableNames )
 
 8137         code += QLatin1String( 
", allowNewTableNames=True" );
 
 8139       code += QStringLiteral( 
", connectionParameterName='%1'" ).arg( mParentConnectionParameterName );
 
 8140       code += QStringLiteral( 
", schemaParameterName='%1'" ).arg( mParentSchemaParameterName );
 
 8154   QStringList depends;
 
 8155   if ( !mParentConnectionParameterName.isEmpty() )
 
 8156     depends << mParentConnectionParameterName;
 
 8157   if ( !mParentSchemaParameterName.isEmpty() )
 
 8158     depends << mParentSchemaParameterName;
 
 8164   return mParentConnectionParameterName;
 
 8169   mParentConnectionParameterName = 
name;
 
 8174   return mParentSchemaParameterName;
 
 8179   mParentSchemaParameterName = 
name;
 
 8185   map.insert( QStringLiteral( 
"mParentConnectionParameterName" ), mParentConnectionParameterName );
 
 8186   map.insert( QStringLiteral( 
"mParentSchemaParameterName" ), mParentSchemaParameterName );
 
 8187   map.insert( QStringLiteral( 
"mAllowNewTableNames" ), mAllowNewTableNames );
 
 8194   mParentConnectionParameterName = map.value( QStringLiteral( 
"mParentConnectionParameterName" ) ).toString();
 
 8195   mParentSchemaParameterName = map.value( QStringLiteral( 
"mParentSchemaParameterName" ) ).toString();
 
 8196   mAllowNewTableNames = map.value( QStringLiteral( 
"mAllowNewTableNames" ), 
false ).toBool();
 
 8204   QString def = definition;
 
 8206   const QRegularExpression re( QStringLiteral( 
"(.*?)\\s+(.*+)\\b\\s*(.*)$" ) );
 
 8207   const QRegularExpressionMatch m = re.match( def );
 
 8210     connection = m.captured( 1 ).trimmed();
 
 8211     if ( connection == QLatin1String( 
"none" ) )
 
 8213     schema = m.captured( 2 ).trimmed();
 
 8214     if ( schema == QLatin1String( 
"none" ) )
 
 8216     def = m.captured( 3 );
 
 8224   return mAllowNewTableNames;
 
 8237     const QVariant &defaultValue, 
bool optional )
 
 8267   if ( qobject_cast< QgsPointCloudLayer * >( qvariant_cast<QObject *>( var ) ) )
 
 8270   if ( var.type() != QVariant::String || var.toString().isEmpty() )
 
 8288   if ( !val.isValid() )
 
 8289     return QStringLiteral( 
"None" );
 
 8295   p.insert( 
name(), val );
 
 8316     const QVariant &defaultValue, 
bool optional )
 
 8346   if ( qobject_cast< QgsAnnotationLayer * >( qvariant_cast<QObject *>( var ) ) )
 
 8349   if ( var.type() != QVariant::String || var.toString().isEmpty() )
 
 8367   if ( !val.isValid() )
 
 8368     return QStringLiteral( 
"None" );
 
 8374   p.insert( 
name(), val );
 
Represents a map layer containing a set of georeferenced annotations, e.g.
static QgsProcessingRegistry * processingRegistry()
Returns the application's processing registry, used for managing processing providers,...
static QgsApplication * instance()
Returns the singleton instance of the QgsApplication.
This class represents a coordinate reference system (CRS).
bool isValid() const
Returns whether this CRS is correctly initialized and usable.
QString authid() const
Returns the authority identifier for the CRS.
@ WKT_PREFERRED
Preferred format, matching the most recent WKT ISO standard. Currently an alias to WKT2_2019,...
QString toWkt(WktVariant variant=WKT1_GDAL, bool multiline=false, int indentationWidth=4) const
Returns a WKT representation of this CRS.
Custom exception class for Coordinate Reference System related exceptions.
Class for parsing and evaluation of expressions (formerly called "search strings").
bool isValid() const
Checks if this expression is valid.
InvalidGeometryCheck
Handling of features with invalid geometries.
@ GeometryNoCheck
No invalid geometry checking.
@ GeometryAbortOnInvalid
Close iterator on encountering any features with invalid geometry. This requires a slow geometry vali...
@ GeometrySkipInvalid
Skip any features with invalid geometry. This requires a slow geometry validity check for every featu...
An interface for objects which accept features via addFeature(s) methods.
Container of fields for a vector layer.
static bool fileMatchesFilter(const QString &fileName, const QString &filter)
Returns true if the given fileName matches a file filter string.
A geometry is the spatial representation of a feature.
QgsGeometry densifyByCount(int extraNodesPerSegment) const
Returns a copy of the geometry which has been densified by adding the specified number of extra nodes...
Qgis::GeometryOperationResult transform(const QgsCoordinateTransform &ct, Qgis::TransformDirection direction=Qgis::TransformDirection::Forward, bool transformZ=false) SIP_THROW(QgsCsException)
Transforms this geometry as described by the coordinate transform ct.
static QgsGeometry fromRect(const QgsRectangle &rect) SIP_HOLDGIL
Creates a new geometry from a QgsRectangle.
bool isMultipart() const SIP_HOLDGIL
Returns true if WKB of the geometry is of WKBMulti* type.
static QgsGeometry fromWkt(const QString &wkt)
Creates a new geometry from a WKT string.
QgsPointXY asPoint() const
Returns the contents of the geometry as a 2-dimensional point.
static QgsGeometry fromPointXY(const QgsPointXY &point) SIP_HOLDGIL
Creates a new geometry from a QgsPointXY object.
QgsWkbTypes::GeometryType type
QgsGeometry centroid() const
Returns the center of mass of a geometry.
QString lastError() const SIP_HOLDGIL
Returns an error string referring to the last error encountered either when this geometry was created...
QgsRectangle boundingBox() const
Returns the bounding box of the geometry.
QString asWkt(int precision=17) const
Exports the geometry to WKT.
Base class for graphical items within a QgsLayout.
QgsMasterLayoutInterface * layoutByName(const QString &name) const
Returns the layout with a matching name, or nullptr if no matching layouts were found.
QgsLayoutItem * itemById(const QString &id) const
Returns a layout item given its id.
QgsLayoutItem * itemByUuid(const QString &uuid, bool includeTemplateUuids=false) const
Returns the layout item with matching uuid unique identifier, or nullptr if a matching item could not...
Base class for all map layer types.
virtual QgsRectangle extent() const
Returns the extent of the layer.
QString source() const
Returns the source for the layer.
QgsCoordinateReferenceSystem crs
QString id() const
Returns the layer's unique ID, which is used to access this layer from QgsProject.
Interface for master layout type objects, such as print layouts and reports.
virtual QgsMasterLayoutInterface::Type layoutType() const =0
Returns the master layout type.
@ PrintLayout
Individual print layout (QgsPrintLayout)
Represents a mesh layer supporting display of data on structured or unstructured meshes.
static void logMessage(const QString &message, const QString &tag=QString(), Qgis::MessageLevel level=Qgis::MessageLevel::Warning, bool notifyUser=true)
Adds a message to the log instance (and creates it if necessary).
Represents a map layer supporting display of point clouds.
A class to represent a 2D point.
Print layout, a QgsLayout subclass for static or atlas-based layouts.
Abstract base class for processing algorithms.
QgsProcessingProvider * provider() const
Returns the provider to which this algorithm belongs.
Details for layers to load into projects.
Contains information about the context in which a processing algorithm is executed.
QgsExpressionContext & expressionContext()
Returns the expression context.
QgsProject * project() const
Returns the project in which the algorithm is being executed.
void addLayerToLoadOnCompletion(const QString &layer, const QgsProcessingContext::LayerDetails &details)
Adds a layer to load (by ID or datasource) into the canvas upon completion of the algorithm or model.
Base class for all parameter definitions which represent file or layer destinations,...
virtual QString defaultFileExtension() const =0
Returns the default file extension for destination file paths associated with this parameter.
void setCreateByDefault(bool createByDefault)
Sets whether the destination should be created by default.
QVariantMap toVariantMap() const override
Saves this parameter to a QVariantMap.
virtual QString generateTemporaryDestination() const
Generates a temporary destination value for this parameter.
bool supportsNonFileBasedOutput() const
Returns true if the destination parameter supports non filed-based outputs, such as memory layers or ...
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonQgsProcessingAlgorithmSubclass) const override
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
bool createByDefault() const
Returns true if the destination should be created by default.
QString createFileFilter() const override
This method needs to be reimplemented in all classes which implement this interface and return a file...
virtual bool isSupportedOutputValue(const QVariant &value, QgsProcessingContext &context, QString &error) const
Tests whether a value is a supported value for this parameter.
QgsProcessingProvider * originalProvider() const
Original (source) provider which this parameter has been derived from.
QgsProcessingDestinationParameter(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), bool optional=false, bool createByDefault=true)
Constructor for QgsProcessingDestinationParameter.
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
Custom exception class for processing related exceptions.
Encapsulates settings relating to a feature source input to a processing algorithm.
bool loadVariant(const QVariantMap &map)
Loads this source definition from a QVariantMap, wrapped in a QVariant.
Flags flags
Flags which dictate source behavior.
bool selectedFeaturesOnly
true if only selected features in the source should be used by algorithms.
QgsFeatureRequest::InvalidGeometryCheck geometryCheck
Geometry check method to apply to this source.
QgsProperty source
Source definition.
long long featureLimit
If set to a value > 0, places a limit on the maximum number of features which will be read from the s...
QVariant toVariant() const
Saves this source definition to a QVariantMap, wrapped in a QVariant.
QgsFeatureSource subclass which proxies methods to an underlying QgsFeatureSource,...
Base class for providing feedback from a processing algorithm.
Base class for the definition of processing outputs.
A file output for processing algorithms.
A folder output for processing algorithms.
A HTML file output for processing algorithms.
Encapsulates settings relating to a feature sink or output raster layer for a processing algorithm.
bool loadVariant(const QVariantMap &map)
Loads this output layer definition from a QVariantMap, wrapped in a QVariant.
bool operator!=(const QgsProcessingOutputLayerDefinition &other) const
QgsProject * destinationProject
Destination project.
bool operator==(const QgsProcessingOutputLayerDefinition &other) const
QgsProperty sink
Sink/layer definition.
bool useRemapping() const
Returns true if the output uses a remapping definition.
QgsRemappingSinkDefinition remappingDefinition() const
Returns the output remapping definition, if useRemapping() is true.
QVariant toVariant() const
Saves this output layer definition to a QVariantMap, wrapped in a QVariant.
QString destinationName
Name to use for sink if it's to be loaded into a destination project.
QVariantMap createOptions
Map of optional sink/layer creation options, which are passed to the underlying provider when creatin...
void setRemappingDefinition(const QgsRemappingSinkDefinition &definition)
Sets the remapping definition to use when adding features to the output layer.
A raster layer output for processing algorithms.
A vector layer output for processing algorithms.
An annotation layer parameter for processing algorithms.
QgsProcessingParameterAnnotationLayer(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), bool optional=false)
Constructor for QgsProcessingParameterAnnotationLayer.
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
QString valueAsPythonString(const QVariant &value, QgsProcessingContext &context) const override
Returns a string version of the parameter input value, which is suitable for use as an input paramete...
static QgsProcessingParameterAnnotationLayer * fromScriptCode(const QString &name, const QString &description, bool isOptional, const QString &definition)
Creates a new parameter using the definition from a script code.
bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
static QString typeName()
Returns the type name for the parameter class.
A string parameter for authentication configuration ID values.
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
QgsProcessingParameterAuthConfig(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), bool optional=false)
Constructor for QgsProcessingParameterAuthConfig.
static QString typeName()
Returns the type name for the parameter class.
QString asScriptCode() const override
Returns the parameter definition encoded in a string which can be used within a Processing script.
QString valueAsPythonString(const QVariant &value, QgsProcessingContext &context) const override
Returns a string version of the parameter input value, which is suitable for use as an input paramete...
static QgsProcessingParameterAuthConfig * fromScriptCode(const QString &name, const QString &description, bool isOptional, const QString &definition)
Creates a new parameter using the definition from a script code.
A raster band parameter for Processing algorithms.
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonQgsProcessingAlgorithmSubclass) const override
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
void setAllowMultiple(bool allowMultiple)
Sets whether multiple band selections are permitted.
void setParentLayerParameterName(const QString &parentLayerParameterName)
Sets the name of the parent layer parameter.
QVariantMap toVariantMap() const override
Saves this parameter to a QVariantMap.
QStringList dependsOnOtherParameters() const override
Returns a list of other parameter names on which this parameter is dependent (e.g.
QString valueAsPythonString(const QVariant &value, QgsProcessingContext &context) const override
Returns a string version of the parameter input value, which is suitable for use as an input paramete...
QString parentLayerParameterName() const
Returns the name of the parent layer parameter, or an empty string if this is not set.
QgsProcessingParameterBand(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), const QString &parentLayerParameterName=QString(), bool optional=false, bool allowMultiple=false)
Constructor for QgsProcessingParameterBand.
QString asScriptCode() const override
Returns the parameter definition encoded in a string which can be used within a Processing script.
bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
static QgsProcessingParameterBand * fromScriptCode(const QString &name, const QString &description, bool isOptional, const QString &definition)
Creates a new parameter using the definition from a script code.
static QString typeName()
Returns the type name for the parameter class.
bool allowMultiple() const
Returns whether multiple band selections are permitted.
A boolean parameter for processing algorithms.
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
QString valueAsPythonString(const QVariant &value, QgsProcessingContext &context) const override
Returns a string version of the parameter input value, which is suitable for use as an input paramete...
QString type() const override
Unique parameter type name.
static QString typeName()
Returns the type name for the parameter class.
static QgsProcessingParameterBoolean * fromScriptCode(const QString &name, const QString &description, bool isOptional, const QString &definition)
Creates a new parameter using the definition from a script code.
QgsProcessingParameterBoolean(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), bool optional=false)
Constructor for QgsProcessingParameterBoolean.
QString asScriptCode() const override
Returns the parameter definition encoded in a string which can be used within a Processing script.
A color parameter for processing algorithms.
QString valueAsPythonString(const QVariant &value, QgsProcessingContext &context) const override
Returns a string version of the parameter input value, which is suitable for use as an input paramete...
static QgsProcessingParameterColor * fromScriptCode(const QString &name, const QString &description, bool isOptional, const QString &definition)
Creates a new parameter using the definition from a script code.
bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
bool opacityEnabled() const
Returns true if the parameter allows opacity control.
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonQgsProcessingAlgorithmSubclass) const override
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
void setOpacityEnabled(bool enabled)
Sets whether the parameter allows opacity control.
QgsProcessingParameterColor(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), bool opacityEnabled=true, bool optional=false)
Constructor for QgsProcessingParameterColor.
static QString typeName()
Returns the type name for the parameter class.
QVariantMap toVariantMap() const override
Saves this parameter to a QVariantMap.
QString asScriptCode() const override
Returns the parameter definition encoded in a string which can be used within a Processing script.
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
A coordinate operation parameter for processing algorithms, for selection between available coordinat...
static QString typeName()
Returns the type name for the parameter class.
QVariantMap toVariantMap() const override
Saves this parameter to a QVariantMap.
QString valueAsPythonString(const QVariant &value, QgsProcessingContext &context) const override
Returns a string version of the parameter input value, which is suitable for use as an input paramete...
QString asScriptCode() const override
Returns the parameter definition encoded in a string which can be used within a Processing script.
static QgsProcessingParameterCoordinateOperation * fromScriptCode(const QString &name, const QString &description, bool isOptional, const QString &definition)
Creates a new parameter using the definition from a script code.
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
QgsProcessingParameterCoordinateOperation(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), const QString &sourceCrsParameterName=QString(), const QString &destinationCrsParameterName=QString(), const QVariant &staticSourceCrs=QVariant(), const QVariant &staticDestinationCrs=QVariant(), bool optional=false)
Constructor for QgsProcessingParameterCoordinateOperation.
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonQgsProcessingAlgorithmSubclass) const override
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
QStringList dependsOnOtherParameters() const override
Returns a list of other parameter names on which this parameter is dependent (e.g.
A coordinate reference system parameter for processing algorithms.
QgsProcessingParameterCrs(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), bool optional=false)
Constructor for QgsProcessingParameterCrs.
bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
static QString typeName()
Returns the type name for the parameter class.
QString valueAsPythonString(const QVariant &value, QgsProcessingContext &context) const override
Returns a string version of the parameter input value, which is suitable for use as an input paramete...
static QgsProcessingParameterCrs * fromScriptCode(const QString &name, const QString &description, bool isOptional, const QString &definition)
Creates a new parameter using the definition from a script code.
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
A database schema parameter for processing algorithms, allowing users to select from existing schemas...
void setParentConnectionParameterName(const QString &name)
Sets the name of the parent connection parameter.
QStringList dependsOnOtherParameters() const override
Returns a list of other parameter names on which this parameter is dependent (e.g.
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
QgsProcessingParameterDatabaseSchema(const QString &name, const QString &description, const QString &connectionParameterName=QString(), const QVariant &defaultValue=QVariant(), bool optional=false)
Constructor for QgsProcessingParameterDatabaseSchema.
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
static QgsProcessingParameterDatabaseSchema * fromScriptCode(const QString &name, const QString &description, bool isOptional, const QString &definition)
Creates a new parameter using the definition from a script code.
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonQgsProcessingAlgorithmSubclass) const override
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
QString asScriptCode() const override
Returns the parameter definition encoded in a string which can be used within a Processing script.
QString valueAsPythonString(const QVariant &value, QgsProcessingContext &context) const override
Returns a string version of the parameter input value, which is suitable for use as an input paramete...
bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
QString parentConnectionParameterName() const
Returns the name of the parent connection parameter, or an empty string if this is not set.
QVariantMap toVariantMap() const override
Saves this parameter to a QVariantMap.
A database table name parameter for processing algorithms, allowing users to select from existing dat...
QgsProcessingParameterDatabaseTable(const QString &name, const QString &description, const QString &connectionParameterName=QString(), const QString &schemaParameterName=QString(), const QVariant &defaultValue=QVariant(), bool optional=false, bool allowNewTableNames=false)
Constructor for QgsProcessingParameterDatabaseTable.
void setParentSchemaParameterName(const QString &name)
Sets the name of the parent schema parameter.
QString parentConnectionParameterName() const
Returns the name of the parent connection parameter, or an empty string if this is not set.
QString parentSchemaParameterName() const
Returns the name of the parent schema parameter, or an empty string if this is not set.
QString asScriptCode() const override
Returns the parameter definition encoded in a string which can be used within a Processing script.
static QgsProcessingParameterDatabaseTable * fromScriptCode(const QString &name, const QString &description, bool isOptional, const QString &definition)
Creates a new parameter using the definition from a script code.
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
bool allowNewTableNames() const
Returns true if the parameter allows users to enter names for a new (non-existing) tables.
QString valueAsPythonString(const QVariant &value, QgsProcessingContext &context) const override
Returns a string version of the parameter input value, which is suitable for use as an input paramete...
QStringList dependsOnOtherParameters() const override
Returns a list of other parameter names on which this parameter is dependent (e.g.
void setAllowNewTableNames(bool allowed)
Sets whether the parameter allows users to enter names for a new (non-existing) tables.
QVariantMap toVariantMap() const override
Saves this parameter to a QVariantMap.
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonQgsProcessingAlgorithmSubclass) const override
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
void setParentConnectionParameterName(const QString &name)
Sets the name of the parent connection parameter.
A datetime (or pure date or time) parameter for processing algorithms.
@ DateTime
Datetime values.
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
void setMaximum(const QDateTime &maximum)
Sets the maximum value acceptable by the parameter.
static QgsProcessingParameterDateTime * fromScriptCode(const QString &name, const QString &description, bool isOptional, const QString &definition)
Creates a new parameter using the definition from a script code.
QDateTime minimum() const
Returns the minimum value acceptable by the parameter.
bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
QString toolTip() const override
Returns a formatted tooltip for use with the parameter, which gives helpful information like paramete...
void setMinimum(const QDateTime &minimum)
Sets the minimum value acceptable by the parameter.
QString valueAsPythonString(const QVariant &value, QgsProcessingContext &context) const override
Returns a string version of the parameter input value, which is suitable for use as an input paramete...
QDateTime maximum() const
Returns the maximum value acceptable by the parameter.
QgsProcessingParameterDateTime(const QString &name, const QString &description=QString(), Type type=DateTime, const QVariant &defaultValue=QVariant(), bool optional=false, const QDateTime &minValue=QDateTime(), const QDateTime &maxValue=QDateTime())
Constructor for QgsProcessingParameterDateTime.
QVariantMap toVariantMap() const override
Saves this parameter to a QVariantMap.
Type dataType() const
Returns the acceptable data type for the parameter.
void setDataType(Type type)
Sets the acceptable data type for the parameter.
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonQgsProcessingAlgorithmSubclass) const override
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
Base class for the definition of processing parameters.
QgsProcessingAlgorithm * mAlgorithm
Pointer to algorithm which owns this parameter.
QString mHelp
Parameter help.
QVariant defaultValue() const
Returns the default value for the parameter.
QString help() const
Returns the help for the parameter.
virtual QString asScriptCode() const
Returns the parameter definition encoded in a string which can be used within a Processing script.
virtual QString toolTip() const
Returns a formatted tooltip for use with the parameter, which gives helpful information like paramete...
Flags mFlags
Parameter flags.
QgsProcessingAlgorithm * algorithm() const
Returns a pointer to the algorithm which owns this parameter.
QgsProcessingProvider * provider() const
Returns a pointer to the provider for the algorithm which owns this parameter.
virtual QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonQgsProcessingAlgorithmSubclass) const
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
QString mName
Parameter name.
QString description() const
Returns the description for the parameter.
QgsProcessingParameterDefinition(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), bool optional=false, const QString &help=QString())
Constructor for QgsProcessingParameterDefinition.
QVariantMap mMetadata
Freeform metadata for parameter. Mostly used by widget wrappers to customize their appearance and beh...
@ FlagOptional
Parameter is optional.
QString mDescription
Parameter description.
virtual QString type() const =0
Unique parameter type name.
Flags flags() const
Returns any flags associated with the parameter.
virtual QVariantMap toVariantMap() const
Saves this parameter to a QVariantMap.
QString name() const
Returns the name of the parameter.
QVariant mDefault
Default value for parameter.
QVariant mGuiDefault
Default value for parameter in GUI.
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...
virtual bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const
Checks whether the specified input value is acceptable for the parameter.
virtual bool fromVariantMap(const QVariantMap &map)
Restores this parameter to a QVariantMap.
virtual QString valueAsPythonComment(const QVariant &value, QgsProcessingContext &context) const
Returns a Python comment explaining a parameter value, or an empty string if no comment is required.
A double numeric parameter for distance values.
void setParentParameterName(const QString &parentParameterName)
Sets the name of the parent layer parameter.
static QString typeName()
Returns the type name for the parameter class.
QString parentParameterName() const
Returns the name of the parent parameter, or an empty string if this is not set.
QStringList dependsOnOtherParameters() const override
Returns a list of other parameter names on which this parameter is dependent (e.g.
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
QVariantMap toVariantMap() const override
Saves this parameter to a QVariantMap.
QgsProcessingParameterDistance * clone() const override
Creates a clone of the parameter definition.
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonQgsProcessingAlgorithmSubclass) const override
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
QString type() const override
Unique parameter type name.
QgsProcessingParameterDistance(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), const QString &parentParameterName=QString(), bool optional=false, double minValue=std::numeric_limits< double >::lowest()+1, double maxValue=std::numeric_limits< double >::max())
Constructor for QgsProcessingParameterDistance.
A double numeric parameter for duration values.
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
QgsProcessingParameterDuration * clone() const override
Creates a clone of the parameter definition.
QVariantMap toVariantMap() const override
Saves this parameter to a QVariantMap.
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonQgsProcessingAlgorithmSubclass) const override
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
static QString typeName()
Returns the type name for the parameter class.
QString type() const override
Unique parameter type name.
QgsProcessingParameterDuration(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), bool optional=false, double minValue=std::numeric_limits< double >::lowest()+1, double maxValue=std::numeric_limits< double >::max())
Constructor for QgsProcessingParameterDuration.
An enum based parameter for processing algorithms, allowing for selection from predefined values.
void setUsesStaticStrings(bool usesStaticStrings)
Sets whether the parameter uses static (non-translated) string values for its enumeration choice list...
static QgsProcessingParameterEnum * fromScriptCode(const QString &name, const QString &description, bool isOptional, const QString &definition)
Creates a new parameter using the definition from a script code.
QString valueAsPythonString(const QVariant &value, QgsProcessingContext &context) const override
Returns a string version of the parameter input value, which is suitable for use as an input paramete...
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonQgsProcessingAlgorithmSubclass) const override
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
bool allowMultiple() const
Returns true if the parameter allows multiple selected values.
QStringList options() const
Returns the list of acceptable options for the parameter.
QgsProcessingParameterEnum(const QString &name, const QString &description=QString(), const QStringList &options=QStringList(), bool allowMultiple=false, const QVariant &defaultValue=QVariant(), bool optional=false, bool usesStaticStrings=false)
Constructor for QgsProcessingParameterEnum.
void setOptions(const QStringList &options)
Sets the list of acceptable options for the parameter.
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
bool usesStaticStrings() const
Returns true if the parameter uses static (non-translated) string values for its enumeration choice l...
QString valueAsPythonComment(const QVariant &value, QgsProcessingContext &context) const override
Returns a Python comment explaining a parameter value, or an empty string if no comment is required.
void setAllowMultiple(bool allowMultiple)
Sets whether the parameter allows multiple selected values.
bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
QVariantMap toVariantMap() const override
Saves this parameter to a QVariantMap.
QString asScriptCode() const override
Returns the parameter definition encoded in a string which can be used within a Processing script.
static QString typeName()
Returns the type name for the parameter class.
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
An expression parameter for processing algorithms.
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
static QgsProcessingParameterExpression * fromScriptCode(const QString &name, const QString &description, bool isOptional, const QString &definition)
Creates a new parameter using the definition from a script code.
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonQgsProcessingAlgorithmSubclass) const override
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
QString valueAsPythonString(const QVariant &value, QgsProcessingContext &context) const override
Returns a string version of the parameter input value, which is suitable for use as an input paramete...
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
QStringList dependsOnOtherParameters() const override
Returns a list of other parameter names on which this parameter is dependent (e.g.
QgsProcessingParameterExpression(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), const QString &parentLayerParameterName=QString(), bool optional=false)
Constructor for QgsProcessingParameterExpression.
void setParentLayerParameterName(const QString &parentLayerParameterName)
Sets the name of the parent layer parameter.
QVariantMap toVariantMap() const override
Saves this parameter to a QVariantMap.
QString parentLayerParameterName() const
Returns the name of the parent layer parameter, or an empty string if this is not set.
static QString typeName()
Returns the type name for the parameter class.
A rectangular map extent parameter for processing algorithms.
QString valueAsPythonString(const QVariant &value, QgsProcessingContext &context) const override
Returns a string version of the parameter input value, which is suitable for use as an input paramete...
QgsProcessingParameterExtent(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), bool optional=false)
Constructor for QgsProcessingParameterExtent.
bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
static QString typeName()
Returns the type name for the parameter class.
static QgsProcessingParameterExtent * fromScriptCode(const QString &name, const QString &description, bool isOptional, const QString &definition)
Creates a new parameter using the definition from a script code.
A feature sink output for processing algorithms.
QString generateTemporaryDestination() const override
Generates a temporary destination value for this parameter.
static QgsProcessingParameterFeatureSink * fromScriptCode(const QString &name, const QString &description, bool isOptional, const QString &definition)
Creates a new parameter using the definition from a script code.
QgsProcessingOutputDefinition * toOutputDefinition() const override
Returns a new QgsProcessingOutputDefinition corresponding to the definition of the destination parame...
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
bool hasGeometry() const
Returns true if sink is likely to include geometries.
QString type() const override
Unique parameter type name.
QgsProcessing::SourceType dataType() const
Returns the layer type for sinks associated with the parameter.
virtual QStringList supportedOutputVectorLayerExtensions() const
Returns a list of the vector format file extensions supported by this parameter.
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
QString valueAsPythonString(const QVariant &value, QgsProcessingContext &context) const override
Returns a string version of the parameter input value, which is suitable for use as an input paramete...
bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
void setSupportsAppend(bool supportsAppend)
Sets whether the sink supports appending features to an existing table.
QgsProcessingParameterFeatureSink(const QString &name, const QString &description=QString(), QgsProcessing::SourceType type=QgsProcessing::TypeVectorAnyGeometry, const QVariant &defaultValue=QVariant(), bool optional=false, bool createByDefault=true, bool supportsAppend=false)
Constructor for QgsProcessingParameterFeatureSink.
QString createFileFilter() const override
This method needs to be reimplemented in all classes which implement this interface and return a file...
QString defaultFileExtension() const override
Returns the default file extension for destination file paths associated with this parameter.
void setDataType(QgsProcessing::SourceType type)
Sets the layer type for the sinks associated with the parameter.
bool supportsAppend() const
Returns true if the sink supports appending features to an existing table.
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonQgsProcessingAlgorithmSubclass) const override
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
static QString typeName()
Returns the type name for the parameter class.
QVariantMap toVariantMap() const override
Saves this parameter to a QVariantMap.
QString asScriptCode() const override
Returns the parameter definition encoded in a string which can be used within a Processing script.
An input feature source (such as vector layers) parameter for processing algorithms.
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
QgsProcessingParameterFeatureSource(const QString &name, const QString &description=QString(), const QList< int > &types=QList< int >(), const QVariant &defaultValue=QVariant(), bool optional=false)
Constructor for QgsProcessingParameterFeatureSource.
QString valueAsPythonString(const QVariant &value, QgsProcessingContext &context) const override
Returns a string version of the parameter input value, which is suitable for use as an input paramete...
QString asScriptCode() const override
Returns the parameter definition encoded in a string which can be used within a Processing script.
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonQgsProcessingAlgorithmSubclass) const override
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
QVariantMap toVariantMap() const override
Saves this parameter to a QVariantMap.
QString createFileFilter() const override
This method needs to be reimplemented in all classes which implement this interface and return a file...
static QString typeName()
Returns the type name for the parameter class.
QString type() const override
Unique parameter type name.
static QgsProcessingParameterFeatureSource * fromScriptCode(const QString &name, const QString &description, bool isOptional, const QString &definition)
Creates a new parameter using the definition from a script code.
A vector layer or feature source field parameter for processing algorithms.
QgsProcessingParameterField(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), const QString &parentLayerParameterName=QString(), DataType type=Any, bool allowMultiple=false, bool optional=false, bool defaultToAllFields=false)
Constructor for QgsProcessingParameterField.
QStringList dependsOnOtherParameters() const override
Returns a list of other parameter names on which this parameter is dependent (e.g.
QString parentLayerParameterName() const
Returns the name of the parent layer parameter, or an empty string if this is not set.
void setDataType(DataType type)
Sets the acceptable data type for the field.
void setParentLayerParameterName(const QString &parentLayerParameterName)
Sets the name of the parent layer parameter.
bool allowMultiple() const
Returns whether multiple field selections are permitted.
bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
QVariantMap toVariantMap() const override
Saves this parameter to a QVariantMap.
QString type() const override
Unique parameter type name.
bool defaultToAllFields() const
Returns whether a parameter which allows multiple selections (see allowMultiple()) should automatical...
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonQgsProcessingAlgorithmSubclass) const override
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
static QString typeName()
Returns the type name for the parameter class.
QString valueAsPythonString(const QVariant &value, QgsProcessingContext &context) const override
Returns a string version of the parameter input value, which is suitable for use as an input paramete...
void setAllowMultiple(bool allowMultiple)
Sets whether multiple field selections are permitted.
DataType
Field data types.
@ DateTime
Accepts datetime fields.
@ Numeric
Accepts numeric fields.
@ String
Accepts string fields.
DataType dataType() const
Returns the acceptable data type for the field.
QString asScriptCode() const override
Returns the parameter definition encoded in a string which can be used within a Processing script.
void setDefaultToAllFields(bool enabled)
Sets whether a parameter which allows multiple selections (see allowMultiple()) should automatically ...
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
static QgsProcessingParameterField * fromScriptCode(const QString &name, const QString &description, bool isOptional, const QString &definition)
Creates a new parameter using the definition from a script code.
A generic file based destination parameter, for specifying the destination path for a file (non-map l...
static QgsProcessingParameterFileDestination * fromScriptCode(const QString &name, const QString &description, bool isOptional, const QString &definition)
Creates a new parameter using the definition from a script code.
QgsProcessingOutputDefinition * toOutputDefinition() const override
Returns a new QgsProcessingOutputDefinition corresponding to the definition of the destination parame...
QString defaultFileExtension() const override
Returns the default file extension for destination file paths associated with this parameter.
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonQgsProcessingAlgorithmSubclass) const override
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
QgsProcessingParameterFileDestination(const QString &name, const QString &description=QString(), const QString &fileFilter=QString(), const QVariant &defaultValue=QVariant(), bool optional=false, bool createByDefault=true)
Constructor for QgsProcessingParameterFileDestination.
static QString typeName()
Returns the type name for the parameter class.
QString valueAsPythonString(const QVariant &value, QgsProcessingContext &context) const override
Returns a string version of the parameter input value, which is suitable for use as an input paramete...
QString fileFilter() const
Returns the file filter string for file destinations compatible with this parameter.
void setFileFilter(const QString &filter)
Sets the file filter string for file destinations compatible with this parameter.
QString createFileFilter() const override
This method needs to be reimplemented in all classes which implement this interface and return a file...
QVariantMap toVariantMap() const override
Saves this parameter to a QVariantMap.
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
An input file or folder parameter for processing algorithms.
QString extension() const
Returns any specified file extension for the parameter.
void setExtension(const QString &extension)
Sets a file extension for the parameter.
static QString typeName()
Returns the type name for the parameter class.
QVariantMap toVariantMap() const override
Saves this parameter to a QVariantMap.
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonQgsProcessingAlgorithmSubclass) const override
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
QString asScriptCode() const override
Returns the parameter definition encoded in a string which can be used within a Processing script.
void setFileFilter(const QString &filter)
Sets the file filter string for file destinations compatible with this parameter.
static QgsProcessingParameterFile * fromScriptCode(const QString &name, const QString &description, bool isOptional, const QString &definition, Behavior behavior=File)
Creates a new parameter using the definition from a script code.
Behavior
Parameter behavior.
@ Folder
Parameter is a folder.
@ File
Parameter is a single file.
Behavior behavior() const
Returns the parameter behavior (e.g.
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
QString fileFilter() const
Returns the file filter string for file destinations compatible with this parameter.
bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
QgsProcessingParameterFile(const QString &name, const QString &description=QString(), Behavior behavior=File, const QString &extension=QString(), const QVariant &defaultValue=QVariant(), bool optional=false, const QString &fileFilter=QString())
Constructor for QgsProcessingParameterFile.
QString createFileFilter() const override
This method needs to be reimplemented in all classes which implement this interface and return a file...
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
A folder destination parameter, for specifying the destination path for a folder created by the algor...
QgsProcessingOutputDefinition * toOutputDefinition() const override
Returns a new QgsProcessingOutputDefinition corresponding to the definition of the destination parame...
static QgsProcessingParameterFolderDestination * fromScriptCode(const QString &name, const QString &description, bool isOptional, const QString &definition)
Creates a new parameter using the definition from a script code.
bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
QString defaultFileExtension() const override
Returns the default file extension for destination file paths associated with this parameter.
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
static QString typeName()
Returns the type name for the parameter class.
QgsProcessingParameterFolderDestination(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), bool optional=false, bool createByDefault=true)
Constructor for QgsProcessingParameterFolderDestination.
A geometry parameter for processing algorithms.
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
QString type() const override
Unique parameter type name.
QString valueAsPythonString(const QVariant &value, QgsProcessingContext &context) const override
Returns a string version of the parameter input value, which is suitable for use as an input paramete...
QString asScriptCode() const override
Returns the parameter definition encoded in a string which can be used within a Processing script.
bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonQgsProcessingAlgorithmSubclass) const override
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
QgsProcessingParameterGeometry(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), bool optional=false, const QList< int > &geometryTypes=QList< int >(), bool allowMultipart=true)
Constructor for QgsProcessingParameterGeometry.
QVariantMap toVariantMap() const override
Saves this parameter to a QVariantMap.
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
static QgsProcessingParameterGeometry * fromScriptCode(const QString &name, const QString &description, bool isOptional, const QString &definition)
Creates a new parameter using the definition from a script code.
A print layout item parameter, allowing users to select a particular item from a print layout.
QString type() const override
Unique parameter type name.
static QgsProcessingParameterLayoutItem * fromScriptCode(const QString &name, const QString &description, bool isOptional, const QString &definition)
Creates a new parameter using the definition from a script code.
QgsProcessingParameterLayoutItem(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), const QString &parentLayoutParameterName=QString(), int itemType=-1, bool optional=false)
Constructor for QgsProcessingParameterLayoutItem.
void setParentLayoutParameterName(const QString &name)
Sets the name of the parent layout parameter.
QString parentLayoutParameterName() const
Returns the name of the parent layout parameter, or an empty string if this is not set.
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonQgsProcessingAlgorithmSubclass) const override
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
static QString typeName()
Returns the type name for the parameter class.
QVariantMap toVariantMap() const override
Saves this parameter to a QVariantMap.
int itemType() const
Returns the acceptable item type, or -1 if any item type is allowed.
void setItemType(int type)
Sets the acceptable item type, or -1 if any item type is allowed.
QString valueAsPythonString(const QVariant &value, QgsProcessingContext &context) const override
Returns a string version of the parameter input value, which is suitable for use as an input paramete...
QString asScriptCode() const override
Returns the parameter definition encoded in a string which can be used within a Processing script.
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
QStringList dependsOnOtherParameters() const override
Returns a list of other parameter names on which this parameter is dependent (e.g.
A print layout parameter, allowing users to select a print layout.
QString valueAsPythonString(const QVariant &value, QgsProcessingContext &context) const override
Returns a string version of the parameter input value, which is suitable for use as an input paramete...
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonQgsProcessingAlgorithmSubclass) const override
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
static QgsProcessingParameterLayout * fromScriptCode(const QString &name, const QString &description, bool isOptional, const QString &definition)
Creates a new parameter using the definition from a script code.
QString asScriptCode() const override
Returns the parameter definition encoded in a string which can be used within a Processing script.
QgsProcessingParameterLayout(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), bool optional=false)
Constructor for QgsProcessingParameterLayout.
static QString typeName()
Returns the type name for the parameter class.
Can be inherited by parameters which require limits to their acceptable data types.
void setDataTypes(const QList< int > &types)
Sets the geometry types for sources acceptable by the parameter.
QgsProcessingParameterLimitedDataTypes(const QList< int > &types=QList< int >())
Constructor for QgsProcessingParameterLimitedDataTypes, with a list of acceptable data types.
QList< int > mDataTypes
List of acceptable data types for the parameter.
QList< int > dataTypes() const
Returns the geometry types for sources acceptable by the parameter.
A map layer parameter for processing algorithms.
QString asScriptCode() const override
Returns the parameter definition encoded in a string which can be used within a Processing script.
static QgsProcessingParameterMapLayer * fromScriptCode(const QString &name, const QString &description, bool isOptional, const QString &definition)
Creates a new parameter using the definition from a script code.
QVariantMap toVariantMap() const override
Saves this parameter to a QVariantMap.
QString valueAsPythonString(const QVariant &value, QgsProcessingContext &context) const override
Returns a string version of the parameter input value, which is suitable for use as an input paramete...
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
QString createFileFilter() const override
This method needs to be reimplemented in all classes which implement this interface and return a file...
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonQgsProcessingAlgorithmSubclass) const override
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
QString type() const override
Unique parameter type name.
QgsProcessingParameterMapLayer(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), bool optional=false, const QList< int > &types=QList< int >())
Constructor for QgsProcessingParameterMapLayer.
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
static QString typeName()
Returns the type name for the parameter class.
A map theme parameter for processing algorithms, allowing users to select an existing map theme from ...
QString asScriptCode() const override
Returns the parameter definition encoded in a string which can be used within a Processing script.
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
static QgsProcessingParameterMapTheme * fromScriptCode(const QString &name, const QString &description, bool isOptional, const QString &definition)
Creates a new parameter using the definition from a script code.
QString valueAsPythonString(const QVariant &value, QgsProcessingContext &context) const override
Returns a string version of the parameter input value, which is suitable for use as an input paramete...
QgsProcessingParameterMapTheme(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), bool optional=false)
Constructor for QgsProcessingParameterMapTheme.
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
QVariantMap toVariantMap() const override
Saves this parameter to a QVariantMap.
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonQgsProcessingAlgorithmSubclass) const override
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
A table (matrix) parameter for processing algorithms.
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
QStringList headers() const
Returns a list of column headers (if set).
void setHeaders(const QStringList &headers)
Sets the list of column headers.
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
void setHasFixedNumberRows(bool hasFixedNumberRows)
Sets whether the table has a fixed number of rows.
QVariantMap toVariantMap() const override
Saves this parameter to a QVariantMap.
void setNumberRows(int rows)
Sets the fixed number of rows in the table.
int numberRows() const
Returns the fixed number of rows in the table.
static QgsProcessingParameterMatrix * fromScriptCode(const QString &name, const QString &description, bool isOptional, const QString &definition)
Creates a new parameter using the definition from a script code.
QString valueAsPythonString(const QVariant &value, QgsProcessingContext &context) const override
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 asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonQgsProcessingAlgorithmSubclass) const override
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
QgsProcessingParameterMatrix(const QString &name, const QString &description=QString(), int numberRows=3, bool hasFixedNumberRows=false, const QStringList &headers=QStringList(), const QVariant &defaultValue=QVariant(), bool optional=false)
Constructor for QgsProcessingParameterMatrix.
bool hasFixedNumberRows() const
Returns whether the table has a fixed number of rows.
A mesh layer parameter for processing algorithms.
bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
QgsProcessingParameterMeshLayer(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), bool optional=false)
Constructor for QgsProcessingParameterMeshLayer.
QString createFileFilter() const override
This method needs to be reimplemented in all classes which implement this interface and return a file...
QString valueAsPythonString(const QVariant &value, QgsProcessingContext &context) const override
Returns a string version of the parameter input value, which is suitable for use as an input paramete...
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
static QgsProcessingParameterMeshLayer * fromScriptCode(const QString &name, const QString &description, bool isOptional, const QString &definition)
Creates a new parameter using the definition from a script code.
static QString typeName()
Returns the type name for the parameter class.
A parameter for processing algorithms which accepts multiple map layers.
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
void setMinimumNumberInputs(int minimum)
Sets the minimum number of layers required for the parameter.
bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
QString asScriptCode() const override
Returns the parameter definition encoded in a string which can be used within a Processing script.
QgsProcessingParameterMultipleLayers(const QString &name, const QString &description=QString(), QgsProcessing::SourceType layerType=QgsProcessing::TypeVectorAnyGeometry, const QVariant &defaultValue=QVariant(), bool optional=false)
Constructor for QgsProcessingParameterMultipleLayers.
QString valueAsPythonString(const QVariant &value, QgsProcessingContext &context) const override
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.
QVariantMap toVariantMap() const override
Saves this parameter to a QVariantMap.
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
QString createFileFilter() const override
This method needs to be reimplemented in all classes which implement this interface and return a file...
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonQgsProcessingAlgorithmSubclass) const override
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
void setLayerType(QgsProcessing::SourceType type)
Sets the layer type for layers acceptable by the parameter.
static QgsProcessingParameterMultipleLayers * fromScriptCode(const QString &name, const QString &description, bool isOptional, const QString &definition)
Creates a new parameter using the definition from a script code.
QgsProcessing::SourceType layerType() const
Returns the layer type for layers acceptable by the parameter.
QString type() const override
Unique parameter type name.
int minimumNumberInputs() const
Returns the minimum number of layers required for the parameter.
A numeric parameter for processing algorithms.
double minimum() const
Returns the minimum value acceptable by the parameter.
static QgsProcessingParameterNumber * fromScriptCode(const QString &name, const QString &description, bool isOptional, const QString &definition)
Creates a new parameter using the definition from a script code.
void setMinimum(double minimum)
Sets the minimum value acceptable by the parameter.
void setMaximum(double maximum)
Sets the maximum value acceptable by the parameter.
@ Double
Double/float values.
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonQgsProcessingAlgorithmSubclass) const override
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
double maximum() const
Returns the maximum value acceptable by the parameter.
QgsProcessingParameterNumber(const QString &name, const QString &description=QString(), Type type=Integer, const QVariant &defaultValue=QVariant(), bool optional=false, double minValue=std::numeric_limits< double >::lowest()+1, double maxValue=std::numeric_limits< double >::max())
Constructor for QgsProcessingParameterNumber.
void setDataType(Type type)
Sets the acceptable data type for the parameter.
bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
Type dataType() const
Returns the acceptable data type for the parameter.
QVariantMap toVariantMap() const override
Saves this parameter to a QVariantMap.
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
QString toolTip() const override
Returns a formatted tooltip for use with the parameter, which gives helpful information like paramete...
QString valueAsPythonString(const QVariant &value, QgsProcessingContext &context) const override
Returns a string version of the parameter input value, which is suitable for use as an input paramete...
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
static QString typeName()
Returns the type name for the parameter class.
A point cloud layer parameter for processing algorithms.
QString valueAsPythonString(const QVariant &value, QgsProcessingContext &context) const override
Returns a string version of the parameter input value, which is suitable for use as an input paramete...
static QgsProcessingParameterPointCloudLayer * fromScriptCode(const QString &name, const QString &description, bool isOptional, const QString &definition)
Creates a new parameter using the definition from a script code.
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
QString createFileFilter() const override
This method needs to be reimplemented in all classes which implement this interface and return a file...
bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
static QString typeName()
Returns the type name for the parameter class.
QgsProcessingParameterPointCloudLayer(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), bool optional=false)
Constructor for QgsProcessingParameterPointCloudLayer.
A point parameter for processing algorithms.
bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
static QgsProcessingParameterPoint * fromScriptCode(const QString &name, const QString &description, bool isOptional, const QString &definition)
Creates a new parameter using the definition from a script code.
QgsProcessingParameterPoint(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), bool optional=false)
Constructor for QgsProcessingParameterPoint.
static QString typeName()
Returns the type name for the parameter class.
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
QString valueAsPythonString(const QVariant &value, QgsProcessingContext &context) const override
Returns a string version of the parameter input value, which is suitable for use as an input paramete...
A data provider connection parameter for processing algorithms, allowing users to select from availab...
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
QgsProcessingParameterProviderConnection(const QString &name, const QString &description, const QString &provider, const QVariant &defaultValue=QVariant(), bool optional=false)
Constructor for QgsProcessingParameterProviderConnection, for the specified provider type.
QVariantMap toVariantMap() const override
Saves this parameter to a QVariantMap.
QString asScriptCode() const override
Returns the parameter definition encoded in a string which can be used within a Processing script.
QString valueAsPythonString(const QVariant &value, QgsProcessingContext &context) const override
Returns a string version of the parameter input value, which is suitable for use as an input paramete...
bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonQgsProcessingAlgorithmSubclass) const override
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
static QgsProcessingParameterProviderConnection * fromScriptCode(const QString &name, const QString &description, bool isOptional, const QString &definition)
Creates a new parameter using the definition from a script code.
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
A numeric range parameter for processing algorithms.
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
QgsProcessingParameterNumber::Type dataType() const
Returns the acceptable data type for the range.
static QString typeName()
Returns the type name for the parameter class.
bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonQgsProcessingAlgorithmSubclass) const override
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
void setDataType(QgsProcessingParameterNumber::Type dataType)
Sets the acceptable data type for the range.
QgsProcessingParameterRange(const QString &name, const QString &description=QString(), QgsProcessingParameterNumber::Type type=QgsProcessingParameterNumber::Integer, const QVariant &defaultValue=QVariant(), bool optional=false)
Constructor for QgsProcessingParameterRange.
QVariantMap toVariantMap() const override
Saves this parameter to a QVariantMap.
QString valueAsPythonString(const QVariant &value, QgsProcessingContext &context) const override
Returns a string version of the parameter input value, which is suitable for use as an input paramete...
static QgsProcessingParameterRange * fromScriptCode(const QString &name, const QString &description, bool isOptional, const QString &definition)
Creates a new parameter using the definition from a script code.
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
A raster layer destination parameter, for specifying the destination path for a raster layer created ...
QString valueAsPythonString(const QVariant &value, QgsProcessingContext &context) const override
Returns a string version of the parameter input value, which is suitable for use as an input paramete...
QgsProcessingOutputDefinition * toOutputDefinition() const override
Returns a new QgsProcessingOutputDefinition corresponding to the definition of the destination parame...
QString createFileFilter() const override
This method needs to be reimplemented in all classes which implement this interface and return a file...
QgsProcessingParameterRasterDestination(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), bool optional=false, bool createByDefault=true)
Constructor for QgsProcessingParameterRasterDestination.
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
static QgsProcessingParameterRasterDestination * fromScriptCode(const QString &name, const QString &description, bool isOptional, const QString &definition)
Creates a new parameter using the definition from a script code.
QString defaultFileExtension() const override
Returns the default file extension for destination file paths associated with this parameter.
virtual QStringList supportedOutputRasterLayerExtensions() const
Returns a list of the raster format file extensions supported for this parameter.
static QString typeName()
Returns the type name for the parameter class.
bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
A raster layer parameter for processing algorithms.
QString valueAsPythonString(const QVariant &value, QgsProcessingContext &context) const override
Returns a string version of the parameter input value, which is suitable for use as an input paramete...
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
static QgsProcessingParameterRasterLayer * fromScriptCode(const QString &name, const QString &description, bool isOptional, const QString &definition)
Creates a new parameter using the definition from a script code.
bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
static QString typeName()
Returns the type name for the parameter class.
QgsProcessingParameterRasterLayer(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), bool optional=false)
Constructor for QgsProcessingParameterRasterLayer.
QString createFileFilter() const override
This method needs to be reimplemented in all classes which implement this interface and return a file...
A double numeric parameter for map scale values.
QString type() const override
Unique parameter type name.
static QString typeName()
Returns the type name for the parameter class.
static QgsProcessingParameterScale * fromScriptCode(const QString &name, const QString &description, bool isOptional, const QString &definition)
Creates a new parameter using the definition from a script code.
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonQgsProcessingAlgorithmSubclass) const override
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
QgsProcessingParameterScale * clone() const override
Creates a clone of the parameter definition.
QgsProcessingParameterScale(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), bool optional=false)
Constructor for QgsProcessingParameterScale.
A string parameter for processing algorithms.
static QString typeName()
Returns the type name for the parameter class.
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
void setMultiLine(bool multiLine)
Sets whether the parameter allows multiline strings.
QVariantMap toVariantMap() const override
Saves this parameter to a QVariantMap.
QString asScriptCode() const override
Returns the parameter definition encoded in a string which can be used within a Processing script.
static QgsProcessingParameterString * fromScriptCode(const QString &name, const QString &description, bool isOptional, const QString &definition)
Creates a new parameter using the definition from a script code.
bool multiLine() const
Returns true if the parameter allows multiline strings.
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
QgsProcessingParameterString(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), bool multiLine=false, bool optional=false)
Constructor for QgsProcessingParameterString.
QString valueAsPythonString(const QVariant &value, QgsProcessingContext &context) const override
Returns a string version of the parameter input value, which is suitable for use as an input paramete...
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonQgsProcessingAlgorithmSubclass) const override
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
Makes metadata of processing parameters available.
virtual QgsProcessingParameterDefinition * create(const QString &name) const =0
Creates a new parameter of this type.
A vector layer destination parameter, for specifying the destination path for a vector layer created ...
QString defaultFileExtension() const override
Returns the default file extension for destination file paths associated with this parameter.
QString createFileFilter() const override
This method needs to be reimplemented in all classes which implement this interface and return a file...
QgsProcessing::SourceType dataType() const
Returns the layer type for this created vector layer.
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonQgsProcessingAlgorithmSubclass) const override
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
QString type() const override
Unique parameter type name.
QVariantMap toVariantMap() const override
Saves this parameter to a QVariantMap.
static QString typeName()
Returns the type name for the parameter class.
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
void setDataType(QgsProcessing::SourceType type)
Sets the layer type for the created vector layer.
QgsProcessingParameterVectorDestination(const QString &name, const QString &description=QString(), QgsProcessing::SourceType type=QgsProcessing::TypeVectorAnyGeometry, const QVariant &defaultValue=QVariant(), bool optional=false, bool createByDefault=true)
Constructor for QgsProcessingParameterVectorDestination.
bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
QString asScriptCode() const override
Returns the parameter definition encoded in a string which can be used within a Processing script.
virtual QStringList supportedOutputVectorLayerExtensions() const
Returns a list of the vector format file extensions supported by this parameter.
bool hasGeometry() const
Returns true if the created layer is likely to include geometries.
QString valueAsPythonString(const QVariant &value, QgsProcessingContext &context) const override
Returns a string version of the parameter input value, which is suitable for use as an input paramete...
static QgsProcessingParameterVectorDestination * fromScriptCode(const QString &name, const QString &description, bool isOptional, const QString &definition)
Creates a new parameter using the definition from a script code.
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
QgsProcessingOutputDefinition * toOutputDefinition() const override
Returns a new QgsProcessingOutputDefinition corresponding to the definition of the destination parame...
A vector layer (with or without geometry) parameter for processing algorithms.
static QgsProcessingParameterVectorLayer * fromScriptCode(const QString &name, const QString &description, bool isOptional, const QString &definition)
Creates a new parameter using the definition from a script code.
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
QVariantMap toVariantMap() const override
Saves this parameter to a QVariantMap.
QString type() const override
Unique parameter type name.
QString createFileFilter() const override
This method needs to be reimplemented in all classes which implement this interface and return a file...
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonQgsProcessingAlgorithmSubclass) const override
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
QgsProcessingParameterVectorLayer(const QString &name, const QString &description=QString(), const QList< int > &types=QList< int >(), const QVariant &defaultValue=QVariant(), bool optional=false)
Constructor for QgsProcessingParameterVectorLayer.
static QString typeName()
Returns the type name for the parameter class.
QString valueAsPythonString(const QVariant &value, QgsProcessingContext &context) const override
Returns a string version of the parameter input value, which is suitable for use as an input paramete...
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
static QList< QgsMapLayer * > parameterAsLayerList(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context)
Evaluates the parameter with matching definition to a list of map layers.
static QString descriptionFromName(const QString &name)
Creates an autogenerated parameter description from a parameter name.
static int parameterAsEnum(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, const QgsProcessingContext &context)
Evaluates the parameter with matching definition to a enum value.
static double parameterAsDouble(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, const QgsProcessingContext &context)
Evaluates the parameter with matching definition to a static double value.
static QgsPointXY parameterAsPoint(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context, const QgsCoordinateReferenceSystem &crs=QgsCoordinateReferenceSystem())
Evaluates the parameter with matching definition to a point.
static QString parameterAsOutputLayer(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context)
Evaluates the parameter with matching definition to a output layer destination.
static QgsPrintLayout * parameterAsLayout(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context)
Evaluates the parameter with matching definition to a print layout.
static QTime parameterAsTime(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, const QgsProcessingContext &context)
Evaluates the parameter with matching definition to a static time value.
static QgsProcessingParameterDefinition * parameterFromVariantMap(const QVariantMap &map)
Creates a new QgsProcessingParameterDefinition using the configuration from a supplied variant map.
static QgsRectangle parameterAsExtent(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context, const QgsCoordinateReferenceSystem &crs=QgsCoordinateReferenceSystem())
Evaluates the parameter with matching definition to a rectangular extent.
static QgsCoordinateReferenceSystem parameterAsGeometryCrs(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context)
Returns the coordinate reference system associated with a geometry parameter value.
static QgsAnnotationLayer * parameterAsAnnotationLayer(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context)
Evaluates the parameter with matching definition to an annotation layer.
static QString parameterAsEnumString(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, const QgsProcessingContext &context)
Evaluates the parameter with matching definition to a static enum string.
static QList< double > parameterAsRange(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context)
Evaluates the parameter with matching definition to a range of values.
static QgsMapLayer * parameterAsLayer(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context, QgsProcessingUtils::LayerHint layerHint=QgsProcessingUtils::LayerHint::UnknownType)
Evaluates the parameter with matching definition to a map layer.
static QList< int > parameterAsInts(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, const QgsProcessingContext &context)
Evaluates the parameter with matching definition to a list of integer values.
static QString parameterAsConnectionName(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, const QgsProcessingContext &context)
Evaluates the parameter with matching definition to a connection name string.
static QgsProcessingFeatureSource * parameterAsSource(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context)
Evaluates the parameter with matching definition to a feature source.
static QString parameterAsFileOutput(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context)
Evaluates the parameter with matching definition to a file based output destination.
static QgsFeatureSink * parameterAsSink(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, const QgsFields &fields, QgsWkbTypes::Type geometryType, const QgsCoordinateReferenceSystem &crs, QgsProcessingContext &context, QString &destinationIdentifier, QgsFeatureSink::SinkFlags sinkFlags=QgsFeatureSink::SinkFlags(), const QVariantMap &createOptions=QVariantMap(), const QStringList &datasourceOptions=QStringList(), const QStringList &layerOptions=QStringList())
Evaluates the parameter with matching definition to a feature sink.
static bool parameterAsBoolean(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, const QgsProcessingContext &context)
Evaluates the parameter with matching definition to a static boolean value.
static QgsCoordinateReferenceSystem parameterAsPointCrs(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context)
Returns the coordinate reference system associated with an point parameter value.
static QgsLayoutItem * parameterAsLayoutItem(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context, QgsPrintLayout *layout)
Evaluates the parameter with matching definition to a print layout item, taken from the specified lay...
static bool parameterAsBool(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, const QgsProcessingContext &context)
Evaluates the parameter with matching definition to a static boolean value.
static QString parameterAsCompatibleSourceLayerPathAndLayerName(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context, const QStringList &compatibleFormats, const QString &preferredFormat=QString("shp"), QgsProcessingFeedback *feedback=nullptr, QString *layerName=nullptr)
Evaluates the parameter with matching definition to a source vector layer file path and layer name of...
static QgsMeshLayer * parameterAsMeshLayer(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context)
Evaluates the parameter with matching definition and value to a mesh layer.
static QString parameterAsCompatibleSourceLayerPath(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context, const QStringList &compatibleFormats, const QString &preferredFormat=QString("shp"), QgsProcessingFeedback *feedback=nullptr)
Evaluates the parameter with matching definition to a source vector layer file path of compatible for...
static QgsProcessingParameterDefinition * parameterFromScriptCode(const QString &code)
Creates a new QgsProcessingParameterDefinition using the configuration from a supplied script code st...
static QColor parameterAsColor(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context)
Returns the color associated with an point parameter value, or an invalid color if the parameter was ...
static QgsVectorLayer * parameterAsVectorLayer(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context)
Evaluates the parameter with matching definition to a vector layer.
static QgsPointCloudLayer * parameterAsPointCloudLayer(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context)
Evaluates the parameter with matching definition to a point cloud layer.
static int parameterAsInt(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, const QgsProcessingContext &context)
Evaluates the parameter with matching definition to a static integer value.
static QString parameterAsDatabaseTableName(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, const QgsProcessingContext &context)
Evaluates the parameter with matching definition to a database table name.
static QString parameterAsSchema(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, const QgsProcessingContext &context)
Evaluates the parameter with matching definition to a database schema name.
static QgsGeometry parameterAsGeometry(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context, const QgsCoordinateReferenceSystem &crs=QgsCoordinateReferenceSystem())
Evaluates the parameter with matching definition to a geometry.
static QString parameterAsExpression(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, const QgsProcessingContext &context)
Evaluates the parameter with matching definition to an expression.
static QString parameterAsString(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, const QgsProcessingContext &context)
Evaluates the parameter with matching definition to a static string value.
static QgsRasterLayer * parameterAsRasterLayer(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context)
Evaluates the parameter with matching definition to a raster layer.
static QList< int > parameterAsEnums(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, const QgsProcessingContext &context)
Evaluates the parameter with matching definition to list of enum values.
static QStringList parameterAsEnumStrings(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, const QgsProcessingContext &context)
Evaluates the parameter with matching definition to list of static enum strings.
static QgsGeometry parameterAsExtentGeometry(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context, const QgsCoordinateReferenceSystem &crs=QgsCoordinateReferenceSystem())
Evaluates the parameter with matching definition to a rectangular extent, and returns a geometry cove...
static QStringList parameterAsFileList(const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context)
Evaluates the parameter with matching definition to a list of files (for QgsProcessingParameterMultip...
static bool isDynamic(const QVariantMap ¶meters, const QString &name)
Returns true if the parameter with matching name is a dynamic parameter, and must be evaluated once f...
static QStringList parameterAsFields(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context)
Evaluates the parameter with matching definition to a list of fields.
static QgsCoordinateReferenceSystem parameterAsExtentCrs(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context)
Returns the coordinate reference system associated with an extent parameter value.
static QDateTime parameterAsDateTime(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, const QgsProcessingContext &context)
Evaluates the parameter with matching definition to a static datetime value.
static QString parameterAsFile(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context)
Evaluates the parameter with matching definition to a file/folder name.
static QDate parameterAsDate(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, const QgsProcessingContext &context)
Evaluates the parameter with matching definition to a static date value.
static QVariantList parameterAsMatrix(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context)
Evaluates the parameter with matching definition to a matrix/table of values.
static QgsCoordinateReferenceSystem parameterAsCrs(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context)
Evaluates the parameter with matching definition to a coordinate reference system.
Abstract base class for processing providers.
virtual bool isSupportedOutputValue(const QVariant &outputValue, const QgsProcessingDestinationParameter *parameter, QgsProcessingContext &context, QString &error) const
Returns true if the specified outputValue is of a supported file format for the given destination par...
QgsProcessingParameterType * parameterType(const QString &id) const
Returns the parameter type registered for id.
static QString convertToCompatibleFormat(const QgsVectorLayer *layer, bool selectedFeaturesOnly, const QString &baseName, const QStringList &compatibleFormats, const QString &preferredFormat, QgsProcessingContext &context, QgsProcessingFeedback *feedback, long long featureLimit=-1)
Converts a source vector layer to a file path of a vector layer of compatible format.
static QString stringToPythonLiteral(const QString &string)
Converts a string to a Python string literal.
static QString defaultVectorExtension()
Returns the default vector extension to use, in the absence of all other constraints (e....
static QString normalizeLayerSource(const QString &source)
Normalizes a layer source string for safe comparison across different operating system environments.
static QgsFeatureSink * createFeatureSink(QString &destination, QgsProcessingContext &context, const QgsFields &fields, QgsWkbTypes::Type geometryType, const QgsCoordinateReferenceSystem &crs, const QVariantMap &createOptions=QVariantMap(), const QStringList &datasourceOptions=QStringList(), const QStringList &layerOptions=QStringList(), QgsFeatureSink::SinkFlags sinkFlags=QgsFeatureSink::SinkFlags(), QgsRemappingSinkDefinition *remappingDefinition=nullptr)
Creates a feature sink ready for adding features.
static QString encodeProviderKeyAndUri(const QString &providerKey, const QString &uri)
Encodes a provider key and layer uri to a single string, for use with decodeProviderKeyAndUri()
LayerHint
Layer type hints.
@ Annotation
Annotation layer type, since QGIS 3.22.
@ Vector
Vector layer type.
@ Mesh
Mesh layer type, since QGIS 3.6.
@ Raster
Raster layer type.
@ UnknownType
Unknown layer type.
@ PointCloud
Point cloud layer type, since QGIS 3.22.
static QString generateTempFilename(const QString &basename)
Returns a temporary filename for a given file, putting it into a temporary folder (creating that fold...
static QgsProcessingFeatureSource * variantToSource(const QVariant &value, QgsProcessingContext &context, const QVariant &fallbackValue=QVariant())
Converts a variant value to a new feature source.
static QString convertToCompatibleFormatAndLayerName(const QgsVectorLayer *layer, bool selectedFeaturesOnly, const QString &baseName, const QStringList &compatibleFormats, const QString &preferredFormat, QgsProcessingContext &context, QgsProcessingFeedback *feedback, QString &layerName, long long featureLimit=-1)
Converts a source vector layer to a file path and layer name of a vector layer of compatible format.
static QString variantToPythonLiteral(const QVariant &value)
Converts a variant to a Python literal.
static QgsCoordinateReferenceSystem variantToCrs(const QVariant &value, QgsProcessingContext &context, const QVariant &fallbackValue=QVariant())
Converts a variant value to a coordinate reference system.
static QgsMapLayer * mapLayerFromString(const QString &string, QgsProcessingContext &context, bool allowLoadingNewLayers=true, QgsProcessingUtils::LayerHint typeHint=QgsProcessingUtils::LayerHint::UnknownType)
Interprets a string as a map layer within the supplied context.
static QString defaultRasterExtension()
Returns the default raster extension to use, in the absence of all other constraints (e....
static const QString TEMPORARY_OUTPUT
Constant used to indicate that a Processing algorithm output should be a temporary layer/file.
PythonOutputType
Available Python output types.
@ PythonQgsProcessingAlgorithmSubclass
Full Python QgsProcessingAlgorithm subclass.
SourceType
Data source types enum.
@ TypePlugin
Plugin layers.
@ TypeVectorLine
Vector line layers.
@ TypeMapLayer
Any map layer type (raster, vector, mesh, point cloud, annotation or plugin layer)
@ TypeVectorPolygon
Vector polygon layers.
@ TypeFile
Files (i.e. non map layer sources, such as text files)
@ TypeAnnotation
Annotation layers.
@ TypePointCloud
Point cloud layers.
@ TypeVector
Tables (i.e. vector layers with or without geometry). When used for a sink this indicates the sink ha...
@ TypeRaster
Raster layers.
@ TypeVectorPoint
Vector point layers.
@ TypeVectorAnyGeometry
Any vector layer with geometry.
static QString sourceTypeToString(SourceType type)
Converts a source type to a string representation.
Encapsulates a QGIS project, including sets of map layers and their styles, layouts,...
QgsAnnotationLayer * mainAnnotationLayer()
Returns the main annotation layer associated with the project.
const QgsLayoutManager * layoutManager() const
Returns the project's layout manager, which manages print layouts, atlases and reports within the pro...
A store for object properties.
@ StaticProperty
Static property (QgsStaticProperty)
QString asExpression() const
Returns an expression string representing the state of the property, or an empty string if the proper...
QString valueAsString(const QgsExpressionContext &context, const QString &defaultString=QString(), bool *ok=nullptr) const
Calculates the current value of the property and interprets it as a string.
QVariant value(const QgsExpressionContext &context, const QVariant &defaultValue=QVariant(), bool *ok=nullptr) const
Calculates the current value of the property, including any transforms which are set for the property...
QVariant toVariant() const
Saves this property to a QVariantMap, wrapped in a QVariant.
bool loadVariant(const QVariant &property)
Loads this property from a QVariantMap, wrapped in a QVariant.
QVariant staticValue() const
Returns the current static value for the property.
Type propertyType() const
Returns the property type.
static QgsProviderRegistry * instance(const QString &pluginPath=QString())
Means of accessing canonical single instance.
QString fileVectorFilters() const
Returns a file filter string for supported vector files.
QString fileRasterFilters() const
Returns a file filter string for supported raster files.
QString fileMeshFilters() const
Returns a file filter string for supported mesh files.
QString filePointCloudFilters() const
Returns a file filter string for supported point clouds.
static QStringList supportedFormatExtensions(RasterFormatOptions options=SortRecommended)
Returns a list of file extensions for supported formats.
Represents a raster layer.
A rectangle specified with double values.
double yMaximum() const SIP_HOLDGIL
Returns the y maximum value (top side of rectangle).
double xMaximum() const SIP_HOLDGIL
Returns the x maximum value (right side of rectangle).
double xMinimum() const SIP_HOLDGIL
Returns the x minimum value (left side of rectangle).
double yMinimum() const SIP_HOLDGIL
Returns the y minimum value (bottom side of rectangle).
bool isNull() const
Test if the rectangle is null (all coordinates zero or after call to setMinimal()).
QgsCoordinateReferenceSystem crs() const
Returns the associated coordinate reference system, or an invalid CRS if no reference system is set.
A QgsGeometry with associated coordinate reference system.
static QgsReferencedGeometry fromReferencedPointXY(const QgsReferencedPointXY &point)
Construct a new QgsReferencedGeometry from referenced point.
static QgsReferencedGeometry fromReferencedRect(const QgsReferencedRectangle &rectangle)
Construct a new QgsReferencedGeometry from referenced rectangle.
A QgsPointXY with associated coordinate reference system.
A QgsRectangle with associated coordinate reference system.
Defines the parameters used to remap features when creating a QgsRemappingProxyFeatureSink.
static QColor parseColorWithAlpha(const QString &colorStr, bool &containsAlpha, bool strictEval=false)
Attempts to parse a string as a color using a variety of common formats, including hex codes,...
DistanceUnit
Units of distance.
@ DistanceUnknownUnit
Unknown distance unit.
TemporalUnit
Temporal units.
static QStringList supportedFormatExtensions(VectorFormatOptions options=SortRecommended)
Returns a list of file extensions for supported formats, e.g "shp", "gpkg".
Represents a vector layer which manages a vector based data sets.
GeometryType
The geometry types are used to group QgsWkbTypes::Type in a coarse way.
Type
The WKB type describes the number of dimensions a geometry has.
As part of the API refactoring and improvements which landed in the Processing API was substantially reworked from the x version This was done in order to allow much of the underlying Processing framework to be ported into c
QString qgsDoubleToString(double a, int precision=17)
Returns a string representation of a double.
QString parameterAsCompatibleSourceLayerPathInternal(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context, const QStringList &compatibleFormats, const QString &preferredFormat, QgsProcessingFeedback *feedback, QString *layerName)
QString createAllMapLayerFileFilter()
const QgsCoordinateReferenceSystem & crs