48#include <QRegularExpression>
53 map.insert( QStringLiteral(
"source" ),
source.toVariant() );
55 map.insert( QStringLiteral(
"feature_limit" ),
featureLimit );
57 map.insert( QStringLiteral(
"flags" ),
static_cast< int >(
flags ) );
58 map.insert( QStringLiteral(
"geometry_check" ),
static_cast< int >(
geometryCheck ) );
64 source.loadVariant( map.value( QStringLiteral(
"source" ) ) );
66 featureLimit = map.value( QStringLiteral(
"feature_limit" ), -1 ).toLongLong();
80 map.insert( QStringLiteral(
"source" ),
source.toVariant() );
82 map.insert( QStringLiteral(
"dpi" ),
dpi );
88 source.loadVariant( map.value( QStringLiteral(
"source" ) ) );
89 referenceScale = map.value( QStringLiteral(
"reference_scale" ), 0 ).toDouble();
90 dpi = map.value( QStringLiteral(
"dpi" ), 0 ).toInt();
101 mUseRemapping =
true;
102 mRemappingDefinition = definition;
108 map.insert( QStringLiteral(
"sink" ),
sink.toVariant() );
109 map.insert( QStringLiteral(
"create_options" ),
createOptions );
111 map.insert( QStringLiteral(
"remapping" ), QVariant::fromValue( mRemappingDefinition ) );
117 sink.loadVariant( map.value( QStringLiteral(
"sink" ) ) );
118 createOptions = map.value( QStringLiteral(
"create_options" ) ).toMap();
119 if ( map.contains( QStringLiteral(
"remapping" ) ) )
121 mUseRemapping =
true;
126 mUseRemapping =
false;
134 && mUseRemapping == other.mUseRemapping && mRemappingDefinition == other.mRemappingDefinition;
139 return !( *
this == other );
144 const QVariant val = parameters.value( name );
145 if ( val.userType() == qMetaTypeId<QgsProperty>() )
164 QVariant val = value;
165 if ( val.userType() == qMetaTypeId<QgsProperty>() )
168 if ( !val.isValid() )
177 return destParam->generateTemporaryDestination( &context );
180 return val.toString();
196 const QVariant val = value;
197 if ( val.userType() == qMetaTypeId<QgsProperty>() )
200 if ( val.isValid() && !val.toString().isEmpty() )
204 return val.toString();
224 QVariant val = value;
225 if ( val.userType() == qMetaTypeId<QgsProperty>() )
229 const double res = val.toDouble( &ok );
235 return val.toDouble();
251 QVariant val = value;
252 if ( val.userType() == qMetaTypeId<QgsProperty>() )
256 double dbl = val.toDouble( &ok );
261 dbl = val.toDouble( &ok );
268 const double round = std::round( dbl );
269 if ( round > std::numeric_limits<int>::max() || round < -std::numeric_limits<int>::max() )
274 return static_cast< int >( std::round( dbl ) );
283 return QList< int >();
291 return QList< int >();
293 QList< int > resultList;
294 const QVariant val = value;
297 if ( val.userType() == qMetaTypeId<QgsProperty>() )
299 else if ( val.userType() == QMetaType::Type::QVariantList )
301 const QVariantList list = val.toList();
302 for (
auto it = list.constBegin(); it != list.constEnd(); ++it )
303 resultList << it->toInt();
307 const QStringList parts = val.toString().split(
';' );
308 for (
auto it = parts.constBegin(); it != parts.constEnd(); ++it )
309 resultList << it->toInt();
313 if ( resultList.isEmpty() )
318 if ( definition->
defaultValue().userType() == QMetaType::Type::QVariantList )
320 const QVariantList list = definition->
defaultValue().toList();
321 for (
auto it = list.constBegin(); it != list.constEnd(); ++it )
322 resultList << it->toInt();
326 const QStringList parts = definition->
defaultValue().toString().split(
';' );
327 for (
auto it = parts.constBegin(); it != parts.constEnd(); ++it )
328 resultList << it->toInt();
349 QVariant val = value;
350 if ( val.userType() == qMetaTypeId<QgsProperty>() )
353 QDateTime d = val.toDateTime();
354 if ( !d.isValid() && val.userType() == QMetaType::Type::QString )
356 d = QDateTime::fromString( val.toString() );
363 d = val.toDateTime();
365 if ( !d.isValid() && val.userType() == QMetaType::Type::QString )
367 d = QDateTime::fromString( val.toString() );
386 QVariant val = value;
387 if ( val.userType() == qMetaTypeId<QgsProperty>() )
390 QDate d = val.toDate();
391 if ( !d.isValid() && val.userType() == QMetaType::Type::QString )
393 d = QDate::fromString( val.toString() );
402 if ( !d.isValid() && val.userType() == QMetaType::Type::QString )
404 d = QDate::fromString( val.toString() );
423 QVariant val = value;
424 if ( val.userType() == qMetaTypeId<QgsProperty>() )
429 if ( val.userType() == QMetaType::Type::QDateTime )
430 d = val.toDateTime().time();
434 if ( !d.isValid() && val.userType() == QMetaType::Type::QString )
436 d = QTime::fromString( val.toString() );
445 if ( !d.isValid() && val.userType() == QMetaType::Type::QString )
447 d = QTime::fromString( val.toString() );
468 if ( enumDef && val >= enumDef->
options().size() )
488 QVariantList resultList;
489 const QVariant val = value;
490 if ( val.userType() == qMetaTypeId<QgsProperty>() )
492 else if ( val.userType() == QMetaType::Type::QVariantList )
494 const auto constToList = val.toList();
495 for (
const QVariant &var : constToList )
498 else if ( val.userType() == QMetaType::Type::QString )
500 const auto constSplit = val.toString().split(
',' );
501 for (
const QString &var : constSplit )
507 if ( resultList.isEmpty() )
508 return QList< int >();
510 if ( ( !val.isValid() || !resultList.at( 0 ).isValid() ) && definition )
514 if ( definition->
defaultValue().userType() == QMetaType::Type::QVariantList )
516 const auto constToList = definition->
defaultValue().toList();
517 for (
const QVariant &var : constToList )
520 else if ( definition->
defaultValue().userType() == QMetaType::Type::QString )
522 const auto constSplit = definition->
defaultValue().toString().split(
',' );
523 for (
const QString &var : constSplit )
532 const auto constResultList = resultList;
533 for (
const QVariant &var : constResultList )
535 const int resInt = var.toInt();
536 if ( !enumDef || resInt < enumDef->options().size() )
560 enumText.isEmpty() || !enumDef->options().contains( enumText )
573 return QStringList();
581 return QStringList();
583 const QVariant val = value;
585 QStringList enumValues;
587 std::function< void(
const QVariant &var ) > processVariant;
588 processVariant = [ &enumValues, &context, &definition, &processVariant ](
const QVariant & var )
590 if ( var.userType() == QMetaType::Type::QVariantList )
592 const auto constToList = var.toList();
593 for (
const QVariant &listVar : constToList )
595 processVariant( listVar );
598 else if ( var.userType() == QMetaType::Type::QStringList )
600 const auto constToStringList = var.toStringList();
601 for (
const QString &s : constToStringList )
606 else if ( var.userType() == qMetaTypeId<QgsProperty>() )
610 const QStringList parts = var.toString().split(
',' );
611 for (
const QString &s : parts )
618 processVariant( val );
625 const QStringList options = enumDef->options();
626 const QSet<QString> subtraction = QSet<QString>( enumValues.begin(), enumValues.end() ).subtract( QSet<QString>( options.begin(), options.end() ) );
628 if ( enumValues.isEmpty() || !subtraction.isEmpty() )
662 const QVariant val = value;
663 if ( val.userType() == qMetaTypeId<QgsProperty>() )
665 else if ( val.isValid() )
678 const QVariant val = value;
679 if ( val.userType() == qMetaTypeId<QgsProperty>() )
681 else if ( val.isValid() )
690 const QVariantMap &createOptions,
const QStringList &datasourceOptions,
const QStringList &layerOptions )
695 val = parameters.value( definition->
name() );
698 return parameterAsSink( definition, val, fields, geometryType, crs, context, destinationIdentifier, sinkFlags, createOptions, datasourceOptions, layerOptions );
701QgsFeatureSink *
QgsProcessingParameters::parameterAsSink(
const QgsProcessingParameterDefinition *definition,
const QVariant &value,
const QgsFields &fields,
Qgis::WkbType geometryType,
const QgsCoordinateReferenceSystem &crs,
QgsProcessingContext &context, QString &destinationIdentifier,
QgsFeatureSink::SinkFlags sinkFlags,
const QVariantMap &createOptions,
const QStringList &datasourceOptions,
const QStringList &layerOptions )
703 QVariantMap options = createOptions;
704 QVariant val = value;
709 bool useRemapDefinition =
false;
710 if ( val.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
721 useRemapDefinition =
true;
727 if ( definition && val.userType() == qMetaTypeId<QgsProperty>() )
731 else if ( !val.isValid() || val.toString().isEmpty() )
747 dest = val.toString();
752 dest = destParam->generateTemporaryDestination( &context );
755 if ( dest.isEmpty() )
758 std::unique_ptr< QgsFeatureSink > sink(
QgsProcessingUtils::createFeatureSink( dest, context, fields, geometryType, crs, options, datasourceOptions, layerOptions, sinkFlags, useRemapDefinition ? &remapDefinition :
nullptr ) );
759 destinationIdentifier = dest;
761 if ( destinationProject )
763 if ( destName.isEmpty() && definition )
769 outputName = definition->
name();
773 return sink.release();
797 QVariant val = parameters.value( definition->
name() );
799 bool selectedFeaturesOnly =
false;
800 long long featureLimit = -1;
801 QString filterExpression;
802 if ( val.userType() == qMetaTypeId<QgsProcessingFeatureSourceDefinition>() )
811 else if ( val.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
818 if ( val.userType() == qMetaTypeId<QgsProperty>() )
824 vl = qobject_cast< QgsVectorLayer * >( qvariant_cast<QObject *>( val ) );
829 if ( val.userType() == qMetaTypeId<QgsProperty>() )
833 else if ( !val.isValid() || val.toString().isEmpty() )
839 vl = qobject_cast< QgsVectorLayer * >( qvariant_cast<QObject *>( val ) );
845 layerRef = val.toString();
850 if ( layerRef.isEmpty() )
862 compatibleFormats, preferredFormat, context, feedback, *layerName, featureLimit, filterExpression );
865 compatibleFormats, preferredFormat, context, feedback, featureLimit, filterExpression );
875 QString *destLayer = layerName;
890 return parameterAsLayer( definition, parameters.value( definition->
name() ), context, layerHint, flags );
898 QVariant val = value;
899 if ( val.userType() == qMetaTypeId<QgsProperty>() )
904 if (
QgsMapLayer *layer = qobject_cast< QgsMapLayer * >( qvariant_cast<QObject *>( val ) ) )
909 if ( val.userType() == qMetaTypeId<QgsProcessingRasterLayerDefinition>() )
915 if ( val.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
927 if ( !val.isValid() || val.toString().isEmpty() )
933 if (
QgsMapLayer *layer = qobject_cast< QgsMapLayer * >( qvariant_cast<QObject *>( val ) ) )
938 QString layerRef = val.toString();
939 if ( layerRef.isEmpty() )
942 if ( layerRef.isEmpty() )
973 val = parameters.value( definition->
name() );
980 QVariant val = value;
984 if ( val.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
994 if ( definition && val.userType() == qMetaTypeId<QgsProperty>() )
998 else if ( definition && ( !val.isValid() || val.toString().isEmpty() ) )
1005 dest = val.toString();
1010 dest = destParam->generateTemporaryDestination( &context );
1013 if ( destinationProject )
1016 if ( destName.isEmpty() && definition )
1021 outputName = definition->
name();
1045 val = parameters.value( definition->
name() );
1052 QVariant val = value;
1054 if ( val.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
1062 if ( definition && val.userType() == qMetaTypeId<QgsProperty>() )
1066 else if ( definition && ( !val.isValid() || val.toString().isEmpty() ) )
1073 dest = val.toString();
1078 dest = destParam->generateTemporaryDestination( &context );
1098 return parameterAsCrs( definition, parameters.value( definition->
name() ), context );
1123 QVariant val = value;
1125 if ( val.userType() == qMetaTypeId<QgsRectangle>() )
1129 if ( val.userType() == qMetaTypeId< QgsGeometry>() )
1135 if ( val.userType() == qMetaTypeId<QgsReferencedRectangle>() )
1154 if ( val.userType() == qMetaTypeId<QgsProcessingFeatureSourceDefinition>() )
1160 else if ( val.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
1173 QgsMapLayer *layer = qobject_cast< QgsMapLayer * >( qvariant_cast<QObject *>( val ) );
1176 if ( val.userType() == qMetaTypeId<QgsProperty>() )
1179 rectText = val.toString();
1181 if ( rectText.isEmpty() && !layer )
1184 const thread_local QRegularExpression rx( QStringLiteral(
"^(.*?)\\s*,\\s*(.*?),\\s*(.*?),\\s*(.*?)\\s*(?:\\[(.*)\\])?\\s*$" ) );
1185 const QRegularExpressionMatch match = rx.match( rectText );
1186 if ( match.hasMatch() )
1188 bool xMinOk =
false;
1189 const double xMin = match.captured( 1 ).toDouble( &xMinOk );
1190 bool xMaxOk =
false;
1191 const double xMax = match.captured( 2 ).toDouble( &xMaxOk );
1192 bool yMinOk =
false;
1193 const double yMin = match.captured( 3 ).toDouble( &yMinOk );
1194 bool yMaxOk =
false;
1195 const double yMax = match.captured( 4 ).toDouble( &yMaxOk );
1196 if ( xMinOk && xMaxOk && yMinOk && yMaxOk )
1247 QVariant val = parameters.value( definition->
name() );
1249 if ( val.userType() == qMetaTypeId<QgsReferencedRectangle>() )
1255 g = g.densifyByCount( 20 );
1269 if ( val.userType() == qMetaTypeId<QgsProcessingFeatureSourceDefinition>() )
1275 else if ( val.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
1288 if ( val.userType() == qMetaTypeId<QgsProperty>() )
1291 rectText = val.toString();
1293 if ( !rectText.isEmpty() )
1295 const thread_local QRegularExpression rx( QStringLiteral(
"^(.*?)\\s*,\\s*(.*?),\\s*(.*?),\\s*(.*?)\\s*(?:\\[(.*)\\])?\\s*$" ) );
1296 const QRegularExpressionMatch match = rx.match( rectText );
1297 if ( match.hasMatch() )
1299 bool xMinOk =
false;
1300 const double xMin = match.captured( 1 ).toDouble( &xMinOk );
1301 bool xMaxOk =
false;
1302 const double xMax = match.captured( 2 ).toDouble( &xMaxOk );
1303 bool yMinOk =
false;
1304 const double yMin = match.captured( 3 ).toDouble( &yMinOk );
1305 bool yMaxOk =
false;
1306 const double yMax = match.captured( 4 ).toDouble( &yMaxOk );
1307 if ( xMinOk && xMaxOk && yMinOk && yMaxOk )
1337 QgsMapLayer *layer = qobject_cast< QgsMapLayer * >( qvariant_cast<QObject *>( val ) );
1366 const QVariant val = parameters.value( definition->
name() );
1372 QVariant val = value;
1373 if ( val.userType() == qMetaTypeId<QgsReferencedRectangle>() )
1382 if ( val.userType() == qMetaTypeId<QgsProcessingFeatureSourceDefinition>() )
1388 else if ( val.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
1400 QString valueAsString;
1401 if ( val.userType() == qMetaTypeId<QgsProperty>() )
1404 valueAsString = val.toString();
1406 const thread_local QRegularExpression rx( QStringLiteral(
"^(.*?)\\s*,\\s*(.*?),\\s*(.*?),\\s*(.*?)\\s*(?:\\[(.*)\\])?\\s*$" ) );
1408 const QRegularExpressionMatch match = rx.match( valueAsString );
1409 if ( match.hasMatch() )
1416 if ( val.userType() == qMetaTypeId<QgsProcessingFeatureSourceDefinition>() )
1422 else if ( val.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
1435 if (
QgsMapLayer *layer = qobject_cast< QgsMapLayer * >( qvariant_cast<QObject *>( val ) ) )
1436 return layer->crs();
1438 return layer->crs();
1440 if (
auto *lProject = context.
project() )
1441 return lProject->crs();
1459 const QVariant val = value;
1460 if ( val.userType() == qMetaTypeId<QgsPointXY>() )
1464 if ( val.userType() == qMetaTypeId< QgsGeometry>() )
1470 if ( val.userType() == qMetaTypeId<QgsReferencedPointXY>() )
1489 if ( pointText.isEmpty() )
1492 if ( pointText.isEmpty() )
1495 const thread_local QRegularExpression rx( QStringLiteral(
"^\\s*\\(?\\s*(.*?)\\s*,\\s*(.*?)\\s*(?:\\[(.*)\\])?\\s*\\)?\\s*$" ) );
1498 const QRegularExpressionMatch match = rx.match( valueAsString );
1499 if ( match.hasMatch() )
1502 const double x = match.captured( 1 ).toDouble( &xOk );
1504 const double y = match.captured( 2 ).toDouble( &yOk );
1532 const QVariant val = parameters.value( definition->
name() );
1538 if ( value.userType() == qMetaTypeId<QgsReferencedPointXY>() )
1547 const thread_local QRegularExpression rx( QStringLiteral(
"^\\s*\\(?\\s*(.*?)\\s*,\\s*(.*?)\\s*(?:\\[(.*)\\])?\\s*\\)?\\s*$" ) );
1550 const QRegularExpressionMatch match = rx.match( valueAsString );
1551 if ( match.hasMatch() )
1558 if (
auto *lProject = context.
project() )
1559 return lProject->crs();
1577 const QVariant val = value;
1578 if ( val.userType() == qMetaTypeId< QgsGeometry>() )
1583 if ( val.userType() == qMetaTypeId<QgsPointXY>() )
1588 if ( val.userType() == qMetaTypeId<QgsRectangle>() )
1593 if ( val.userType() == qMetaTypeId<QgsReferencedPointXY>() )
1611 if ( val.userType() == qMetaTypeId<QgsReferencedRectangle>() )
1617 g = g.densifyByCount( 20 );
1631 if ( val.userType() == qMetaTypeId<QgsReferencedGeometry>() )
1650 if ( valueAsString.isEmpty() )
1653 if ( valueAsString.isEmpty() )
1656 const thread_local QRegularExpression rx( QStringLiteral(
"^\\s*(?:CRS=(.*);)?(.*?)$" ) );
1658 const QRegularExpressionMatch match = rx.match( valueAsString );
1659 if ( match.hasMatch() )
1686 const QVariant val = parameters.value( definition->
name() );
1692 if ( value.userType() == qMetaTypeId<QgsReferencedGeometry>() )
1701 if ( value.userType() == qMetaTypeId<QgsReferencedPointXY>() )
1710 if ( value.userType() == qMetaTypeId<QgsReferencedRectangle>() )
1720 const QRegularExpression rx( QStringLiteral(
"^\\s*(?:CRS=(.*);)?(.*?)$" ) );
1723 const QRegularExpressionMatch match = rx.match( valueAsString );
1724 if ( match.hasMatch() )
1731 if (
auto *lProject = context.
project() )
1732 return lProject->crs();
1743 if ( fileText.isEmpty() )
1754 if ( fileText.isEmpty() )
1762 return QVariantList();
1770 return QVariantList();
1772 QString resultString;
1773 const QVariant val = value;
1774 if ( val.userType() == qMetaTypeId<QgsProperty>() )
1776 else if ( val.userType() == QMetaType::Type::QVariantList )
1777 return val.toList();
1779 resultString = val.toString();
1781 if ( resultString.isEmpty() )
1784 if ( definition->
defaultValue().userType() == QMetaType::Type::QVariantList )
1790 QVariantList result;
1791 const auto constSplit = resultString.split(
',' );
1794 for (
const QString &s : constSplit )
1796 number = s.toDouble( &ok );
1797 result << ( ok ? QVariant( number ) : s );
1806 return QList<QgsMapLayer *>();
1814 return QList<QgsMapLayer *>();
1816 const QVariant val = value;
1817 if (
QgsMapLayer *layer = qobject_cast< QgsMapLayer * >( qvariant_cast<QObject *>( val ) ) )
1819 return QList<QgsMapLayer *>() << layer;
1822 QList<QgsMapLayer *> layers;
1824 std::function< void(
const QVariant &var ) > processVariant;
1825 processVariant = [ &layers, &context, &definition, flags, &processVariant](
const QVariant & var )
1827 if ( var.userType() == QMetaType::Type::QVariantList )
1829 const auto constToList = var.toList();
1830 for (
const QVariant &listVar : constToList )
1832 processVariant( listVar );
1835 else if ( var.userType() == QMetaType::Type::QStringList )
1837 const auto constToStringList = var.toStringList();
1838 for (
const QString &s : constToStringList )
1840 processVariant( s );
1843 else if ( var.userType() == qMetaTypeId<QgsProperty>() )
1845 else if ( var.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
1849 const QVariant sink = fromVar.
sink;
1850 if ( sink.userType() == qMetaTypeId<QgsProperty>() )
1855 else if (
QgsMapLayer *layer = qobject_cast< QgsMapLayer * >( qvariant_cast<QObject *>( var ) ) )
1867 processVariant( val );
1869 if ( layers.isEmpty() )
1872 if (
QgsMapLayer *layer = qobject_cast< QgsMapLayer * >( qvariant_cast<QObject *>( definition->
defaultValue() ) ) )
1876 else if ( definition->
defaultValue().userType() == QMetaType::Type::QVariantList )
1878 const auto constToList = definition->
defaultValue().toList();
1879 for (
const QVariant &var : constToList )
1881 if (
QgsMapLayer *layer = qobject_cast< QgsMapLayer * >( qvariant_cast<QObject *>( var ) ) )
1887 processVariant( var );
1901 return QStringList();
1903 const QVariant val = value;
1907 std::function< void(
const QVariant &var ) > processVariant;
1908 processVariant = [ &files, &context, &definition, &processVariant ](
const QVariant & var )
1910 if ( var.userType() == QMetaType::Type::QVariantList )
1912 const auto constToList = var.toList();
1913 for (
const QVariant &listVar : constToList )
1915 processVariant( listVar );
1918 else if ( var.userType() == QMetaType::Type::QStringList )
1920 const auto constToStringList = var.toStringList();
1921 for (
const QString &s : constToStringList )
1923 processVariant( s );
1926 else if ( var.userType() == qMetaTypeId<QgsProperty>() )
1930 files << var.toString();
1934 processVariant( val );
1936 if ( files.isEmpty() )
1947 return QStringList();
1955 return QList<double>();
1963 return QList<double>();
1965 QStringList resultStringList;
1966 const QVariant val = value;
1968 if ( val.userType() == qMetaTypeId<QgsProperty>() )
1970 else if ( val.userType() == QMetaType::Type::QVariantList )
1972 const auto constToList = val.toList();
1973 for (
const QVariant &var : constToList )
1974 resultStringList << var.toString();
1977 resultStringList << val.toString();
1979 if ( ( resultStringList.isEmpty() || ( resultStringList.size() == 1 && resultStringList.at( 0 ).isEmpty() ) ) )
1981 resultStringList.clear();
1983 if ( definition->
defaultValue().userType() == QMetaType::Type::QVariantList )
1985 const auto constToList = definition->
defaultValue().toList();
1986 for (
const QVariant &var : constToList )
1987 resultStringList << var.toString();
1990 resultStringList << definition->
defaultValue().toString();
1993 if ( resultStringList.size() == 1 )
1995 resultStringList = resultStringList.at( 0 ).split(
',' );
1998 if ( resultStringList.size() < 2 )
1999 return QList< double >() << std::numeric_limits<double>::quiet_NaN() << std::numeric_limits<double>::quiet_NaN() ;
2001 QList< double > result;
2003 double n = resultStringList.at( 0 ).toDouble( &ok );
2007 result << std::numeric_limits<double>::quiet_NaN() ;
2009 n = resultStringList.at( 1 ).toDouble( &ok );
2013 result << std::numeric_limits<double>::quiet_NaN() ;
2021 return QStringList();
2034 return QStringList();
2042 return QStringList();
2044 QStringList resultStringList;
2045 const QVariant val = value;
2046 if ( val.isValid() )
2048 if ( val.userType() == qMetaTypeId<QgsProperty>() )
2050 else if ( val.userType() == QMetaType::Type::QVariantList )
2052 const auto constToList = val.toList();
2053 for (
const QVariant &var : constToList )
2054 resultStringList << var.toString();
2056 else if ( val.userType() == QMetaType::Type::QStringList )
2058 resultStringList = val.toStringList();
2061 resultStringList.append( val.toString().split(
';' ) );
2064 if ( ( resultStringList.isEmpty() || resultStringList.at( 0 ).isEmpty() ) )
2066 resultStringList.clear();
2070 if ( definition->
defaultValue().userType() == QMetaType::Type::QVariantList )
2072 const auto constToList = definition->
defaultValue().toList();
2073 for (
const QVariant &var : constToList )
2074 resultStringList << var.toString();
2076 else if ( definition->
defaultValue().userType() == QMetaType::Type::QStringList )
2078 resultStringList = definition->
defaultValue().toStringList();
2081 resultStringList.append( definition->
defaultValue().toString().split(
';' ) );
2085 return resultStringList;
2099 if ( layoutName.isEmpty() )
2151 QVariant val = value;
2152 if ( val.userType() == qMetaTypeId<QgsProperty>() )
2156 if ( val.userType() == QMetaType::Type::QColor )
2158 QColor
c = val.value< QColor >();
2160 if ( !colorParam->opacityEnabled() )
2168 if ( definition->
defaultValue().userType() == QMetaType::Type::QColor )
2174 if ( colorText.isEmpty() )
2177 bool containsAlpha =
false;
2180 if (
c.isValid() && !colorParam->opacityEnabled() )
2252 const QString type = map.value( QStringLiteral(
"parameter_type" ) ).toString();
2253 const QString name = map.value( QStringLiteral(
"name" ) ).toString();
2254 std::unique_ptr< QgsProcessingParameterDefinition > def;
2260 def = std::make_unique<QgsProcessingParameterBoolean>( name );
2262 def = std::make_unique<QgsProcessingParameterCrs>( name );
2264 def = std::make_unique<QgsProcessingParameterMapLayer>( name );
2266 def = std::make_unique<QgsProcessingParameterExtent>( name );
2268 def = std::make_unique<QgsProcessingParameterPoint>( name );
2270 def = std::make_unique<QgsProcessingParameterFile>( name );
2272 def = std::make_unique<QgsProcessingParameterMatrix>( name );
2274 def = std::make_unique<QgsProcessingParameterMultipleLayers>( name );
2276 def = std::make_unique<QgsProcessingParameterNumber>( name );
2278 def = std::make_unique<QgsProcessingParameterRange>( name );
2280 def = std::make_unique<QgsProcessingParameterRasterLayer>( name );
2282 def = std::make_unique<QgsProcessingParameterEnum>( name );
2284 def = std::make_unique<QgsProcessingParameterString>( name );
2286 def = std::make_unique<QgsProcessingParameterAuthConfig>( name );
2288 def = std::make_unique<QgsProcessingParameterExpression>( name );
2290 def = std::make_unique<QgsProcessingParameterVectorLayer>( name );
2292 def = std::make_unique<QgsProcessingParameterField>( name );
2294 def = std::make_unique<QgsProcessingParameterFeatureSource>( name );
2296 def = std::make_unique<QgsProcessingParameterFeatureSink>( name );
2298 def = std::make_unique<QgsProcessingParameterVectorDestination>( name );
2300 def = std::make_unique<QgsProcessingParameterRasterDestination>( name );
2302 def = std::make_unique<QgsProcessingParameterPointCloudDestination>( name );
2304 def = std::make_unique<QgsProcessingParameterFileDestination>( name );
2306 def = std::make_unique<QgsProcessingParameterFolderDestination>( name );
2308 def = std::make_unique<QgsProcessingParameterBand>( name );
2310 def = std::make_unique<QgsProcessingParameterMeshLayer>( name );
2312 def = std::make_unique<QgsProcessingParameterLayout>( name );
2314 def = std::make_unique<QgsProcessingParameterLayoutItem>( name );
2316 def = std::make_unique<QgsProcessingParameterColor>( name );
2318 def = std::make_unique<QgsProcessingParameterCoordinateOperation>( name );
2320 def = std::make_unique<QgsProcessingParameterPointCloudLayer>( name );
2322 def = std::make_unique<QgsProcessingParameterAnnotationLayer>( name );
2324 def = std::make_unique<QgsProcessingParameterPointCloudAttribute>( name );
2326 def = std::make_unique<QgsProcessingParameterVectorTileDestination>( name );
2331 def.reset( paramType->
create( name ) );
2337 def->fromVariantMap( map );
2338 return def.release();
2343 QString desc = name;
2344 desc.replace(
'_',
' ' );
2350 bool isOptional =
false;
2354 if ( !parseScriptCodeParameterOptions( code, isOptional, name, type, definition ) )
2359 if ( type == QLatin1String(
"boolean" ) )
2361 else if ( type == QLatin1String(
"crs" ) )
2363 else if ( type == QLatin1String(
"layer" ) )
2365 else if ( type == QLatin1String(
"extent" ) )
2367 else if ( type == QLatin1String(
"point" ) )
2369 else if ( type == QLatin1String(
"geometry" ) )
2371 else if ( type == QLatin1String(
"file" ) )
2373 else if ( type == QLatin1String(
"folder" ) )
2375 else if ( type == QLatin1String(
"matrix" ) )
2377 else if ( type == QLatin1String(
"multiple" ) )
2379 else if ( type == QLatin1String(
"number" ) )
2381 else if ( type == QLatin1String(
"distance" ) )
2383 else if ( type == QLatin1String(
"area" ) )
2385 else if ( type == QLatin1String(
"volume" ) )
2387 else if ( type == QLatin1String(
"duration" ) )
2389 else if ( type == QLatin1String(
"scale" ) )
2391 else if ( type == QLatin1String(
"range" ) )
2393 else if ( type == QLatin1String(
"raster" ) )
2395 else if ( type == QLatin1String(
"enum" ) )
2397 else if ( type == QLatin1String(
"string" ) )
2399 else if ( type == QLatin1String(
"authcfg" ) )
2401 else if ( type == QLatin1String(
"expression" ) )
2403 else if ( type == QLatin1String(
"field" ) )
2405 else if ( type == QLatin1String(
"vector" ) )
2407 else if ( type == QLatin1String(
"source" ) )
2409 else if ( type == QLatin1String(
"sink" ) )
2411 else if ( type == QLatin1String(
"vectordestination" ) )
2413 else if ( type == QLatin1String(
"rasterdestination" ) )
2415 else if ( type == QLatin1String(
"pointclouddestination" ) )
2417 else if ( type == QLatin1String(
"filedestination" ) )
2419 else if ( type == QLatin1String(
"folderdestination" ) )
2421 else if ( type == QLatin1String(
"band" ) )
2423 else if ( type == QLatin1String(
"mesh" ) )
2425 else if ( type == QLatin1String(
"layout" ) )
2427 else if ( type == QLatin1String(
"layoutitem" ) )
2429 else if ( type == QLatin1String(
"color" ) )
2431 else if ( type == QLatin1String(
"coordinateoperation" ) )
2433 else if ( type == QLatin1String(
"maptheme" ) )
2435 else if ( type == QLatin1String(
"datetime" ) )
2437 else if ( type == QLatin1String(
"providerconnection" ) )
2439 else if ( type == QLatin1String(
"databaseschema" ) )
2441 else if ( type == QLatin1String(
"databasetable" ) )
2443 else if ( type == QLatin1String(
"pointcloud" ) )
2445 else if ( type == QLatin1String(
"annotation" ) )
2447 else if ( type == QLatin1String(
"attribute" ) )
2449 else if ( type == QLatin1String(
"vectortiledestination" ) )
2455bool QgsProcessingParameters::parseScriptCodeParameterOptions(
const QString &code,
bool &isOptional, QString &name, QString &type, QString &definition )
2457 const thread_local QRegularExpression re( QStringLiteral(
"(?:#*)(.*?)=\\s*(.*)" ) );
2458 QRegularExpressionMatch m = re.match( code );
2459 if ( !m.hasMatch() )
2462 name = m.captured( 1 );
2463 QString tokens = m.captured( 2 );
2464 if ( tokens.startsWith( QLatin1String(
"optional" ), Qt::CaseInsensitive ) )
2467 tokens.remove( 0, 8 );
2474 tokens = tokens.trimmed();
2476 const thread_local QRegularExpression re2( QStringLiteral(
"(.*?)\\s+(.*)" ) );
2477 m = re2.match( tokens );
2478 if ( !m.hasMatch() )
2480 type = tokens.toLower().trimmed();
2485 type = m.captured( 1 ).toLower().trimmed();
2486 definition = m.captured( 2 );
2500 ,
mFlags( optional ?
Qgis::ProcessingParameterFlag::Optional :
Qgis::ProcessingParameterFlag() )
2506 if ( defaultSettingsValue.isValid() )
2508 return defaultSettingsValue;
2516 if ( defaultSettingsValue.isValid() )
2518 return defaultSettingsValue;
2528 QVariant settingValue = s.
value( QStringLiteral(
"/Processing/DefaultGuiParam/%1/%2" ).arg(
mAlgorithm->id() ).arg(
mName ) );
2529 if ( settingValue.isValid() )
2531 return settingValue;
2539 if ( !input.isValid() && !
mDefault.isValid() )
2542 if ( ( input.userType() == QMetaType::Type::QString && input.toString().isEmpty() )
2543 || ( !input.isValid() &&
mDefault.userType() == QMetaType::Type::QString &&
mDefault.toString().isEmpty() ) )
2551 if ( !value.isValid() )
2552 return QStringLiteral(
"None" );
2554 if ( value.userType() == qMetaTypeId<QgsProperty>() )
2555 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( value.value<
QgsProperty >().
asExpression() );
2567 if ( !value.isValid() )
2571 if ( value.userType() == QMetaType::Type::QVariantMap )
2573 const QVariantMap sourceMap = value.toMap();
2574 QVariantMap resultMap;
2575 for (
auto it = sourceMap.constBegin(); it != sourceMap.constEnd(); it++ )
2581 else if ( value.userType() == QMetaType::Type::QVariantList || value.userType() == QMetaType::Type::QStringList )
2583 const QVariantList sourceList = value.toList();
2584 QVariantList resultList;
2585 resultList.reserve( sourceList.size() );
2586 for (
const QVariant &v : sourceList )
2594 switch ( value.userType() )
2597 case QMetaType::Bool:
2598 case QMetaType::Char:
2599 case QMetaType::Int:
2600 case QMetaType::Double:
2601 case QMetaType::Float:
2602 case QMetaType::LongLong:
2603 case QMetaType::ULongLong:
2604 case QMetaType::UInt:
2605 case QMetaType::ULong:
2606 case QMetaType::UShort:
2613 if ( value.userType() == qMetaTypeId<QgsProperty>() )
2623 return QVariantMap( {{QStringLiteral(
"type" ), QStringLiteral(
"data_defined" )}, {QStringLiteral(
"field" ), prop.
field() }} );
2625 return QVariantMap( {{QStringLiteral(
"type" ), QStringLiteral(
"data_defined" )}, {QStringLiteral(
"expression" ), prop.
expressionString() }} );
2630 if ( value.userType() == qMetaTypeId<QgsCoordinateReferenceSystem>() )
2635 else if ( !crs.
authid().isEmpty() )
2640 else if ( value.userType() == qMetaTypeId<QgsRectangle>() )
2648 else if ( value.userType() == qMetaTypeId<QgsReferencedRectangle>() )
2657 else if ( value.userType() == qMetaTypeId< QgsGeometry>() )
2669 else if ( value.userType() == qMetaTypeId<QgsReferencedGeometry>() )
2684 else if ( value.userType() == qMetaTypeId<QgsPointXY>() )
2690 else if ( value.userType() == qMetaTypeId<QgsReferencedPointXY>() )
2697 else if ( value.userType() == qMetaTypeId<QgsProcessingFeatureSourceDefinition>() )
2704 else if ( value.userType() == qMetaTypeId<QgsProcessingRasterLayerDefinition>() )
2711 else if ( value.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
2716 else if ( value.userType() == qMetaTypeId<QColor>() )
2718 const QColor fromVar = value.value< QColor >();
2719 if ( !fromVar.isValid() )
2722 return QStringLiteral(
"rgba( %1, %2, %3, %4 )" ).arg( fromVar.red() ).arg( fromVar.green() ).arg( fromVar.blue() ).arg( QString::number( fromVar.alphaF(),
'f', 2 ) );
2724 else if ( value.userType() == qMetaTypeId<QDateTime>() )
2726 const QDateTime fromVar = value.toDateTime();
2727 if ( !fromVar.isValid() )
2730 return fromVar.toString( Qt::ISODate );
2732 else if ( value.userType() == qMetaTypeId<QDate>() )
2734 const QDate fromVar = value.toDate();
2735 if ( !fromVar.isValid() )
2738 return fromVar.toString( Qt::ISODate );
2740 else if ( value.userType() == qMetaTypeId<QTime>() )
2742 const QTime fromVar = value.toTime();
2743 if ( !fromVar.isValid() )
2746 return fromVar.toString( Qt::ISODate );
2753 p.insert(
name(), value );
2761 if ( value.userType() == QMetaType::QString )
2766 Q_ASSERT_X(
false,
"QgsProcessingParameterDefinition::valueAsJsonObject", QStringLiteral(
"unsupported variant type %1" ).arg( QMetaType::typeName( value.userType() ) ).toLocal8Bit() );
2779 if ( !value.isValid() )
2782 switch ( value.userType() )
2785 case QMetaType::Bool:
2786 case QMetaType::Char:
2787 case QMetaType::Int:
2788 case QMetaType::Double:
2789 case QMetaType::Float:
2790 case QMetaType::LongLong:
2791 case QMetaType::ULongLong:
2792 case QMetaType::UInt:
2793 case QMetaType::ULong:
2794 case QMetaType::UShort:
2795 return value.toString();
2801 if ( value.userType() == qMetaTypeId<QgsProperty>() )
2811 return QStringLiteral(
"field:%1" ).arg( prop.
field() );
2818 if ( value.userType() == qMetaTypeId<QgsCoordinateReferenceSystem>() )
2823 else if ( !crs.
authid().isEmpty() )
2828 else if ( value.userType() == qMetaTypeId<QgsRectangle>() )
2836 else if ( value.userType() == qMetaTypeId<QgsReferencedRectangle>() )
2844 else if ( value.userType() == qMetaTypeId< QgsGeometry>() )
2856 else if ( value.userType() == qMetaTypeId<QgsReferencedGeometry>() )
2871 else if ( value.userType() == qMetaTypeId<QgsPointXY>() )
2877 else if ( value.userType() == qMetaTypeId<QgsReferencedPointXY>() )
2884 else if ( value.userType() == qMetaTypeId<QgsProcessingFeatureSourceDefinition>() )
2889 else if ( value.userType() == qMetaTypeId<QgsProcessingRasterLayerDefinition>() )
2894 else if ( value.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
2899 else if ( value.userType() == qMetaTypeId<QColor>() )
2901 const QColor fromVar = value.value< QColor >();
2902 if ( !fromVar.isValid() )
2905 return QStringLiteral(
"rgba( %1, %2, %3, %4 )" ).arg( fromVar.red() ).arg( fromVar.green() ).arg( fromVar.blue() ).arg( QString::number( fromVar.alphaF(),
'f', 2 ) );
2907 else if ( value.userType() == qMetaTypeId<QDateTime>() )
2909 const QDateTime fromVar = value.toDateTime();
2910 if ( !fromVar.isValid() )
2913 return fromVar.toString( Qt::ISODate );
2915 else if ( value.userType() == qMetaTypeId<QDate>() )
2917 const QDate fromVar = value.toDate();
2918 if ( !fromVar.isValid() )
2921 return fromVar.toString( Qt::ISODate );
2923 else if ( value.userType() == qMetaTypeId<QTime>() )
2925 const QTime fromVar = value.toTime();
2926 if ( !fromVar.isValid() )
2929 return fromVar.toString( Qt::ISODate );
2936 p.insert(
name(), value );
2944 if ( value.userType() == QMetaType::QString )
2945 return value.toString();
2948 QgsDebugError( QStringLiteral(
"unsupported variant type %1" ).arg( QMetaType::typeName( value.userType() ) ) );
2950 return value.toString();
2956 if ( !value.isValid( ) )
2957 return QStringList();
2959 if ( value.userType() == QMetaType::Type::QVariantList || value.userType() == QMetaType::Type::QStringList )
2961 const QVariantList sourceList = value.toList();
2962 QStringList resultList;
2963 resultList.reserve( sourceList.size() );
2964 for (
const QVariant &v : sourceList )
2973 return QStringList();
2985 QString code = QStringLiteral(
"##%1=" ).arg(
mName );
2987 code += QLatin1String(
"optional " );
2988 code +=
type() +
' ';
2990 return code.trimmed();
2998 switch ( outputType )
3002 QString code = t->className() + QStringLiteral(
"('%1', %2" )
3005 code += QLatin1String(
", optional=True" );
3021 map.insert( QStringLiteral(
"parameter_type" ),
type() );
3022 map.insert( QStringLiteral(
"name" ),
mName );
3023 map.insert( QStringLiteral(
"description" ),
mDescription );
3024 map.insert( QStringLiteral(
"help" ),
mHelp );
3025 map.insert( QStringLiteral(
"default" ),
mDefault );
3026 map.insert( QStringLiteral(
"defaultGui" ),
mGuiDefault );
3027 map.insert( QStringLiteral(
"flags" ),
static_cast< int >(
mFlags ) );
3028 map.insert( QStringLiteral(
"metadata" ),
mMetadata );
3034 mName = map.value( QStringLiteral(
"name" ) ).toString();
3035 mDescription = map.value( QStringLiteral(
"description" ) ).toString();
3036 mHelp = map.value( QStringLiteral(
"help" ) ).toString();
3037 mDefault = map.value( QStringLiteral(
"default" ) );
3038 mGuiDefault = map.value( QStringLiteral(
"defaultGui" ) );
3040 mMetadata = map.value( QStringLiteral(
"metadata" ) ).toMap();
3056 QString text = QStringLiteral(
"<p><b>%1</b></p>" ).arg(
description() );
3057 if ( !
help().isEmpty() )
3059 text += QStringLiteral(
"<p>%1</p>" ).arg(
help() );
3061 text += QStringLiteral(
"<p>%1</p>" ).arg( QObject::tr(
"Python identifier: ‘%1’" ).arg( QStringLiteral(
"<i>%1</i>" ).arg(
name() ) ) );
3090 if ( value.userType() == qMetaTypeId<QgsPointXY>() )
3097 else if ( value.userType() == qMetaTypeId<QgsReferencedPointXY>() )
3100 return QStringLiteral(
"%1, %2 [%3]" ).arg(
3107 else if ( value.userType() == qMetaTypeId<QgsRectangle>() )
3113 else if ( value.userType() == qMetaTypeId<QgsReferencedRectangle>() )
3124 else if ( value.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
3137 return value.toString();
3143 if ( !val.isValid() )
3144 return QStringLiteral(
"None" );
3146 if ( val.userType() == qMetaTypeId<QgsProperty>() )
3148 return val.toBool() ? QStringLiteral(
"True" ) : QStringLiteral(
"False" );
3153 QString code = QStringLiteral(
"##%1=" ).arg(
mName );
3155 code += QLatin1String(
"optional " );
3156 code +=
type() +
' ';
3157 code +=
mDefault.toBool() ? QStringLiteral(
"true" ) : QStringLiteral(
"false" );
3158 return code.trimmed();
3180 if ( !input.isValid() )
3188 if ( input.userType() == qMetaTypeId<QgsCoordinateReferenceSystem>() )
3192 else if ( input.userType() == qMetaTypeId<QgsProcessingFeatureSourceDefinition>() )
3196 else if ( input.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
3201 if ( input.userType() == qMetaTypeId<QgsProperty>() )
3206 if ( input.type() == QVariant::String )
3208 const QString
string = input.toString();
3209 if (
string.compare( QLatin1String(
"ProjectCrs" ), Qt::CaseInsensitive ) == 0 )
3218 if ( qobject_cast< QgsMapLayer * >( qvariant_cast<QObject *>( input ) ) )
3221 if ( input.userType() != QMetaType::Type::QString || input.toString().isEmpty() )
3229 if ( !value.isValid() )
3230 return QStringLiteral(
"None" );
3232 if ( value.userType() == qMetaTypeId<QgsCoordinateReferenceSystem>() )
3235 return QStringLiteral(
"QgsCoordinateReferenceSystem()" );
3240 if ( value.userType() == qMetaTypeId<QgsProperty>() )
3241 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( value.value<
QgsProperty >().
asExpression() );
3243 if ( value.type() == QVariant::String )
3245 const QString
string = value.toString();
3246 if (
string.compare( QLatin1String(
"ProjectCrs" ), Qt::CaseInsensitive ) == 0 )
3255 p.insert(
name(), value );
3265 if ( value.type() == QVariant::String )
3267 const QString
string = value.toString();
3268 if (
string.compare( QLatin1String(
"ProjectCrs" ), Qt::CaseInsensitive ) == 0 )
3281 if ( value.type() == QVariant::String )
3283 const QString
string = value.toString();
3284 if (
string.compare( QLatin1String(
"ProjectCrs" ), Qt::CaseInsensitive ) == 0 )
3310 return QObject::tr(
"Invalid CRS" );
3331 if ( !input.isValid() )
3339 if ( input.userType() == qMetaTypeId<QgsProperty>() )
3344 if ( qobject_cast< QgsMapLayer * >( qvariant_cast<QObject *>( input ) ) )
3349 if ( input.userType() != QMetaType::Type::QString || input.toString().isEmpty() )
3367 if ( !val.isValid() )
3368 return QStringLiteral(
"None" );
3370 if ( val.userType() == qMetaTypeId<QgsProperty>() )
3374 p.insert(
name(), val );
3394 for (
const QString &raster : rasters )
3396 if ( !vectors.contains( raster ) )
3400 for (
const QString &mesh : meshFilters )
3402 if ( !vectors.contains( mesh ) )
3406 for (
const QString &pointCloud : pointCloudFilters )
3408 if ( !vectors.contains( pointCloud ) )
3409 vectors << pointCloud;
3411 vectors.removeAll( QObject::tr(
"All files (*.*)" ) );
3412 std::sort( vectors.begin(), vectors.end() );
3414 return QObject::tr(
"All files (*.*)" ) + QStringLiteral(
";;" ) + vectors.join( QLatin1String(
";;" ) );
3424 QString code = QStringLiteral(
"##%1=" ).arg(
mName );
3426 code += QLatin1String(
"optional " );
3427 code += QLatin1String(
"layer " );
3434 code += QLatin1String(
"table " );
3438 code += QLatin1String(
"hasgeometry " );
3442 code += QLatin1String(
"point " );
3446 code += QLatin1String(
"line " );
3450 code += QLatin1String(
"polygon " );
3454 code += QLatin1String(
"raster " );
3458 code += QLatin1String(
"mesh " );
3462 code += QLatin1String(
"plugin " );
3466 code += QLatin1String(
"pointcloud " );
3470 code += QLatin1String(
"annotation " );
3474 code += QLatin1String(
"vectortile " );
3478 code += QLatin1String(
"tiledscene " );
3487 return code.trimmed();
3493 QString def = definition;
3496 if ( def.startsWith( QLatin1String(
"table" ), Qt::CaseInsensitive ) )
3502 if ( def.startsWith( QLatin1String(
"hasgeometry" ), Qt::CaseInsensitive ) )
3505 def = def.mid( 12 );
3508 else if ( def.startsWith( QLatin1String(
"point" ), Qt::CaseInsensitive ) )
3514 else if ( def.startsWith( QLatin1String(
"line" ), Qt::CaseInsensitive ) )
3520 else if ( def.startsWith( QLatin1String(
"polygon" ), Qt::CaseInsensitive ) )
3526 else if ( def.startsWith( QLatin1String(
"raster" ), Qt::CaseInsensitive ) )
3532 else if ( def.startsWith( QLatin1String(
"mesh" ), Qt::CaseInsensitive ) )
3538 else if ( def.startsWith( QLatin1String(
"plugin" ), Qt::CaseInsensitive ) )
3544 else if ( def.startsWith( QLatin1String(
"pointcloud" ), Qt::CaseInsensitive ) )
3547 def = def.mid( 11 );
3550 else if ( def.startsWith( QLatin1String(
"annotation" ), Qt::CaseInsensitive ) )
3553 def = def.mid( 11 );
3556 else if ( def.startsWith( QLatin1String(
"vectortile" ), Qt::CaseInsensitive ) )
3559 def = def.mid( 11 );
3562 else if ( def.startsWith( QLatin1String(
"tiledscene" ), Qt::CaseInsensitive ) )
3565 def = def.mid( 11 );
3576 switch ( outputType )
3580 QString code = QStringLiteral(
"QgsProcessingParameterMapLayer('%1', %2" )
3583 code += QLatin1String(
", optional=True" );
3590 QStringList options;
3594 code += QStringLiteral(
", types=[%1])" ).arg( options.join(
',' ) );
3598 code += QLatin1Char(
')' );
3615 map.insert( QStringLiteral(
"data_types" ), types );
3623 const QVariantList values = map.value( QStringLiteral(
"data_types" ) ).toList();
3624 for (
const QVariant &val : values )
3645 if ( !input.isValid() )
3653 if ( input.userType() == qMetaTypeId<QgsProcessingFeatureSourceDefinition>() )
3657 else if ( input.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
3662 if ( input.userType() == qMetaTypeId<QgsProperty>() )
3667 if ( input.userType() == qMetaTypeId<QgsRectangle>() )
3672 if ( input.userType() == qMetaTypeId< QgsGeometry>() )
3676 if ( input.userType() == qMetaTypeId<QgsReferencedRectangle>() )
3683 if ( qobject_cast< QgsMapLayer * >( qvariant_cast<QObject *>( input ) ) )
3686 if ( input.userType() != QMetaType::Type::QString || input.toString().isEmpty() )
3689 if ( variantIsValidStringForExtent( input ) )
3702bool QgsProcessingParameterExtent::variantIsValidStringForExtent(
const QVariant &value )
3704 if ( value.userType() == QMetaType::Type::QString )
3706 const thread_local QRegularExpression rx( QStringLiteral(
"^(.*?)\\s*,\\s*(.*?)\\s*,\\s*(.*?)\\s*,\\s*(.*?)\\s*(?:\\[(.*)\\])?\\s*$" ) );
3707 const QRegularExpressionMatch match = rx.match( value.toString() );
3708 if ( match.hasMatch() )
3710 bool xMinOk =
false;
3711 ( void )match.captured( 1 ).toDouble( &xMinOk );
3712 bool xMaxOk =
false;
3713 ( void )match.captured( 2 ).toDouble( &xMaxOk );
3714 bool yMinOk =
false;
3715 ( void )match.captured( 3 ).toDouble( &yMinOk );
3716 bool yMaxOk =
false;
3717 ( void )match.captured( 4 ).toDouble( &yMaxOk );
3718 if ( xMinOk && xMaxOk && yMinOk && yMaxOk )
3727 if ( !value.isValid() )
3728 return QStringLiteral(
"None" );
3730 if ( value.userType() == qMetaTypeId<QgsProperty>() )
3731 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( value.value<
QgsProperty >().
asExpression() );
3733 if ( value.userType() == qMetaTypeId<QgsRectangle>() )
3741 else if ( value.userType() == qMetaTypeId<QgsReferencedRectangle>() )
3750 else if ( value.userType() == qMetaTypeId< QgsGeometry>() )
3755 const QString wkt = g.
asWkt();
3756 return QStringLiteral(
"QgsGeometry.fromWkt('%1')" ).arg( wkt );
3759 else if ( variantIsValidStringForExtent( value ) )
3765 p.insert(
name(), value );
3775 if ( variantIsValidStringForExtent( value ) )
3777 return value.toString();
3785 if ( variantIsValidStringForExtent( value ) )
3812 if ( !input.isValid() )
3820 if ( input.userType() == qMetaTypeId<QgsProperty>() )
3825 if ( input.userType() == qMetaTypeId<QgsPointXY>() )
3829 if ( input.userType() == qMetaTypeId<QgsReferencedPointXY>() )
3833 if ( input.userType() == qMetaTypeId< QgsGeometry>() )
3838 if ( input.userType() == QMetaType::Type::QString )
3840 if ( input.toString().isEmpty() )
3844 const thread_local QRegularExpression rx( QStringLiteral(
"^\\s*\\(?\\s*(.*?)\\s*,\\s*(.*?)\\s*(?:\\[(.*)\\])?\\s*\\)?\\s*$" ) );
3846 const QRegularExpressionMatch match = rx.match( input.toString() );
3847 if ( match.hasMatch() )
3850 ( void )match.captured( 1 ).toDouble( &xOk );
3852 ( void )match.captured( 2 ).toDouble( &yOk );
3861 if ( !value.isValid() )
3862 return QStringLiteral(
"None" );
3864 if ( value.userType() == qMetaTypeId<QgsProperty>() )
3865 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( value.value<
QgsProperty >().
asExpression() );
3867 if ( value.userType() == qMetaTypeId<QgsPointXY>() )
3873 else if ( value.userType() == qMetaTypeId<QgsReferencedPointXY>() )
3880 else if ( value.userType() == qMetaTypeId< QgsGeometry>() )
3885 const QString wkt = g.
asWkt();
3886 return QStringLiteral(
"QgsGeometry.fromWkt('%1')" ).arg( wkt );
3916 if ( !input.isValid() )
3924 if ( input.userType() == qMetaTypeId<QgsProperty>() )
3931 if ( input.userType() == qMetaTypeId< QgsGeometry>() )
3933 return ( anyTypeAllowed || mGeomTypes.contains(
static_cast< int >( input.value<
QgsGeometry>().
type() ) ) ) &&
3937 if ( input.userType() == qMetaTypeId<QgsReferencedGeometry>() )
3943 if ( input.userType() == qMetaTypeId<QgsPointXY>() )
3948 if ( input.userType() == qMetaTypeId<QgsRectangle>() )
3953 if ( input.userType() == qMetaTypeId<QgsReferencedPointXY>() )
3958 if ( input.userType() == qMetaTypeId<QgsReferencedRectangle>() )
3963 if ( input.userType() == QMetaType::Type::QString )
3965 if ( input.toString().isEmpty() )
3970 const thread_local QRegularExpression rx( QStringLiteral(
"^\\s*(?:CRS=(.*);)?(.*?)$" ) );
3972 const QRegularExpressionMatch match = rx.match( input.toString() );
3973 if ( match.hasMatch() )
3978 return ( anyTypeAllowed || mGeomTypes.contains(
static_cast< int >( g.
type() ) ) ) && ( mAllowMultipart || !g.
isMultipart() );
3992 if ( !crs.isValid() )
3998 if ( !value.isValid() )
3999 return QStringLiteral(
"None" );
4001 if ( value.userType() == qMetaTypeId<QgsProperty>() )
4004 if ( value.userType() == qMetaTypeId< QgsGeometry>() )
4011 if ( value.userType() == qMetaTypeId<QgsReferencedGeometry>() )
4018 if ( value.userType() == qMetaTypeId<QgsPointXY>() )
4025 if ( value.userType() == qMetaTypeId<QgsReferencedPointXY>() )
4032 if ( value.userType() == qMetaTypeId<QgsRectangle>() )
4039 if ( value.userType() == qMetaTypeId<QgsReferencedRectangle>() )
4051 QString code = QStringLiteral(
"##%1=" ).arg(
mName );
4053 code += QLatin1String(
"optional " );
4054 code +=
type() +
' ';
4056 for (
const int type : mGeomTypes )
4061 code += QLatin1String(
"point " );
4065 code += QLatin1String(
"line " );
4069 code += QLatin1String(
"polygon " );
4073 code += QLatin1String(
"unknown " );
4079 return code.trimmed();
4084 switch ( outputType )
4088 QString code = QStringLiteral(
"QgsProcessingParameterGeometry('%1', %2" )
4091 code += QLatin1String(
", optional=True" );
4093 if ( !mGeomTypes.empty() )
4100 return QStringLiteral(
"PointGeometry" );
4103 return QStringLiteral(
"LineGeometry" );
4106 return QStringLiteral(
"PolygonGeometry" );
4109 return QStringLiteral(
"UnknownGeometry" );
4112 return QStringLiteral(
"NullGeometry" );
4117 QStringList options;
4118 options.reserve( mGeomTypes.size() );
4119 for (
const int type : mGeomTypes )
4121 options << QStringLiteral(
" QgsWkbTypes.%1" ).arg( geomTypeToString(
static_cast<Qgis::GeometryType>(
type ) ) );
4123 code += QStringLiteral(
", geometryTypes=[%1 ]" ).arg( options.join(
',' ) );
4126 if ( ! mAllowMultipart )
4128 code += QLatin1String(
", allowMultipart=False" );
4143 for (
const int type : mGeomTypes )
4147 map.insert( QStringLiteral(
"geometrytypes" ), types );
4148 map.insert( QStringLiteral(
"multipart" ), mAllowMultipart );
4156 const QVariantList values = map.value( QStringLiteral(
"geometrytypes" ) ).toList();
4157 for (
const QVariant &val : values )
4159 mGeomTypes << val.toInt();
4161 mAllowMultipart = map.value( QStringLiteral(
"multipart" ) ).toBool();
4175 if ( value.isValid() )
4178 if ( value.userType() == qMetaTypeId< QgsGeometry>() )
4184 else if ( value.userType() == qMetaTypeId<QgsReferencedGeometry>() )
4194 else if ( value.userType() == QMetaType::QString )
4206 return QObject::tr(
"Invalid geometry" );
4226 if ( !input.isValid() )
4234 if ( input.userType() == qMetaTypeId<QgsProperty>() )
4239 const QString
string = input.toString().trimmed();
4241 if ( input.userType() != QMetaType::Type::QString ||
string.isEmpty() )
4244 switch ( mBehavior )
4248 if ( !mExtension.isEmpty() )
4250 return string.endsWith( mExtension, Qt::CaseInsensitive );
4252 else if ( !mFileFilter.isEmpty() )
4270 QString code = QStringLiteral(
"##%1=" ).arg(
mName );
4272 code += QLatin1String(
"optional " );
4275 return code.trimmed();
4280 switch ( outputType )
4285 QString code = QStringLiteral(
"QgsProcessingParameterFile('%1', %2" )
4288 code += QLatin1String(
", optional=True" );
4289 code += QStringLiteral(
", behavior=%1" ).arg( mBehavior ==
Qgis::ProcessingFileParameterBehavior::File ? QStringLiteral(
"QgsProcessingParameterFile.File" ) : QStringLiteral(
"QgsProcessingParameterFile.Folder" ) );
4290 if ( !mExtension.isEmpty() )
4291 code += QStringLiteral(
", extension='%1'" ).arg( mExtension );
4292 if ( !mFileFilter.isEmpty() )
4293 code += QStringLiteral(
", fileFilter='%1'" ).arg( mFileFilter );
4304 switch ( mBehavior )
4308 if ( !mFileFilter.isEmpty() )
4309 return mFileFilter != QObject::tr(
"All files (*.*)" ) ? mFileFilter + QStringLiteral(
";;" ) + QObject::tr(
"All files (*.*)" ) : mFileFilter;
4310 else if ( !mExtension.isEmpty() )
4311 return QObject::tr(
"%1 files" ).arg( mExtension.toUpper() ) + QStringLiteral(
" (*." ) + mExtension.toLower() + QStringLiteral(
");;" ) + QObject::tr(
"All files (*.*)" );
4313 return QObject::tr(
"All files (*.*)" );
4325 mFileFilter.clear();
4335 mFileFilter = filter;
4342 map.insert( QStringLiteral(
"behavior" ),
static_cast< int >( mBehavior ) );
4343 map.insert( QStringLiteral(
"extension" ), mExtension );
4344 map.insert( QStringLiteral(
"filefilter" ), mFileFilter );
4352 mExtension = map.value( QStringLiteral(
"extension" ) ).toString();
4353 mFileFilter = map.value( QStringLiteral(
"filefilter" ) ).toString();
4366 , mFixedNumberRows( fixedNumberRows )
4379 if ( !input.isValid() )
4387 if ( input.userType() == QMetaType::Type::QString )
4389 if ( input.toString().isEmpty() )
4393 else if ( input.userType() == QMetaType::Type::QVariantList )
4395 if ( input.toList().isEmpty() )
4399 else if ( input.userType() == QMetaType::Type::Double || input.userType() == QMetaType::Type::Int )
4409 if ( !value.isValid() )
4410 return QStringLiteral(
"None" );
4412 if ( value.userType() == qMetaTypeId<QgsProperty>() )
4413 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( value.value<
QgsProperty >().
asExpression() );
4416 p.insert(
name(), value );
4424 switch ( outputType )
4428 QString code = QStringLiteral(
"QgsProcessingParameterMatrix('%1', %2" )
4431 code += QLatin1String(
", optional=True" );
4432 code += QStringLiteral(
", numberRows=%1" ).arg( mNumberRows );
4433 code += QStringLiteral(
", hasFixedNumberRows=%1" ).arg( mFixedNumberRows ? QStringLiteral(
"True" ) : QStringLiteral(
"False" ) );
4436 headers.reserve( mHeaders.size() );
4437 for (
const QString &h : mHeaders )
4439 code += QStringLiteral(
", headers=[%1]" ).arg(
headers.join(
',' ) );
4471 return mFixedNumberRows;
4476 mFixedNumberRows = fixedNumberRows;
4482 map.insert( QStringLiteral(
"headers" ), mHeaders );
4483 map.insert( QStringLiteral(
"rows" ), mNumberRows );
4484 map.insert( QStringLiteral(
"fixed_number_rows" ), mFixedNumberRows );
4491 mHeaders = map.value( QStringLiteral(
"headers" ) ).toStringList();
4492 mNumberRows = map.value( QStringLiteral(
"rows" ) ).toInt();
4493 mFixedNumberRows = map.value( QStringLiteral(
"fixed_number_rows" ) ).toBool();
4517 if ( !input.isValid() )
4527 if ( qobject_cast< QgsMapLayer * >( qvariant_cast<QObject *>( input ) ) )
4533 if ( input.userType() == QMetaType::Type::QString )
4535 if ( input.toString().isEmpty() )
4538 if ( mMinimumNumberInputs > 1 )
4549 else if ( input.userType() == QMetaType::Type::QVariantList )
4551 if ( input.toList().count() < mMinimumNumberInputs )
4554 if ( mMinimumNumberInputs > input.toList().count() )
4562 const auto constToList = input.toList();
4563 for (
const QVariant &v : constToList )
4565 if ( qobject_cast< QgsMapLayer * >( qvariant_cast<QObject *>( v ) ) )
4574 else if ( input.userType() == QMetaType::Type::QStringList )
4576 if ( input.toStringList().count() < mMinimumNumberInputs )
4579 if ( mMinimumNumberInputs > input.toStringList().count() )
4587 const auto constToStringList = input.toStringList();
4588 for (
const QString &v : constToStringList )
4601 if ( !value.isValid() )
4602 return QStringLiteral(
"None" );
4604 if ( value.userType() == qMetaTypeId<QgsProperty>() )
4605 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( value.value<
QgsProperty >().
asExpression() );
4610 if ( value.userType() == QMetaType::Type::QStringList )
4612 const QStringList list = value.toStringList();
4613 parts.reserve( list.count() );
4614 for (
const QString &v : list )
4617 else if ( value.userType() == QMetaType::Type::QVariantList )
4619 const QVariantList list = value.toList();
4620 parts.reserve( list.count() );
4621 for (
const QVariant &v : list )
4624 if ( !parts.isEmpty() )
4625 return parts.join(
',' ).prepend(
'[' ).append(
']' );
4630 p.insert(
name(), value );
4632 if ( !list.isEmpty() )
4635 parts.reserve( list.count() );
4640 return parts.join(
',' ).prepend(
'[' ).append(
']' );
4659 QString code = QStringLiteral(
"##%1=" ).arg(
mName );
4661 code += QLatin1String(
"optional " );
4662 switch ( mLayerType )
4665 code += QLatin1String(
"multiple raster" );
4669 code += QLatin1String(
"multiple file" );
4673 code += QLatin1String(
"multiple vector" );
4677 if (
mDefault.userType() == QMetaType::Type::QVariantList )
4680 const auto constToList =
mDefault.toList();
4681 for (
const QVariant &var : constToList )
4683 parts << var.toString();
4685 code += parts.join(
',' );
4687 else if (
mDefault.userType() == QMetaType::Type::QStringList )
4689 code +=
mDefault.toStringList().join(
',' );
4695 return code.trimmed();
4700 switch ( outputType )
4704 QString code = QStringLiteral(
"QgsProcessingParameterMultipleLayers('%1', %2" )
4707 code += QLatin1String(
", optional=True" );
4711 code += QStringLiteral(
", layerType=%1" ).arg(
layerType );
4722 switch ( mLayerType )
4725 return QObject::tr(
"All files (*.*)" );
4765 return mMinimumNumberInputs;
4777 map.insert( QStringLiteral(
"layer_type" ),
static_cast< int >( mLayerType ) );
4778 map.insert( QStringLiteral(
"min_inputs" ), mMinimumNumberInputs );
4786 mMinimumNumberInputs = map.value( QStringLiteral(
"min_inputs" ) ).toInt();
4792 QString
type = definition;
4794 const thread_local QRegularExpression re( QStringLiteral(
"(.*?)\\s+(.*)" ) );
4795 const QRegularExpressionMatch m = re.match( definition );
4798 type = m.captured( 1 ).toLower().trimmed();
4799 defaultVal = m.captured( 2 );
4802 if (
type == QLatin1String(
"vector" ) )
4804 else if (
type == QLatin1String(
"raster" ) )
4806 else if (
type == QLatin1String(
"file" ) )
4819 QgsMessageLog::logMessage( QObject::tr(
"Invalid number parameter \"%1\": min value %2 is >= max value %3!" ).arg(
name ).arg( mMin ).arg( mMax ), QObject::tr(
"Processing" ) );
4830 QVariant input = value;
4831 if ( !input.isValid() )
4839 if ( input.userType() == qMetaTypeId<QgsProperty>() )
4845 const double res = input.toDouble( &ok );
4849 return !( res < mMin || res > mMax );
4854 if ( !value.isValid() )
4855 return QStringLiteral(
"None" );
4857 if ( value.userType() == qMetaTypeId<QgsProperty>() )
4858 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( value.value<
QgsProperty >().
asExpression() );
4860 return value.toString();
4867 if ( mMin > std::numeric_limits<double>::lowest() + 1 )
4868 parts << QObject::tr(
"Minimum value: %1" ).arg( mMin );
4869 if ( mMax < std::numeric_limits<double>::max() )
4870 parts << QObject::tr(
"Maximum value: %1" ).arg( mMax );
4873 const QString extra = parts.join( QLatin1String(
"<br />" ) );
4874 if ( !extra.isEmpty() )
4875 text += QStringLiteral(
"<p>%1</p>" ).arg( extra );
4881 switch ( outputType )
4885 QString code = QStringLiteral(
"QgsProcessingParameterNumber('%1', %2" )
4888 code += QLatin1String(
", optional=True" );
4890 code += QStringLiteral(
", type=%1" ).arg( mDataType ==
Qgis::ProcessingNumberParameterType::Integer ? QStringLiteral(
"QgsProcessingParameterNumber.Integer" ) : QStringLiteral(
"QgsProcessingParameterNumber.Double" ) );
4892 if ( mMin != std::numeric_limits<double>::lowest() + 1 )
4893 code += QStringLiteral(
", minValue=%1" ).arg( mMin );
4894 if ( mMax != std::numeric_limits<double>::max() )
4895 code += QStringLiteral(
", maxValue=%1" ).arg( mMax );
4937 map.insert( QStringLiteral(
"min" ), mMin );
4938 map.insert( QStringLiteral(
"max" ), mMax );
4939 map.insert( QStringLiteral(
"data_type" ),
static_cast< int >( mDataType ) );
4946 mMin = map.value( QStringLiteral(
"min" ) ).toDouble();
4947 mMax = map.value( QStringLiteral(
"max" ) ).toDouble();
4955 : ( definition.toLower().trimmed() == QLatin1String(
"none" ) ? QVariant() : definition ), isOptional );
4973 if ( !input.isValid() )
4981 if ( input.userType() == qMetaTypeId<QgsProperty>() )
4986 if ( input.userType() == QMetaType::Type::QString )
4988 const QStringList list = input.toString().split(
',' );
4989 if ( list.count() != 2 )
4992 list.at( 0 ).toDouble( &ok );
4994 list.at( 1 ).toDouble( &ok2 );
4999 else if ( input.userType() == QMetaType::Type::QVariantList )
5001 if ( input.toList().count() != 2 )
5005 input.toList().at( 0 ).toDouble( &ok );
5007 input.toList().at( 1 ).toDouble( &ok2 );
5018 if ( !value.isValid() )
5019 return QStringLiteral(
"None" );
5021 if ( value.userType() == qMetaTypeId<QgsProperty>() )
5022 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( value.value<
QgsProperty >().
asExpression() );
5025 p.insert(
name(), value );
5028 QStringList stringParts;
5029 const auto constParts = parts;
5030 for (
const double v : constParts )
5032 stringParts << QString::number( v );
5034 return stringParts.join(
',' ).prepend(
'[' ).append(
']' );
5039 switch ( outputType )
5043 QString code = QStringLiteral(
"QgsProcessingParameterRange('%1', %2" )
5046 code += QLatin1String(
", optional=True" );
5048 code += QStringLiteral(
", type=%1" ).arg( mDataType ==
Qgis::ProcessingNumberParameterType::Integer ? QStringLiteral(
"QgsProcessingParameterNumber.Integer" ) : QStringLiteral(
"QgsProcessingParameterNumber.Double" ) );
5071 map.insert( QStringLiteral(
"data_type" ),
static_cast< int >( mDataType ) );
5085 : ( definition.toLower().trimmed() == QLatin1String(
"none" ) ? QVariant() : definition ), isOptional );
5102 if ( !input.isValid() )
5110 if ( input.userType() == qMetaTypeId<QgsProcessingRasterLayerDefinition>() )
5116 if ( input.userType() == qMetaTypeId<QgsProperty>() )
5129 if ( qobject_cast< QgsRasterLayer * >( qvariant_cast<QObject *>( input ) ) )
5132 if ( input.userType() != QMetaType::Type::QString || input.toString().isEmpty() )
5150 if ( !val.isValid() )
5151 return QStringLiteral(
"None" );
5153 if ( val.userType() == qMetaTypeId<QgsProperty>() )
5156 if ( val.userType() == qMetaTypeId<QgsProcessingRasterLayerDefinition>() )
5165 layerString = layer->source();
5169 return QStringLiteral(
"QgsProcessingRasterLayerDefinition(%1, referenceScale=%2, dpi=%3)" )
5172 QString::number( fromVar.
dpi ) );
5183 return QStringLiteral(
"QgsProcessingRasterLayerDefinition(QgsProperty.fromExpression(%1), referenceScale=%2, dpi=%3)" )
5186 QString::number( fromVar.
dpi ) );
5196 p.insert(
name(), val );
5224 mCapabilities = capabilities;
5229 return mCapabilities;
5248 QVariant input = value;
5249 if ( !input.isValid() )
5257 if ( input.userType() == qMetaTypeId<QgsProperty>() )
5262 if ( mUsesStaticStrings )
5264 if ( input.userType() == QMetaType::Type::QVariantList )
5266 if ( !mAllowMultiple )
5269 const QVariantList values = input.toList();
5273 for (
const QVariant &val : values )
5275 if ( !mOptions.contains( val.toString() ) )
5281 else if ( input.userType() == QMetaType::Type::QStringList )
5283 if ( !mAllowMultiple )
5286 const QStringList values = input.toStringList();
5291 if ( values.count() > 1 && !mAllowMultiple )
5294 for (
const QString &val : values )
5296 if ( !mOptions.contains( val ) )
5301 else if ( input.userType() == QMetaType::Type::QString )
5303 const QStringList parts = input.toString().split(
',' );
5304 if ( parts.count() > 1 && !mAllowMultiple )
5307 const auto constParts = parts;
5308 for (
const QString &part : constParts )
5310 if ( !mOptions.contains( part ) )
5318 if ( input.userType() == QMetaType::Type::QVariantList )
5320 if ( !mAllowMultiple )
5323 const QVariantList values = input.toList();
5327 for (
const QVariant &val : values )
5330 const int res = val.toInt( &ok );
5333 else if ( res < 0 || res >= mOptions.count() )
5339 else if ( input.userType() == QMetaType::Type::QString )
5341 const QStringList parts = input.toString().split(
',' );
5342 if ( parts.count() > 1 && !mAllowMultiple )
5345 const auto constParts = parts;
5346 for (
const QString &part : constParts )
5349 const int res = part.toInt( &ok );
5352 else if ( res < 0 || res >= mOptions.count() )
5357 else if ( input.userType() == QMetaType::Type::Int || input.userType() == QMetaType::Type::Double )
5360 const int res = input.toInt( &ok );
5363 else if ( res >= 0 && res < mOptions.count() )
5373 if ( !value.isValid() )
5374 return QStringLiteral(
"None" );
5376 if ( value.userType() == qMetaTypeId<QgsProperty>() )
5377 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( value.value<
QgsProperty >().
asExpression() );
5379 if ( mUsesStaticStrings )
5381 if ( value.userType() == QMetaType::Type::QVariantList || value.userType() == QMetaType::Type::QStringList )
5384 const QStringList constList = value.toStringList();
5385 for (
const QString &val : constList )
5389 return parts.join(
',' ).prepend(
'[' ).append(
']' );
5391 else if ( value.userType() == QMetaType::Type::QString )
5394 const QStringList constList = value.toString().split(
',' );
5395 if ( constList.count() > 1 )
5397 for (
const QString &val : constList )
5401 return parts.join(
',' ).prepend(
'[' ).append(
']' );
5409 if ( value.userType() == QMetaType::Type::QVariantList )
5412 const auto constToList = value.toList();
5413 for (
const QVariant &val : constToList )
5415 parts << QString::number( static_cast< int >( val.toDouble() ) );
5417 return parts.join(
',' ).prepend(
'[' ).append(
']' );
5419 else if ( value.userType() == QMetaType::Type::QString )
5421 const QStringList parts = value.toString().split(
',' );
5422 if ( parts.count() > 1 )
5424 return parts.join(
',' ).prepend(
'[' ).append(
']' );
5428 return QString::number(
static_cast< int >( value.toDouble() ) );
5434 if ( !value.isValid() )
5437 if ( value.userType() == qMetaTypeId<QgsProperty>() )
5440 if ( mUsesStaticStrings )
5446 if ( value.userType() == QMetaType::Type::QVariantList )
5449 const QVariantList toList = value.toList();
5450 parts.reserve( toList.size() );
5451 for (
const QVariant &val : toList )
5453 parts << mOptions.value(
static_cast< int >( val.toDouble() ) );
5455 return parts.join(
',' );
5457 else if ( value.userType() == QMetaType::Type::QString )
5459 const QStringList parts = value.toString().split(
',' );
5460 QStringList comments;
5461 if ( parts.count() > 1 )
5463 for (
const QString &part : parts )
5466 const int val = part.toInt( &ok );
5468 comments << mOptions.value( val );
5470 return comments.join(
',' );
5474 return mOptions.value(
static_cast< int >( value.toDouble() ) );
5480 QString code = QStringLiteral(
"##%1=" ).arg(
mName );
5482 code += QLatin1String(
"optional " );
5483 code += QLatin1String(
"enum " );
5485 if ( mAllowMultiple )
5486 code += QLatin1String(
"multiple " );
5488 if ( mUsesStaticStrings )
5489 code += QLatin1String(
"static " );
5491 code += mOptions.join(
';' ) +
' ';
5494 return code.trimmed();
5499 switch ( outputType )
5503 QString code = QStringLiteral(
"QgsProcessingParameterEnum('%1', %2" )
5506 code += QLatin1String(
", optional=True" );
5509 options.reserve( mOptions.size() );
5510 for (
const QString &o : mOptions )
5512 code += QStringLiteral(
", options=[%1]" ).arg(
options.join(
',' ) );
5514 code += QStringLiteral(
", allowMultiple=%1" ).arg( mAllowMultiple ? QStringLiteral(
"True" ) : QStringLiteral(
"False" ) );
5516 code += QStringLiteral(
", usesStaticStrings=%1" ).arg( mUsesStaticStrings ? QStringLiteral(
"True" ) : QStringLiteral(
"False" ) );
5532 return options().value( value.toInt() );
5547 return mAllowMultiple;
5557 return mUsesStaticStrings;
5568 map.insert( QStringLiteral(
"options" ), mOptions );
5569 map.insert( QStringLiteral(
"allow_multiple" ), mAllowMultiple );
5570 map.insert( QStringLiteral(
"uses_static_strings" ), mUsesStaticStrings );
5577 mOptions = map.value( QStringLiteral(
"options" ) ).toStringList();
5578 mAllowMultiple = map.value( QStringLiteral(
"allow_multiple" ) ).toBool();
5579 mUsesStaticStrings = map.value( QStringLiteral(
"uses_static_strings" ) ).toBool();
5586 QString def = definition;
5588 bool multiple =
false;
5589 if ( def.startsWith( QLatin1String(
"multiple" ), Qt::CaseInsensitive ) )
5595 bool staticStrings =
false;
5596 if ( def.startsWith( QLatin1String(
"static" ), Qt::CaseInsensitive ) )
5598 staticStrings =
true;
5602 const thread_local QRegularExpression re( QStringLiteral(
"(.*)\\s+(.*?)$" ) );
5603 const QRegularExpressionMatch m = re.match( def );
5604 QString values = def;
5607 values = m.captured( 1 ).trimmed();
5608 defaultVal = m.captured( 2 );
5629 return QStringLiteral(
"None" );
5631 if ( value.userType() == qMetaTypeId<QgsProperty>() )
5632 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( value.value<
QgsProperty >().
asExpression() );
5634 const QString s = value.toString();
5640 QString code = QStringLiteral(
"##%1=" ).arg(
mName );
5642 code += QLatin1String(
"optional " );
5643 code += QLatin1String(
"string " );
5646 code += QLatin1String(
"long " );
5649 return code.trimmed();
5654 switch ( outputType )
5658 QString code = QStringLiteral(
"QgsProcessingParameterString('%1', %2" )
5661 code += QLatin1String(
", optional=True" );
5662 code += QStringLiteral(
", multiLine=%1" ).arg( mMultiLine ? QStringLiteral(
"True" ) : QStringLiteral(
"False" ) );
5685 map.insert( QStringLiteral(
"multiline" ), mMultiLine );
5692 mMultiLine = map.value( QStringLiteral(
"multiline" ) ).toBool();
5698 QString def = definition;
5700 if ( def.startsWith( QLatin1String(
"long" ), Qt::CaseInsensitive ) )
5706 if ( def.startsWith(
'"' ) || def.startsWith(
'\'' ) )
5708 if ( def.endsWith(
'"' ) || def.endsWith(
'\'' ) )
5712 if ( def == QLatin1String(
"None" ) )
5735 if ( !value.isValid() )
5736 return QStringLiteral(
"None" );
5738 const QString s = value.toString();
5744 QString code = QStringLiteral(
"##%1=" ).arg(
mName );
5746 code += QLatin1String(
"optional " );
5747 code += QLatin1String(
"authcfg " );
5750 return code.trimmed();
5755 QString def = definition;
5757 if ( def.startsWith(
'"' ) || def.startsWith(
'\'' ) )
5759 if ( def.endsWith(
'"' ) || def.endsWith(
'\'' ) )
5763 if ( def == QLatin1String(
"None" ) )
5777 , mExpressionType(
type )
5789 if ( !value.isValid() )
5790 return QStringLiteral(
"None" );
5792 if ( value.userType() == qMetaTypeId<QgsProperty>() )
5793 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( value.value<
QgsProperty >().
asExpression() );
5795 const QString s = value.toString();
5801 QStringList depends;
5802 if ( !mParentLayerParameterName.isEmpty() )
5803 depends << mParentLayerParameterName;
5809 switch ( outputType )
5813 QString code = QStringLiteral(
"QgsProcessingParameterExpression('%1', %2" )
5816 code += QLatin1String(
", optional=True" );
5818 code += QStringLiteral(
", parentLayerParameterName='%1'" ).arg( mParentLayerParameterName );
5824 switch ( mExpressionType )
5827 code += QLatin1String(
", type=Qgis.ExpressionType.PointCloud)" );
5830 code += QLatin1String(
", type=Qgis.ExpressionType.RasterCalculator)" );
5833 code += QLatin1Char(
')' );
5844 return mParentLayerParameterName;
5854 return mExpressionType;
5865 map.insert( QStringLiteral(
"parent_layer" ), mParentLayerParameterName );
5866 map.insert( QStringLiteral(
"expression_type" ),
static_cast< int >( mExpressionType ) );
5873 mParentLayerParameterName = map.value( QStringLiteral(
"parent_layer" ) ).toString();
5874 mExpressionType =
static_cast< Qgis::ExpressionType >( map.value( QStringLiteral(
"expression_type" ) ).toInt() );
5899 if ( !var.isValid() )
5907 if ( var.userType() == qMetaTypeId<QgsProperty>() )
5920 if ( qobject_cast< QgsVectorLayer * >( qvariant_cast<QObject *>( var ) ) )
5923 if ( var.userType() != QMetaType::Type::QString || var.toString().isEmpty() )
5941 if ( !val.isValid() )
5942 return QStringLiteral(
"None" );
5944 if ( val.userType() == qMetaTypeId<QgsProperty>() )
5948 p.insert(
name(), val );
5966 switch ( outputType )
5970 QString code = QStringLiteral(
"QgsProcessingParameterVectorLayer('%1', %2" )
5973 code += QLatin1String(
", optional=True" );
5977 QStringList options;
5980 code += QStringLiteral(
", types=[%1]" ).arg( options.join(
',' ) );
6014 map.insert( QStringLiteral(
"data_types" ), types );
6022 const QVariantList values = map.value( QStringLiteral(
"data_types" ) ).toList();
6023 for (
const QVariant &val : values )
6051 if ( !var.isValid() )
6059 if ( var.userType() == qMetaTypeId<QgsProperty>() )
6072 if ( qobject_cast< QgsMeshLayer * >( qvariant_cast<QObject *>( var ) ) )
6075 if ( var.userType() != QMetaType::Type::QString || var.toString().isEmpty() )
6093 if ( !val.isValid() )
6094 return QStringLiteral(
"None" );
6096 if ( val.userType() == qMetaTypeId<QgsProperty>() )
6100 p.insert(
name(), val );
6145 if ( !input.isValid() )
6153 if ( input.userType() == qMetaTypeId<QgsProperty>() )
6158 if ( input.userType() == QMetaType::Type::QVariantList || input.userType() == QMetaType::Type::QStringList )
6160 if ( !mAllowMultiple )
6166 else if ( input.userType() == QMetaType::Type::QString )
6168 if ( input.toString().isEmpty() )
6171 const QStringList parts = input.toString().split(
';' );
6172 if ( parts.count() > 1 && !mAllowMultiple )
6177 if ( input.toString().isEmpty() )
6185 if ( !value.isValid() )
6186 return QStringLiteral(
"None" );
6188 if ( value.userType() == qMetaTypeId<QgsProperty>() )
6189 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( value.value<
QgsProperty >().
asExpression() );
6191 if ( value.userType() == QMetaType::Type::QVariantList )
6194 const auto constToList = value.toList();
6195 for (
const QVariant &val : constToList )
6199 return parts.join(
',' ).prepend(
'[' ).append(
']' );
6201 else if ( value.userType() == QMetaType::Type::QStringList )
6204 const auto constToStringList = value.toStringList();
6205 for (
const QString &s : constToStringList )
6209 return parts.join(
',' ).prepend(
'[' ).append(
']' );
6217 QString code = QStringLiteral(
"##%1=" ).arg(
mName );
6219 code += QLatin1String(
"optional " );
6220 code += QLatin1String(
"field " );
6222 switch ( mDataType )
6225 code += QLatin1String(
"numeric " );
6229 code += QLatin1String(
"string " );
6233 code += QLatin1String(
"datetime " );
6237 code += QLatin1String(
"binary " );
6241 code += QLatin1String(
"boolean " );
6248 if ( mAllowMultiple )
6249 code += QLatin1String(
"multiple " );
6251 if ( mDefaultToAllFields )
6252 code += QLatin1String(
"default_to_all_fields " );
6254 code += mParentLayerParameterName +
' ';
6257 return code.trimmed();
6262 switch ( outputType )
6266 QString code = QStringLiteral(
"QgsProcessingParameterField('%1', %2" )
6269 code += QLatin1String(
", optional=True" );
6272 switch ( mDataType )
6275 dataType = QStringLiteral(
"QgsProcessingParameterField.Any" );
6279 dataType = QStringLiteral(
"QgsProcessingParameterField.Numeric" );
6283 dataType = QStringLiteral(
"QgsProcessingParameterField.String" );
6287 dataType = QStringLiteral(
"QgsProcessingParameterField.DateTime" );
6291 dataType = QStringLiteral(
"QgsProcessingParameterField.Binary" );
6295 dataType = QStringLiteral(
"QgsProcessingParameterField.Boolean" );
6298 code += QStringLiteral(
", type=%1" ).arg(
dataType );
6300 code += QStringLiteral(
", parentLayerParameterName='%1'" ).arg( mParentLayerParameterName );
6301 code += QStringLiteral(
", allowMultiple=%1" ).arg( mAllowMultiple ? QStringLiteral(
"True" ) : QStringLiteral(
"False" ) );
6305 if ( mDefaultToAllFields )
6306 code += QLatin1String(
", defaultToAllFields=True" );
6318 QStringList depends;
6319 if ( !mParentLayerParameterName.isEmpty() )
6320 depends << mParentLayerParameterName;
6326 return mParentLayerParameterName;
6346 return mAllowMultiple;
6356 return mDefaultToAllFields;
6361 mDefaultToAllFields = enabled;
6367 map.insert( QStringLiteral(
"parent_layer" ), mParentLayerParameterName );
6368 map.insert( QStringLiteral(
"data_type" ),
static_cast< int >( mDataType ) );
6369 map.insert( QStringLiteral(
"allow_multiple" ), mAllowMultiple );
6370 map.insert( QStringLiteral(
"default_to_all_fields" ), mDefaultToAllFields );
6377 mParentLayerParameterName = map.value( QStringLiteral(
"parent_layer" ) ).toString();
6379 mAllowMultiple = map.value( QStringLiteral(
"allow_multiple" ) ).toBool();
6380 mDefaultToAllFields = map.value( QStringLiteral(
"default_to_all_fields" ) ).toBool();
6390 QString def = definition;
6392 if ( def.startsWith( QLatin1String(
"numeric " ), Qt::CaseInsensitive ) )
6397 else if ( def.startsWith( QLatin1String(
"string " ), Qt::CaseInsensitive ) )
6402 else if ( def.startsWith( QLatin1String(
"datetime " ), Qt::CaseInsensitive ) )
6407 else if ( def.startsWith( QLatin1String(
"binary " ), Qt::CaseInsensitive ) )
6412 else if ( def.startsWith( QLatin1String(
"boolean " ), Qt::CaseInsensitive ) )
6418 if ( def.startsWith( QLatin1String(
"multiple" ), Qt::CaseInsensitive ) )
6421 def = def.mid( 8 ).trimmed();
6424 if ( def.startsWith( QLatin1String(
"default_to_all_fields" ), Qt::CaseInsensitive ) )
6427 def = def.mid( 21 ).trimmed();
6430 const thread_local QRegularExpression re( QStringLiteral(
"(.*?)\\s+(.*)$" ) );
6431 const QRegularExpressionMatch m = re.match( def );
6434 parent = m.captured( 1 ).trimmed();
6435 def = m.captured( 2 );
6460 QVariant var = input;
6461 if ( !var.isValid() )
6469 if ( var.userType() == qMetaTypeId<QgsProcessingFeatureSourceDefinition>() )
6474 else if ( var.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
6481 if ( var.userType() == qMetaTypeId<QgsProperty>() )
6493 if ( qobject_cast< QgsVectorLayer * >( qvariant_cast<QObject *>( input ) ) )
6498 if ( var.userType() != QMetaType::Type::QString || var.toString().isEmpty() )
6516 if ( !value.isValid() )
6517 return QStringLiteral(
"None" );
6519 if ( value.userType() == qMetaTypeId<QgsProperty>() )
6522 if ( value.userType() == qMetaTypeId<QgsProcessingFeatureSourceDefinition>() )
6525 QString geometryCheckString;
6529 geometryCheckString = QStringLiteral(
"QgsFeatureRequest.GeometryNoCheck" );
6533 geometryCheckString = QStringLiteral(
"QgsFeatureRequest.GeometrySkipInvalid" );
6537 geometryCheckString = QStringLiteral(
"QgsFeatureRequest.GeometryAbortOnInvalid" );
6544 flags << QStringLiteral(
"QgsProcessingFeatureSourceDefinition.FlagOverrideDefaultGeometryCheck" );
6546 flags << QStringLiteral(
"QgsProcessingFeatureSourceDefinition.FlagCreateIndividualOutputPerInputFeature" );
6547 if ( !
flags.empty() )
6548 flagString =
flags.join( QLatin1String(
" | " ) );
6555 layerString = layer->source();
6562 flagString.isEmpty() ? QString() : ( QStringLiteral(
", flags=%1" ).arg( flagString ) ),
6563 geometryCheckString,
6575 return QStringLiteral(
"QgsProcessingFeatureSourceDefinition(QgsProperty.fromExpression(%1), selectedFeaturesOnly=%2, featureLimit=%3%4%6, geometryCheck=%5)" )
6579 flagString.isEmpty() ? QString() : ( QStringLiteral(
", flags=%1" ).arg( flagString ) ),
6580 geometryCheckString,
6589 else if (
QgsVectorLayer *layer = qobject_cast< QgsVectorLayer * >( qvariant_cast<QObject *>( value ) ) )
6594 QString layerString = value.toString();
6598 layerString = layer->providerType() != QLatin1String(
"ogr" ) && layer->providerType() != QLatin1String(
"gdal" ) && layer->providerType() != QLatin1String(
"mdal" ) ?
QgsProcessingUtils::encodeProviderKeyAndUri( layer->providerType(), layer->source() ) : layer->source();
6615 QString code = QStringLiteral(
"##%1=" ).arg(
mName );
6617 code += QLatin1String(
"optional " );
6618 code += QLatin1String(
"source " );
6625 code += QLatin1String(
"point " );
6629 code += QLatin1String(
"line " );
6633 code += QLatin1String(
"polygon " );
6642 return code.trimmed();
6647 switch ( outputType )
6651 QString code = QStringLiteral(
"QgsProcessingParameterFeatureSource('%1', %2" )
6654 code += QLatin1String(
", optional=True" );
6658 QStringList options;
6662 code += QStringLiteral(
", types=[%1]" ).arg( options.join(
',' ) );
6692 map.insert( QStringLiteral(
"data_types" ), types );
6700 const QVariantList values = map.value( QStringLiteral(
"data_types" ) ).toList();
6701 for (
const QVariant &val : values )
6711 QString def = definition;
6714 if ( def.startsWith( QLatin1String(
"point" ), Qt::CaseInsensitive ) )
6720 else if ( def.startsWith( QLatin1String(
"line" ), Qt::CaseInsensitive ) )
6726 else if ( def.startsWith( QLatin1String(
"polygon" ), Qt::CaseInsensitive ) )
6752 QVariant var = input;
6753 if ( !var.isValid() )
6761 if ( var.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
6767 if ( var.userType() == qMetaTypeId<QgsProperty>() )
6780 if ( var.userType() != QMetaType::Type::QString )
6783 if ( var.toString().isEmpty() )
6791 if ( !value.isValid() )
6792 return QStringLiteral(
"None" );
6794 if ( value.userType() == qMetaTypeId<QgsProperty>() )
6795 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( value.value<
QgsProperty >().
asExpression() );
6797 if ( value.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
6806 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( fromVar.
sink.
asExpression() );
6815 QString code = QStringLiteral(
"##%1=" ).arg(
mName );
6817 code += QLatin1String(
"optional " );
6818 code += QLatin1String(
"sink " );
6820 switch ( mDataType )
6823 code += QLatin1String(
"point " );
6827 code += QLatin1String(
"line " );
6831 code += QLatin1String(
"polygon " );
6835 code += QLatin1String(
"table " );
6843 return code.trimmed();
6855 return lOriginalProvider->defaultVectorFileExtension(
hasGeometry() );
6859 return p->defaultVectorFileExtension(
hasGeometry() );
6869 return QStringLiteral(
"dbf" );
6876 switch ( outputType )
6880 QString code = QStringLiteral(
"QgsProcessingParameterFeatureSink('%1', %2" )
6883 code += QLatin1String(
", optional=True" );
6887 code += QStringLiteral(
", createByDefault=%1" ).arg(
createByDefault() ? QStringLiteral(
"True" ) : QStringLiteral(
"False" ) );
6888 if ( mSupportsAppend )
6889 code += QLatin1String(
", supportsAppend=True" );
6902 QStringList filters;
6903 for (
const QString &ext : exts )
6905 filters << QObject::tr(
"%1 files (*.%2)" ).arg( ext.toUpper(), ext.toLower() );
6907 return filters.join( QLatin1String(
";;" ) ) + QStringLiteral(
";;" ) + QObject::tr(
"All files (*.*)" );
6916 return lOriginalProvider->supportedOutputVectorLayerExtensions();
6918 return lOriginalProvider->supportedOutputTableExtensions();
6923 return p->supportedOutputVectorLayerExtensions();
6925 return p->supportedOutputTableExtensions();
6940 switch ( mDataType )
6971 map.insert( QStringLiteral(
"data_type" ),
static_cast< int >( mDataType ) );
6972 map.insert( QStringLiteral(
"supports_append" ), mSupportsAppend );
6980 mSupportsAppend = map.value( QStringLiteral(
"supports_append" ),
false ).toBool();
6987 return QStringLiteral(
"memory:%1" ).arg(
description() );
6995 QString def = definition;
6996 if ( def.startsWith( QLatin1String(
"point" ), Qt::CaseInsensitive ) )
7001 else if ( def.startsWith( QLatin1String(
"line" ), Qt::CaseInsensitive ) )
7006 else if ( def.startsWith( QLatin1String(
"polygon" ), Qt::CaseInsensitive ) )
7011 else if ( def.startsWith( QLatin1String(
"table" ), Qt::CaseInsensitive ) )
7022 return mSupportsAppend;
7042 QVariant var = input;
7043 if ( !var.isValid() )
7051 if ( var.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
7057 if ( var.userType() == qMetaTypeId<QgsProperty>() )
7070 if ( var.userType() != QMetaType::Type::QString )
7073 if ( var.toString().isEmpty() )
7081 if ( !value.isValid() )
7082 return QStringLiteral(
"None" );
7084 if ( value.userType() == qMetaTypeId<QgsProperty>() )
7085 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( value.value<
QgsProperty >().
asExpression() );
7087 if ( value.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
7096 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( fromVar.
sink.
asExpression() );
7112 return lOriginalProvider->defaultRasterFileExtension();
7116 return p->defaultRasterFileExtension();
7127 QStringList filters;
7128 for (
const QString &ext : exts )
7130 filters << QObject::tr(
"%1 files (*.%2)" ).arg( ext.toUpper(), ext.toLower() );
7132 return filters.join( QLatin1String(
";;" ) ) + QStringLiteral(
";;" ) + QObject::tr(
"All files (*.*)" );
7139 return lOriginalProvider->supportedOutputRasterLayerExtensions();
7143 return p->supportedOutputRasterLayerExtensions();
7171 QVariant var = input;
7172 if ( !var.isValid() )
7180 if ( var.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
7186 if ( var.userType() == qMetaTypeId<QgsProperty>() )
7199 if ( var.userType() != QMetaType::Type::QString )
7202 if ( var.toString().isEmpty() )
7212 if ( !value.isValid() )
7213 return QStringLiteral(
"None" );
7215 if ( value.userType() == qMetaTypeId<QgsProperty>() )
7216 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( value.value<
QgsProperty >().
asExpression() );
7218 if ( value.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
7227 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( fromVar.
sink.
asExpression() );
7236 if ( !mFileFilter.isEmpty() && mFileFilter.contains( QStringLiteral(
"htm" ), Qt::CaseInsensitive ) )
7248 if ( mFileFilter.isEmpty() || mFileFilter == QObject::tr(
"All files (*.*)" ) )
7249 return QStringLiteral(
"file" );
7252 const thread_local QRegularExpression rx( QStringLiteral(
".*?\\(\\*\\.([a-zA-Z0-9._]+).*" ) );
7253 const QRegularExpressionMatch match = rx.match( mFileFilter );
7254 if ( !match.hasMatch() )
7255 return QStringLiteral(
"file" );
7257 return match.captured( 1 );
7262 switch ( outputType )
7266 QString code = QStringLiteral(
"QgsProcessingParameterFileDestination('%1', %2" )
7269 code += QLatin1String(
", optional=True" );
7273 code += QStringLiteral(
", createByDefault=%1" ).arg(
createByDefault() ? QStringLiteral(
"True" ) : QStringLiteral(
"False" ) );
7285 return (
fileFilter().isEmpty() ? QString() :
fileFilter() + QStringLiteral(
";;" ) ) + QObject::tr(
"All files (*.*)" );
7301 map.insert( QStringLiteral(
"file_filter" ), mFileFilter );
7308 mFileFilter = map.value( QStringLiteral(
"file_filter" ) ).toString();
7329 QVariant var = input;
7330 if ( !var.isValid() )
7338 if ( var.userType() == qMetaTypeId<QgsProperty>() )
7351 if ( var.userType() != QMetaType::Type::QString )
7354 if ( var.toString().isEmpty() )
7385 map.insert( QStringLiteral(
"supports_non_file_outputs" ), mSupportsNonFileBasedOutputs );
7386 map.insert( QStringLiteral(
"create_by_default" ), mCreateByDefault );
7393 mSupportsNonFileBasedOutputs = map.value( QStringLiteral(
"supports_non_file_outputs" ) ).toBool();
7394 mCreateByDefault = map.value( QStringLiteral(
"create_by_default" ), QStringLiteral(
"1" ) ).toBool();
7400 switch ( outputType )
7407 QString code = t->className() + QStringLiteral(
"('%1', %2" )
7410 code += QLatin1String(
", optional=True" );
7412 code += QStringLiteral(
", createByDefault=%1" ).arg( mCreateByDefault ? QStringLiteral(
"True" ) : QStringLiteral(
"False" ) );
7427 return QObject::tr(
"Default extension" ) + QStringLiteral(
" (*." ) +
defaultFileExtension() +
')';
7434 const thread_local QRegularExpression rx( QStringLiteral(
"[.]" ) );
7435 QString sanitizedName =
name();
7436 sanitizedName.replace( rx, QStringLiteral(
"_" ) );
7451 return lOriginalProvider->isSupportedOutputValue( value,
this, context, error );
7460 return mCreateByDefault;
7482 QVariant var = input;
7483 if ( !var.isValid() )
7491 if ( var.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
7497 if ( var.userType() == qMetaTypeId<QgsProperty>() )
7510 if ( var.userType() != QMetaType::Type::QString )
7513 if ( var.toString().isEmpty() )
7521 if ( !value.isValid() )
7522 return QStringLiteral(
"None" );
7524 if ( value.userType() == qMetaTypeId<QgsProperty>() )
7525 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( value.value<
QgsProperty >().
asExpression() );
7527 if ( value.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
7536 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( fromVar.
sink.
asExpression() );
7545 QString code = QStringLiteral(
"##%1=" ).arg(
mName );
7547 code += QLatin1String(
"optional " );
7548 code += QLatin1String(
"vectorDestination " );
7550 switch ( mDataType )
7553 code += QLatin1String(
"point " );
7557 code += QLatin1String(
"line " );
7561 code += QLatin1String(
"polygon " );
7569 return code.trimmed();
7581 return lOriginalProvider->defaultVectorFileExtension(
hasGeometry() );
7585 return p->defaultVectorFileExtension(
hasGeometry() );
7595 return QStringLiteral(
"dbf" );
7602 switch ( outputType )
7606 QString code = QStringLiteral(
"QgsProcessingParameterVectorDestination('%1', %2" )
7609 code += QLatin1String(
", optional=True" );
7613 code += QStringLiteral(
", createByDefault=%1" ).arg(
createByDefault() ? QStringLiteral(
"True" ) : QStringLiteral(
"False" ) );
7626 QStringList filters;
7627 for (
const QString &ext : exts )
7629 filters << QObject::tr(
"%1 files (*.%2)" ).arg( ext.toUpper(), ext.toLower() );
7631 return filters.join( QLatin1String(
";;" ) ) + QStringLiteral(
";;" ) + QObject::tr(
"All files (*.*)" );
7639 return lOriginalProvider->supportedOutputVectorLayerExtensions();
7641 return lOriginalProvider->supportedOutputTableExtensions();
7646 return p->supportedOutputVectorLayerExtensions();
7648 return p->supportedOutputTableExtensions();
7663 switch ( mDataType )
7694 map.insert( QStringLiteral(
"data_type" ),
static_cast< int >( mDataType ) );
7708 QString def = definition;
7709 if ( def.startsWith( QLatin1String(
"point" ), Qt::CaseInsensitive ) )
7714 else if ( def.startsWith( QLatin1String(
"line" ), Qt::CaseInsensitive ) )
7719 else if ( def.startsWith( QLatin1String(
"polygon" ), Qt::CaseInsensitive ) )
7743 QVariant input = value;
7744 if ( !input.isValid() )
7752 if ( input.userType() == qMetaTypeId<QgsProperty>() )
7757 if ( input.userType() == QMetaType::Type::QVariantList || input.userType() == QMetaType::Type::QStringList )
7759 if ( !mAllowMultiple )
7768 const double res = input.toInt( &ok );
7778 return mAllowMultiple;
7788 if ( !value.isValid() )
7789 return QStringLiteral(
"None" );
7791 if ( value.userType() == qMetaTypeId<QgsProperty>() )
7792 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( value.value<
QgsProperty >().
asExpression() );
7794 if ( value.userType() == QMetaType::Type::QVariantList )
7797 const QVariantList values = value.toList();
7798 for (
auto it = values.constBegin(); it != values.constEnd(); ++it )
7800 parts << QString::number( static_cast< int >( it->toDouble() ) );
7802 return parts.join(
',' ).prepend(
'[' ).append(
']' );
7804 else if ( value.userType() == QMetaType::Type::QStringList )
7807 const QStringList values = value.toStringList();
7808 for (
auto it = values.constBegin(); it != values.constEnd(); ++it )
7810 parts << QString::number( static_cast< int >( it->toDouble() ) );
7812 return parts.join(
',' ).prepend(
'[' ).append(
']' );
7815 return value.toString();
7820 QString code = QStringLiteral(
"##%1=" ).arg(
mName );
7822 code += QLatin1String(
"optional " );
7823 code += QLatin1String(
"band " );
7825 if ( mAllowMultiple )
7826 code += QLatin1String(
"multiple " );
7828 code += mParentLayerParameterName +
' ';
7831 return code.trimmed();
7836 QStringList depends;
7837 if ( !mParentLayerParameterName.isEmpty() )
7838 depends << mParentLayerParameterName;
7844 switch ( outputType )
7848 QString code = QStringLiteral(
"QgsProcessingParameterBand('%1', %2" )
7851 code += QLatin1String(
", optional=True" );
7853 code += QStringLiteral(
", parentLayerParameterName='%1'" ).arg( mParentLayerParameterName );
7854 code += QStringLiteral(
", allowMultiple=%1" ).arg( mAllowMultiple ? QStringLiteral(
"True" ) : QStringLiteral(
"False" ) );
7866 return mParentLayerParameterName;
7877 map.insert( QStringLiteral(
"parent_layer" ), mParentLayerParameterName );
7878 map.insert( QStringLiteral(
"allow_multiple" ), mAllowMultiple );
7885 mParentLayerParameterName = map.value( QStringLiteral(
"parent_layer" ) ).toString();
7886 mAllowMultiple = map.value( QStringLiteral(
"allow_multiple" ) ).toBool();
7893 QString def = definition;
7896 if ( def.startsWith( QLatin1String(
"multiple" ), Qt::CaseInsensitive ) )
7899 def = def.mid( 8 ).trimmed();
7902 const thread_local QRegularExpression re( QStringLiteral(
"(.*?)\\s+(.*)$" ) );
7903 const QRegularExpressionMatch m = re.match( def );
7906 parent = m.captured( 1 ).trimmed();
7907 def = m.captured( 2 );
7941 QStringList depends;
7942 if ( !mParentParameterName.isEmpty() )
7943 depends << mParentParameterName;
7949 switch ( outputType )
7953 QString code = QStringLiteral(
"QgsProcessingParameterDistance('%1', %2" )
7956 code += QLatin1String(
", optional=True" );
7958 code += QStringLiteral(
", parentParameterName='%1'" ).arg( mParentParameterName );
7960 if (
minimum() != std::numeric_limits<double>::lowest() + 1 )
7961 code += QStringLiteral(
", minValue=%1" ).arg(
minimum() );
7962 if (
maximum() != std::numeric_limits<double>::max() )
7963 code += QStringLiteral(
", maxValue=%1" ).arg(
maximum() );
7974 return mParentParameterName;
7985 map.insert( QStringLiteral(
"parent" ), mParentParameterName );
7986 map.insert( QStringLiteral(
"default_unit" ),
static_cast< int >( mDefaultUnit ) );
7993 mParentParameterName = map.value( QStringLiteral(
"parent" ) ).toString();
8031 QStringList depends;
8032 if ( !mParentParameterName.isEmpty() )
8033 depends << mParentParameterName;
8039 switch ( outputType )
8043 QString code = QStringLiteral(
"QgsProcessingParameterArea('%1', %2" )
8046 code += QLatin1String(
", optional=True" );
8048 code += QStringLiteral(
", parentParameterName='%1'" ).arg( mParentParameterName );
8051 code += QStringLiteral(
", minValue=%1" ).arg(
minimum() );
8052 if (
maximum() != std::numeric_limits<double>::max() )
8053 code += QStringLiteral(
", maxValue=%1" ).arg(
maximum() );
8064 return mParentParameterName;
8075 map.insert( QStringLiteral(
"parent" ), mParentParameterName );
8076 map.insert( QStringLiteral(
"default_unit" ),
qgsEnumValueToKey( mDefaultUnit ) );
8083 mParentParameterName = map.value( QStringLiteral(
"parent" ) ).toString();
8121 QStringList depends;
8122 if ( !mParentParameterName.isEmpty() )
8123 depends << mParentParameterName;
8129 switch ( outputType )
8133 QString code = QStringLiteral(
"QgsProcessingParameterVolume('%1', %2" )
8136 code += QLatin1String(
", optional=True" );
8138 code += QStringLiteral(
", parentParameterName='%1'" ).arg( mParentParameterName );
8141 code += QStringLiteral(
", minValue=%1" ).arg(
minimum() );
8142 if (
maximum() != std::numeric_limits<double>::max() )
8143 code += QStringLiteral(
", maxValue=%1" ).arg(
maximum() );
8154 return mParentParameterName;
8165 map.insert( QStringLiteral(
"parent" ), mParentParameterName );
8166 map.insert( QStringLiteral(
"default_unit" ),
qgsEnumValueToKey( mDefaultUnit ) );
8173 mParentParameterName = map.value( QStringLiteral(
"parent" ) ).toString();
8207 switch ( outputType )
8211 QString code = QStringLiteral(
"QgsProcessingParameterDuration('%1', %2" )
8214 code += QLatin1String(
", optional=True" );
8216 if (
minimum() != std::numeric_limits<double>::lowest() + 1 )
8217 code += QStringLiteral(
", minValue=%1" ).arg(
minimum() );
8218 if (
maximum() != std::numeric_limits<double>::max() )
8219 code += QStringLiteral(
", maxValue=%1" ).arg(
maximum() );
8231 map.insert( QStringLiteral(
"default_unit" ),
static_cast< int >( mDefaultUnit ) );
8273 switch ( outputType )
8277 QString code = QStringLiteral(
"QgsProcessingParameterScale('%1', %2" )
8280 code += QLatin1String(
", optional=True" );
8292 : ( definition.toLower().trimmed() == QLatin1String(
"none" ) ? QVariant() : definition ), isOptional );
8312 return QStringLiteral(
"None" );
8314 if ( value.userType() == qMetaTypeId<QgsProperty>() )
8315 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( value.value<
QgsProperty >().
asExpression() );
8317 const QString s = value.toString();
8323 QString code = QStringLiteral(
"##%1=" ).arg(
mName );
8325 code += QLatin1String(
"optional " );
8326 code += QLatin1String(
"layout " );
8329 return code.trimmed();
8334 switch ( outputType )
8338 QString code = QStringLiteral(
"QgsProcessingParameterLayout('%1', %2" )
8341 code += QLatin1String(
", optional=True" );
8352 QString def = definition;
8354 if ( def.startsWith(
'"' ) || def.startsWith(
'\'' ) )
8356 if ( def.endsWith(
'"' ) || def.endsWith(
'\'' ) )
8360 if ( def == QLatin1String(
"None" ) )
8387 return QStringLiteral(
"None" );
8389 if ( value.userType() == qMetaTypeId<QgsProperty>() )
8390 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( value.value<
QgsProperty >().
asExpression() );
8392 const QString s = value.toString();
8398 QString code = QStringLiteral(
"##%1=" ).arg(
mName );
8400 code += QLatin1String(
"optional " );
8401 code += QLatin1String(
"layoutitem " );
8402 if ( mItemType >= 0 )
8403 code += QString::number( mItemType ) +
' ';
8405 code += mParentLayoutParameterName +
' ';
8408 return code.trimmed();
8413 switch ( outputType )
8417 QString code = QStringLiteral(
"QgsProcessingParameterLayoutItem('%1', %2" )
8420 code += QLatin1String(
", optional=True" );
8422 if ( mItemType >= 0 )
8423 code += QStringLiteral(
", itemType=%1" ).arg( mItemType );
8425 code += QStringLiteral(
", parentLayoutParameterName='%1'" ).arg( mParentLayoutParameterName );
8438 map.insert( QStringLiteral(
"parent_layout" ), mParentLayoutParameterName );
8439 map.insert( QStringLiteral(
"item_type" ), mItemType );
8446 mParentLayoutParameterName = map.value( QStringLiteral(
"parent_layout" ) ).toString();
8447 mItemType = map.value( QStringLiteral(
"item_type" ) ).toInt();
8453 QStringList depends;
8454 if ( !mParentLayoutParameterName.isEmpty() )
8455 depends << mParentLayoutParameterName;
8462 QString def = definition;
8464 const thread_local QRegularExpression re( QStringLiteral(
"(\\d+)?\\s*(.*?)\\s+(.*)$" ) );
8465 const QRegularExpressionMatch m = re.match( def );
8468 itemType = m.captured( 1 ).trimmed().isEmpty() ? -1 : m.captured( 1 ).trimmed().toInt();
8469 parent = m.captured( 2 ).trimmed().isEmpty() ? m.captured( 3 ).trimmed() : m.captured( 2 ).trimmed();
8470 def = !m.captured( 2 ).trimmed().isEmpty() ? m.captured( 3 ) : QString();
8483 return mParentLayoutParameterName;
8488 mParentLayoutParameterName =
name;
8520 return QStringLiteral(
"None" );
8522 if ( value.userType() == qMetaTypeId<QgsProperty>() )
8523 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( value.value<
QgsProperty >().
asExpression() );
8525 if ( value.canConvert< QColor >() && !value.value< QColor >().isValid() )
8526 return QStringLiteral(
"QColor()" );
8528 if ( value.canConvert< QColor >() )
8530 const QColor
c = value.value< QColor >();
8531 if ( !mAllowOpacity ||
c.alpha() == 255 )
8532 return QStringLiteral(
"QColor(%1, %2, %3)" ).arg(
c.red() ).arg(
c.green() ).arg(
c.blue() );
8534 return QStringLiteral(
"QColor(%1, %2, %3, %4)" ).arg(
c.red() ).arg(
c.green() ).arg(
c.blue() ).arg(
c.alpha() );
8537 const QString s = value.toString();
8543 QString code = QStringLiteral(
"##%1=" ).arg(
mName );
8545 code += QLatin1String(
"optional " );
8546 code += QLatin1String(
"color " );
8548 if ( mAllowOpacity )
8549 code += QLatin1String(
"withopacity " );
8552 return code.trimmed();
8557 switch ( outputType )
8561 QString code = QStringLiteral(
"QgsProcessingParameterColor('%1', %2" )
8564 code += QLatin1String(
", optional=True" );
8566 code += QStringLiteral(
", opacityEnabled=%1" ).arg( mAllowOpacity ? QStringLiteral(
"True" ) : QStringLiteral(
"False" ) );
8578 if ( !input.isValid() && (
mDefault.isValid() && ( !
mDefault.toString().isEmpty() ||
mDefault.value< QColor >().isValid() ) ) )
8581 if ( !input.isValid() )
8584 if ( input.userType() == QMetaType::Type::QColor )
8588 else if ( input.userType() == qMetaTypeId<QgsProperty>() )
8593 if ( input.userType() != QMetaType::Type::QString || input.toString().isEmpty() )
8596 bool containsAlpha =
false;
8603 map.insert( QStringLiteral(
"opacityEnabled" ), mAllowOpacity );
8610 mAllowOpacity = map.value( QStringLiteral(
"opacityEnabled" ) ).toBool();
8616 return mAllowOpacity;
8621 mAllowOpacity = enabled;
8626 QString def = definition;
8628 bool allowOpacity =
false;
8629 if ( def.startsWith( QLatin1String(
"withopacity" ), Qt::CaseInsensitive ) )
8631 allowOpacity =
true;
8632 def = def.mid( 12 );
8635 if ( def.startsWith(
'"' ) || def.startsWith(
'\'' ) )
8637 if ( def.endsWith(
'"' ) || def.endsWith(
'\'' ) )
8641 if ( def == QLatin1String(
"None" ) || def.isEmpty() )
8654 , mSourceCrs( staticSourceCrs )
8655 , mDestCrs( staticDestinationCrs )
8667 return valueAsPythonStringPrivate( value, context,
false );
8670QString QgsProcessingParameterCoordinateOperation::valueAsPythonStringPrivate(
const QVariant &value,
QgsProcessingContext &context,
bool allowNonStringValues )
const
8673 return QStringLiteral(
"None" );
8675 if ( allowNonStringValues && value.userType() == qMetaTypeId<QgsCoordinateReferenceSystem>() )
8678 return QStringLiteral(
"QgsCoordinateReferenceSystem()" );
8683 if ( value.userType() == qMetaTypeId<QgsProperty>() )
8684 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( value.value< QgsProperty >().asExpression() );
8686 if ( allowNonStringValues )
8689 p.insert(
name(), value );
8695 const QString s = value.toString();
8701 QString code = QStringLiteral(
"##%1=" ).arg(
mName );
8703 code += QLatin1String(
"optional " );
8704 code += QLatin1String(
"coordinateoperation " );
8707 return code.trimmed();
8712 switch ( outputType )
8717 QString code = QStringLiteral(
"QgsProcessingParameterCoordinateOperation('%1', %2" )
8720 code += QLatin1String(
", optional=True" );
8721 if ( !mSourceParameterName.isEmpty() )
8722 code += QStringLiteral(
", sourceCrsParameterName=%1" ).arg( valueAsPythonStringPrivate( mSourceParameterName,
c,
false ) );
8723 if ( !mDestParameterName.isEmpty() )
8724 code += QStringLiteral(
", destinationCrsParameterName=%1" ).arg( valueAsPythonStringPrivate( mDestParameterName,
c,
false ) );
8726 if ( mSourceCrs.isValid() )
8727 code += QStringLiteral(
", staticSourceCrs=%1" ).arg( valueAsPythonStringPrivate( mSourceCrs,
c,
true ) );
8728 if ( mDestCrs.isValid() )
8729 code += QStringLiteral(
", staticDestinationCrs=%1" ).arg( valueAsPythonStringPrivate( mDestCrs,
c,
true ) );
8731 code += QStringLiteral(
", defaultValue=%1)" ).arg( valueAsPythonStringPrivate(
mDefault,
c,
false ) );
8741 if ( !mSourceParameterName.isEmpty() )
8742 res << mSourceParameterName;
8743 if ( !mDestParameterName.isEmpty() )
8744 res << mDestParameterName;
8751 map.insert( QStringLiteral(
"source_crs_parameter_name" ), mSourceParameterName );
8752 map.insert( QStringLiteral(
"dest_crs_parameter_name" ), mDestParameterName );
8753 map.insert( QStringLiteral(
"static_source_crs" ), mSourceCrs );
8754 map.insert( QStringLiteral(
"static_dest_crs" ), mDestCrs );
8761 mSourceParameterName = map.value( QStringLiteral(
"source_crs_parameter_name" ) ).toString();
8762 mDestParameterName = map.value( QStringLiteral(
"dest_crs_parameter_name" ) ).toString();
8763 mSourceCrs = map.value( QStringLiteral(
"static_source_crs" ) );
8764 mDestCrs = map.value( QStringLiteral(
"static_dest_crs" ) );
8770 QString def = definition;
8772 if ( def.startsWith(
'"' ) )
8775 if ( def.endsWith(
'"' ) )
8778 else if ( def.startsWith(
'\'' ) )
8781 if ( def.endsWith(
'\'' ) )
8786 if ( def == QLatin1String(
"None" ) )
8811 if ( !input.isValid() && !
mDefault.isValid() )
8814 if ( ( input.userType() == QMetaType::Type::QString && input.toString().isEmpty() )
8815 || ( !input.isValid() &&
mDefault.userType() == QMetaType::Type::QString &&
mDefault.toString().isEmpty() ) )
8823 if ( !value.isValid() )
8824 return QStringLiteral(
"None" );
8826 if ( value.userType() == qMetaTypeId<QgsProperty>() )
8827 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( value.value<
QgsProperty >().
asExpression() );
8834 QString code = QStringLiteral(
"##%1=" ).arg(
mName );
8836 code += QLatin1String(
"optional " );
8837 code += QLatin1String(
"maptheme " );
8840 return code.trimmed();
8845 switch ( outputType )
8849 QString code = QStringLiteral(
"QgsProcessingParameterMapTheme('%1', %2" )
8852 code += QLatin1String(
", optional=True" );
8877 QString def = definition;
8878 if ( def.startsWith(
'"' ) || def.startsWith(
'\'' ) )
8880 if ( def.endsWith(
'"' ) || def.endsWith(
'\'' ) )
8902 if ( mMin.isValid() && mMax.isValid() && mMin >= mMax )
8904 QgsMessageLog::logMessage( QObject::tr(
"Invalid datetime parameter \"%1\": min value %2 is >= max value %3!" ).arg( name, mMin.toString(), mMax.toString() ), QObject::tr(
"Processing" ) );
8915 QVariant input = value;
8916 if ( !input.isValid() )
8924 if ( input.userType() == qMetaTypeId<QgsProperty>() )
8929 if ( input.userType() != QMetaType::Type::QDateTime && input.userType() != QMetaType::Type::QDate && input.userType() != QMetaType::Type::QTime && input.userType() != QMetaType::Type::QString )
8935 if ( input.userType() == QMetaType::Type::QString )
8937 const QString s = input.toString();
8941 input = QDateTime::fromString( s, Qt::ISODate );
8944 if ( !input.toDateTime().isValid() )
8945 input = QTime::fromString( s );
8947 input = input.toDateTime().time();
8953 const QDateTime res = input.toDateTime();
8954 return res.isValid() && ( res >= mMin || !mMin.isValid() ) && ( res <= mMax || !mMax.isValid() );
8958 const QTime res = input.toTime();
8959 return res.isValid() && ( res >= mMin.time() || !mMin.isValid() ) && ( res <= mMax.time() || !mMax.isValid() );
8965 if ( !value.isValid() )
8966 return QStringLiteral(
"None" );
8968 if ( value.userType() == qMetaTypeId<QgsProperty>() )
8969 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( value.value<
QgsProperty >().
asExpression() );
8971 if ( value.userType() == QMetaType::Type::QDateTime )
8973 const QDateTime dt = value.toDateTime();
8974 if ( !dt.isValid() )
8975 return QStringLiteral(
"QDateTime()" );
8977 return QStringLiteral(
"QDateTime(QDate(%1, %2, %3), QTime(%4, %5, %6))" ).arg( dt.date().year() )
8978 .arg( dt.date().month() )
8979 .arg( dt.date().day() )
8980 .arg( dt.time().hour() )
8981 .arg( dt.time().minute() )
8982 .arg( dt.time().second() );
8984 else if ( value.userType() == QMetaType::Type::QDate )
8986 const QDate dt = value.toDate();
8987 if ( !dt.isValid() )
8988 return QStringLiteral(
"QDate()" );
8990 return QStringLiteral(
"QDate(%1, %2, %3)" ).arg( dt.year() )
8994 else if ( value.userType() == QMetaType::Type::QTime )
8996 const QTime dt = value.toTime();
8997 if ( !dt.isValid() )
8998 return QStringLiteral(
"QTime()" );
9000 return QStringLiteral(
"QTime(%4, %5, %6)" )
9003 .arg( dt.second() );
9005 return value.toString();
9012 if ( mMin.isValid() )
9013 parts << QObject::tr(
"Minimum value: %1" ).arg( mMin.toString( Qt::ISODate ) );
9014 if ( mMax.isValid() )
9015 parts << QObject::tr(
"Maximum value: %1" ).arg( mMax.toString( Qt::ISODate ) );
9019 const QString extra = parts.join( QLatin1String(
"<br />" ) );
9020 if ( !extra.isEmpty() )
9021 text += QStringLiteral(
"<p>%1</p>" ).arg( extra );
9027 switch ( outputType )
9031 QString code = QStringLiteral(
"QgsProcessingParameterDateTime('%1', %2" )
9034 code += QLatin1String(
", optional=True" );
9038 : QStringLiteral(
"QgsProcessingParameterDateTime.Time" ) );
9041 if ( mMin.isValid() )
9043 if ( mMax.isValid() )
9085 map.insert( QStringLiteral(
"min" ), mMin );
9086 map.insert( QStringLiteral(
"max" ), mMax );
9087 map.insert( QStringLiteral(
"data_type" ),
static_cast< int >( mDataType ) );
9094 mMin = map.value( QStringLiteral(
"min" ) ).toDateTime();
9095 mMax = map.value( QStringLiteral(
"max" ) ).toDateTime();
9103 : ( definition.toLower().trimmed() == QLatin1String(
"none" ) ? QVariant() : definition ), isOptional );
9112 if ( value.userType() == QMetaType::Type::QDateTime )
9114 const QDateTime dt = value.toDateTime();
9115 if ( !dt.isValid() )
9116 return QObject::tr(
"Invalid datetime" );
9118 return dt.toString( Qt::ISODate );
9121 else if ( value.userType() == QMetaType::Type::QDate )
9123 const QDate dt = value.toDate();
9124 if ( !dt.isValid() )
9125 return QObject::tr(
"Invalid date" );
9127 return dt.toString( Qt::ISODate );
9130 else if ( value.userType() == QMetaType::Type::QTime )
9132 const QTime dt = value.toTime();
9133 if ( !dt.isValid() )
9134 return QObject::tr(
"Invalid time" );
9136 return dt.toString( Qt::ISODate );
9139 return value.toString();
9161 if ( !input.isValid() && !
mDefault.isValid() )
9164 if ( ( input.userType() == QMetaType::Type::QString && input.toString().isEmpty() )
9165 || ( !input.isValid() &&
mDefault.userType() == QMetaType::Type::QString &&
mDefault.toString().isEmpty() ) )
9173 if ( !value.isValid() )
9174 return QStringLiteral(
"None" );
9176 if ( value.userType() == qMetaTypeId<QgsProperty>() )
9177 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( value.value<
QgsProperty >().
asExpression() );
9184 QString code = QStringLiteral(
"##%1=" ).arg(
mName );
9186 code += QLatin1String(
"optional " );
9187 code += QLatin1String(
"providerconnection " );
9188 code += mProviderId +
' ';
9191 return code.trimmed();
9196 switch ( outputType )
9200 QString code = QStringLiteral(
"QgsProcessingParameterProviderConnection('%1', %2, '%3'" )
9203 code += QLatin1String(
", optional=True" );
9217 map.insert( QStringLiteral(
"provider" ), mProviderId );
9224 mProviderId = map.value( QStringLiteral(
"provider" ) ).toString();
9230 QString def = definition;
9232 if ( def.contains(
' ' ) )
9234 provider = def.left( def.indexOf(
' ' ) );
9235 def = def.mid( def.indexOf(
' ' ) + 1 );
9243 if ( def.startsWith(
'"' ) || def.startsWith(
'\'' ) )
9245 if ( def.endsWith(
'"' ) || def.endsWith(
'\'' ) )
9263 , mParentConnectionParameterName( parentLayerParameterName )
9276 if ( !input.isValid() && !
mDefault.isValid() )
9279 if ( ( input.userType() == QMetaType::Type::QString && input.toString().isEmpty() )
9280 || ( !input.isValid() &&
mDefault.userType() == QMetaType::Type::QString &&
mDefault.toString().isEmpty() ) )
9288 if ( !value.isValid() )
9289 return QStringLiteral(
"None" );
9291 if ( value.userType() == qMetaTypeId<QgsProperty>() )
9292 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( value.value<
QgsProperty >().
asExpression() );
9299 QString code = QStringLiteral(
"##%1=" ).arg(
mName );
9301 code += QLatin1String(
"optional " );
9302 code += QLatin1String(
"databaseschema " );
9304 code += mParentConnectionParameterName +
' ';
9307 return code.trimmed();
9312 switch ( outputType )
9316 QString code = QStringLiteral(
"QgsProcessingParameterDatabaseSchema('%1', %2" )
9319 code += QLatin1String(
", optional=True" );
9321 code += QStringLiteral(
", connectionParameterName='%1'" ).arg( mParentConnectionParameterName );
9335 QStringList depends;
9336 if ( !mParentConnectionParameterName.isEmpty() )
9337 depends << mParentConnectionParameterName;
9343 return mParentConnectionParameterName;
9348 mParentConnectionParameterName =
name;
9354 map.insert( QStringLiteral(
"mParentConnectionParameterName" ), mParentConnectionParameterName );
9361 mParentConnectionParameterName = map.value( QStringLiteral(
"mParentConnectionParameterName" ) ).toString();
9368 QString def = definition;
9370 const thread_local QRegularExpression re( QStringLiteral(
"(.*?)\\s+(.*)$" ) );
9371 const QRegularExpressionMatch m = re.match( def );
9374 parent = m.captured( 1 ).trimmed();
9375 def = m.captured( 2 );
9391 const QString &connectionParameterName,
9392 const QString &schemaParameterName,
9395 , mParentConnectionParameterName( connectionParameterName )
9396 , mParentSchemaParameterName( schemaParameterName )
9410 if ( !input.isValid() && !
mDefault.isValid() )
9413 if ( ( input.userType() == QMetaType::Type::QString && input.toString().isEmpty() )
9414 || ( !input.isValid() &&
mDefault.userType() == QMetaType::Type::QString &&
mDefault.toString().isEmpty() ) )
9422 if ( !value.isValid() )
9423 return QStringLiteral(
"None" );
9425 if ( value.userType() == qMetaTypeId<QgsProperty>() )
9426 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( value.value<
QgsProperty >().
asExpression() );
9433 QString code = QStringLiteral(
"##%1=" ).arg(
mName );
9435 code += QLatin1String(
"optional " );
9436 code += QLatin1String(
"databasetable " );
9438 code += ( mParentConnectionParameterName.isEmpty() ? QStringLiteral(
"none" ) : mParentConnectionParameterName ) +
' ';
9439 code += ( mParentSchemaParameterName.isEmpty() ? QStringLiteral(
"none" ) : mParentSchemaParameterName ) +
' ';
9442 return code.trimmed();
9447 switch ( outputType )
9451 QString code = QStringLiteral(
"QgsProcessingParameterDatabaseTable('%1', %2" )
9454 code += QLatin1String(
", optional=True" );
9456 if ( mAllowNewTableNames )
9457 code += QLatin1String(
", allowNewTableNames=True" );
9459 code += QStringLiteral(
", connectionParameterName='%1'" ).arg( mParentConnectionParameterName );
9460 code += QStringLiteral(
", schemaParameterName='%1'" ).arg( mParentSchemaParameterName );
9474 QStringList depends;
9475 if ( !mParentConnectionParameterName.isEmpty() )
9476 depends << mParentConnectionParameterName;
9477 if ( !mParentSchemaParameterName.isEmpty() )
9478 depends << mParentSchemaParameterName;
9484 return mParentConnectionParameterName;
9489 mParentConnectionParameterName =
name;
9494 return mParentSchemaParameterName;
9499 mParentSchemaParameterName =
name;
9505 map.insert( QStringLiteral(
"mParentConnectionParameterName" ), mParentConnectionParameterName );
9506 map.insert( QStringLiteral(
"mParentSchemaParameterName" ), mParentSchemaParameterName );
9507 map.insert( QStringLiteral(
"mAllowNewTableNames" ), mAllowNewTableNames );
9514 mParentConnectionParameterName = map.value( QStringLiteral(
"mParentConnectionParameterName" ) ).toString();
9515 mParentSchemaParameterName = map.value( QStringLiteral(
"mParentSchemaParameterName" ) ).toString();
9516 mAllowNewTableNames = map.value( QStringLiteral(
"mAllowNewTableNames" ),
false ).toBool();
9524 QString def = definition;
9526 const thread_local QRegularExpression re( QStringLiteral(
"(.*?)\\s+(.*+)\\b\\s*(.*)$" ) );
9527 const QRegularExpressionMatch m = re.match( def );
9530 connection = m.captured( 1 ).trimmed();
9531 if ( connection == QLatin1String(
"none" ) )
9533 schema = m.captured( 2 ).trimmed();
9534 if ( schema == QLatin1String(
"none" ) )
9536 def = m.captured( 3 );
9544 return mAllowNewTableNames;
9571 if ( !var.isValid() )
9579 if ( var.userType() == qMetaTypeId<QgsProperty>() )
9592 if ( qobject_cast< QgsPointCloudLayer * >( qvariant_cast<QObject *>( var ) ) )
9595 if ( var.userType() != QMetaType::Type::QString || var.toString().isEmpty() )
9613 if ( !val.isValid() )
9614 return QStringLiteral(
"None" );
9616 if ( val.userType() == qMetaTypeId<QgsProperty>() )
9620 p.insert(
name(), val );
9664 if ( !var.isValid() )
9672 if ( var.userType() == qMetaTypeId<QgsProperty>() )
9685 if ( qobject_cast< QgsAnnotationLayer * >( qvariant_cast<QObject *>( var ) ) )
9688 if ( var.userType() != QMetaType::Type::QString || var.toString().isEmpty() )
9706 if ( !val.isValid() )
9707 return QStringLiteral(
"None" );
9709 if ( val.userType() == qMetaTypeId<QgsProperty>() )
9713 p.insert(
name(), val );
9746 QVariant var = input;
9747 if ( !var.isValid() )
9755 if ( var.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
9761 if ( var.userType() == qMetaTypeId<QgsProperty>() )
9774 if ( var.userType() != QMetaType::Type::QString )
9777 if ( var.toString().isEmpty() )
9785 if ( !value.isValid() )
9786 return QStringLiteral(
"None" );
9788 if ( value.userType() == qMetaTypeId<QgsProperty>() )
9789 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( value.value<
QgsProperty >().
asExpression() );
9791 if ( value.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
9800 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( fromVar.
sink.
asExpression() );
9816 return lOriginalProvider->defaultPointCloudFileExtension();
9820 return p->defaultPointCloudFileExtension();
9831 QStringList filters;
9832 for (
const QString &ext : exts )
9834 filters << QObject::tr(
"%1 files (*.%2)" ).arg( ext.toUpper(), ext.toLower() );
9836 return filters.join( QLatin1String(
";;" ) ) + QStringLiteral(
";;" ) + QObject::tr(
"All files (*.*)" );
9843 return lOriginalProvider->supportedOutputPointCloudLayerExtensions();
9847 return p->supportedOutputPointCloudLayerExtensions();
9852 return QStringList() << ext;
9889 if ( input.userType() == qMetaTypeId<QgsProperty>() )
9894 if ( input.userType() == QMetaType::Type::QVariantList || input.userType() == QMetaType::Type::QStringList )
9896 if ( !mAllowMultiple )
9902 else if ( input.userType() == QMetaType::Type::QString )
9904 if ( input.toString().isEmpty() )
9907 const QStringList parts = input.toString().split(
';' );
9908 if ( parts.count() > 1 && !mAllowMultiple )
9913 if ( input.toString().isEmpty() )
9921 if ( !value.isValid() )
9922 return QStringLiteral(
"None" );
9924 if ( value.userType() == qMetaTypeId<QgsProperty>() )
9925 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( value.value<
QgsProperty >().
asExpression() );
9927 if ( value.userType() == QMetaType::Type::QVariantList )
9930 const auto constToList = value.toList();
9931 for (
const QVariant &val : constToList )
9935 return parts.join(
',' ).prepend(
'[' ).append(
']' );
9937 else if ( value.userType() == QMetaType::Type::QStringList )
9940 const auto constToStringList = value.toStringList();
9941 for (
const QString &s : constToStringList )
9945 return parts.join(
',' ).prepend(
'[' ).append(
']' );
9953 QString code = QStringLiteral(
"##%1=" ).arg(
mName );
9955 code += QLatin1String(
"optional " );
9956 code += QLatin1String(
"attribute " );
9958 if ( mAllowMultiple )
9959 code += QLatin1String(
"multiple " );
9961 if ( mDefaultToAllAttributes )
9962 code += QLatin1String(
"default_to_all_attributes " );
9964 code += mParentLayerParameterName +
' ';
9967 return code.trimmed();
9972 switch ( outputType )
9976 QString code = QStringLiteral(
"QgsProcessingParameterPointCloudAttribute('%1', %2" )
9979 code += QLatin1String(
", optional=True" );
9981 code += QStringLiteral(
", parentLayerParameterName='%1'" ).arg( mParentLayerParameterName );
9982 code += QStringLiteral(
", allowMultiple=%1" ).arg( mAllowMultiple ? QStringLiteral(
"True" ) : QStringLiteral(
"False" ) );
9986 if ( mDefaultToAllAttributes )
9987 code += QLatin1String(
", defaultToAllAttributes=True" );
9999 QStringList depends;
10000 if ( !mParentLayerParameterName.isEmpty() )
10001 depends << mParentLayerParameterName;
10007 return mParentLayerParameterName;
10017 return mAllowMultiple;
10027 return mDefaultToAllAttributes;
10032 mDefaultToAllAttributes = enabled;
10038 map.insert( QStringLiteral(
"parent_layer" ), mParentLayerParameterName );
10039 map.insert( QStringLiteral(
"allow_multiple" ), mAllowMultiple );
10040 map.insert( QStringLiteral(
"default_to_all_attributes" ), mDefaultToAllAttributes );
10047 mParentLayerParameterName = map.value( QStringLiteral(
"parent_layer" ) ).toString();
10048 mAllowMultiple = map.value( QStringLiteral(
"allow_multiple" ) ).toBool();
10049 mDefaultToAllAttributes = map.value( QStringLiteral(
"default_to_all_attributes" ) ).toBool();
10058 QString def = definition;
10060 if ( def.startsWith( QLatin1String(
"multiple" ), Qt::CaseInsensitive ) )
10063 def = def.mid( 8 ).trimmed();
10066 if ( def.startsWith( QLatin1String(
"default_to_all_attributes" ), Qt::CaseInsensitive ) )
10069 def = def.mid( 25 ).trimmed();
10072 const thread_local QRegularExpression re( QStringLiteral(
"(.*?)\\s+(.*)$" ) );
10073 const QRegularExpressionMatch m = re.match( def );
10074 if ( m.hasMatch() )
10076 parent = m.captured( 1 ).trimmed();
10077 def = m.captured( 2 );
10104 QVariant var = input;
10105 if ( !var.isValid() )
10113 if ( var.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
10116 var = fromVar.
sink;
10119 if ( var.userType() == qMetaTypeId<QgsProperty>() )
10132 if ( var.userType() != QMetaType::Type::QString )
10135 if ( var.toString().isEmpty() )
10143 if ( !value.isValid() )
10144 return QStringLiteral(
"None" );
10146 if ( value.userType() == qMetaTypeId<QgsProperty>() )
10147 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( value.value<
QgsProperty >().
asExpression() );
10149 if ( value.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
10158 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( fromVar.
sink.
asExpression() );
10178 QStringList filters;
10179 for (
const QString &ext : exts )
10181 filters << QObject::tr(
"%1 files (*.%2)" ).arg( ext.toUpper(), ext.toLower() );
10183 return filters.join( QLatin1String(
";;" ) ) + QStringLiteral(
";;" ) + QObject::tr(
"All files (*.*)" );
10189 return QStringList() << ext;
Provides global constants and enumerations for use throughout the application.
ProcessingSourceType
Processing data source types.
@ File
Files (i.e. non map layer sources, such as text files).
@ TiledScene
Tiled scene layers.
@ Annotation
Annotation layers.
@ Vector
Tables (i.e. vector layers with or without geometry). When used for a sink this indicates the sink ha...
@ VectorTile
Vector tile layers.
@ MapLayer
Any map layer type (raster, vector, mesh, point cloud, annotation or plugin layer).
@ VectorAnyGeometry
Any vector layer with geometry.
@ VectorPoint
Vector point layers.
@ VectorPolygon
Vector polygon layers.
@ VectorLine
Vector line layers.
@ PointCloud
Point cloud layers.
ProcessingFileParameterBehavior
Flags which dictate the behavior of QgsProcessingParameterFile.
@ File
Parameter is a single file.
@ Folder
Parameter is a folder.
ExpressionType
Expression types.
@ RasterCalculator
Raster calculator expression.
@ Qgis
Native QGIS expression.
@ PointCloud
Point cloud expression.
@ ShortString
A heavily abbreviated string, for use when a compact representation is required.
DistanceUnit
Units of distance.
@ Unknown
Unknown distance unit.
QFlags< RasterProcessingParameterCapability > RasterProcessingParameterCapabilities
Raster layer processing parameter capabilities.
ProcessingFieldParameterDataType
Processing field parameter data types.
@ String
Accepts string fields.
@ Boolean
Accepts boolean fields, since QGIS 3.34.
@ Binary
Accepts binary fields, since QGIS 3.34.
@ Numeric
Accepts numeric fields.
@ DateTime
Accepts datetime fields.
@ Unknown
Unknown areal unit.
@ Invalid
Invalid (not set) property.
@ Field
Field based property.
@ Expression
Expression based property.
TemporalUnit
Temporal units.
GeometryType
The geometry types are used to group Qgis::WkbType in a coarse way.
QFlags< ProcessingParameterFlag > ProcessingParameterFlags
Flags which dictate the behavior of Processing parameters.
@ Unknown
Unknown volume unit.
InvalidGeometryCheck
Methods for handling of features with invalid geometries.
@ NoCheck
No invalid geometry checking.
@ AbortOnInvalid
Close iterator on encountering any features with invalid geometry. This requires a slow geometry vali...
@ SkipInvalid
Skip any features with invalid geometry. This requires a slow geometry validity check for every featu...
QFlags< ProcessingFeatureSourceDefinitionFlag > ProcessingFeatureSourceDefinitionFlags
Flags which control behavior for a Processing feature source.
@ CreateIndividualOutputPerInputFeature
If set, every feature processed from this source will be placed into its own individually created out...
@ OverrideDefaultGeometryCheck
If set, the default geometry check method (as dictated by QgsProcessingContext) will be overridden fo...
WkbType
The WKB type describes the number of dimensions a geometry has.
@ Preferred
Preferred format, matching the most recent WKT ISO standard. Currently an alias to WKT2_2019,...
@ Optional
Parameter is optional.
ProcessingDateTimeParameterDataType
Processing date time parameter data types.
@ DateTime
Datetime values.
ProcessingNumberParameterType
Processing numeric parameter data types.
@ Double
Double/float values.
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,...
Represents a coordinate reference system (CRS).
bool isValid() const
Returns whether this CRS is correctly initialized and usable.
QString userFriendlyIdentifier(Qgis::CrsIdentifierType type=Qgis::CrsIdentifierType::MediumString) const
Returns a user friendly identifier for the CRS.
QString toWkt(Qgis::CrsWktVariant variant=Qgis::CrsWktVariant::Wkt1Gdal, bool multiline=false, int indentationWidth=4) const
Returns a WKT representation of this CRS.
Custom exception class for Coordinate Reference System related exceptions.
Handles parsing and evaluation of expressions (formerly called "search strings").
bool isValid() const
Checks if this expression is valid.
An interface for objects which accept features via addFeature(s) methods.
QFlags< SinkFlag > SinkFlags
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...
static QgsGeometry fromRect(const QgsRectangle &rect)
Creates a new geometry from a QgsRectangle.
QString lastError() const
Returns an error string referring to the last error encountered either when this geometry was created...
Qgis::GeometryOperationResult transform(const QgsCoordinateTransform &ct, Qgis::TransformDirection direction=Qgis::TransformDirection::Forward, bool transformZ=false)
Transforms this geometry as described by the coordinate transform ct.
static Q_INVOKABLE 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)
Creates a new geometry from a QgsPointXY object.
bool isMultipart() const
Returns true if WKB of the geometry is of WKBMulti* type.
QgsGeometry centroid() const
Returns the center of mass of a geometry.
QgsRectangle boundingBox() const
Returns the bounding box of the geometry.
Q_INVOKABLE 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.
QgsCoordinateReferenceSystem crs
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, const char *file=__builtin_FILE(), const char *function=__builtin_FUNCTION(), int line=__builtin_LINE())
Adds a message to the log instance (and creates it if necessary).
Represents a map layer supporting display of point clouds.
Print layout, a QgsLayout subclass for static or atlas-based layouts.
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.
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.
QgsProject * project() const
Returns the project in which the algorithm is being executed.
Base class for all parameter definitions which represent file or layer destinations,...
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonOutputType::PythonQgsProcessingAlgorithmSubclass) const override
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
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.
bool supportsNonFileBasedOutput() const
Returns true if the destination parameter supports non filed-based outputs, such as memory layers or ...
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.
virtual QString generateTemporaryDestination(const QgsProcessingContext *context=nullptr) const
Generates a temporary destination 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.
bool selectedFeaturesOnly
true if only selected features in the source should be used by algorithms.
QgsProperty source
Source definition.
Qgis::InvalidGeometryCheck geometryCheck
Geometry check method to apply to this source.
Qgis::ProcessingFeatureSourceDefinitionFlags flags
Flags which dictate source behavior.
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.
QString filterExpression
Optional expression filter to use for filtering features which will be read from the source.
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.
QgsProcessingOutputLayerDefinition(const QString &sink=QString(), QgsProject *destinationProject=nullptr)
Constructor for QgsProcessingOutputLayerDefinition, accepting a static sink/layer string.
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 pointcloud layer output for processing algorithms.
A raster layer output for processing algorithms.
A vector layer output for processing algorithms.
A vector tile layer output for processing algorithms.
QgsProcessingParameterAnnotationLayer(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), bool optional=false)
Constructor for QgsProcessingParameterAnnotationLayer.
QVariant valueAsJsonObject(const QVariant &value, QgsProcessingContext &context) const override
Returns a version of the parameter input value, which is suitable for use in a JSON object.
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.
QString valueAsString(const QVariant &value, QgsProcessingContext &context, bool &ok) const override
Returns a string version of the parameter input value (if possible).
static QString typeName()
Returns the type name for the parameter class.
QgsProcessingParameterArea * clone() const override
Creates a clone of the parameter definition.
QString type() const override
Unique parameter type name.
QString parentParameterName() const
Returns the name of the parent parameter, or an empty string if this is not set.
QVariantMap toVariantMap() const override
Saves this parameter to a QVariantMap.
void setParentParameterName(const QString &parentParameterName)
Sets the name of the parent layer parameter.
Qgis::AreaUnit defaultUnit() const
Returns the default area unit for the parameter.
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
QgsProcessingParameterArea(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), const QString &parentParameterName=QString(), bool optional=false, double minValue=0, double maxValue=std::numeric_limits< double >::max())
Constructor for QgsProcessingParameterArea.
static QString typeName()
Returns the type name for the parameter class.
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonOutputType::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.
QString userFriendlyString(const QVariant &value) const override
Returns a user-friendly string representation of the provided parameter value.
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.
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonOutputType::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.
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.
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.
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonOutputType::PythonQgsProcessingAlgorithmSubclass) const override
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
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::PythonOutputType::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...
QString destinationCrsParameterName() const
Returns the name of the destination CRS 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 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.
QStringList dependsOnOtherParameters() const override
Returns a list of other parameter names on which this parameter is dependent (e.g.
QString sourceCrsParameterName() const
Returns the name of the source CRS parameter, or an empty string if this is not set.
QgsProcessingParameterCrs(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), bool optional=false)
Constructor for QgsProcessingParameterCrs.
QString valueAsString(const QVariant &value, QgsProcessingContext &context, bool &ok) const override
Returns a string version of the parameter input value (if possible).
QString userFriendlyString(const QVariant &value) const override
Returns a user-friendly string representation of the provided parameter value.
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.
QVariant valueAsJsonObject(const QVariant &value, QgsProcessingContext &context) const override
Returns a version of the parameter input value, which is suitable for use in a JSON object.
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonOutputType::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.
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 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.
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::PythonOutputType::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.
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
QString type() const override
Unique parameter type name.
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.
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonOutputType::PythonQgsProcessingAlgorithmSubclass) const override
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
void setDataType(Qgis::ProcessingDateTimeParameterDataType type)
Sets the acceptable data type for the parameter.
Qgis::ProcessingDateTimeParameterDataType dataType() const
Returns the acceptable data type 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.
QVariantMap toVariantMap() const override
Saves this parameter to a QVariantMap.
QString userFriendlyString(const QVariant &value) const override
Returns a user-friendly string representation of the provided parameter value.
QgsProcessingParameterDateTime(const QString &name, const QString &description=QString(), Qgis::ProcessingDateTimeParameterDataType type=Qgis::ProcessingDateTimeParameterDataType::DateTime, const QVariant &defaultValue=QVariant(), bool optional=false, const QDateTime &minValue=QDateTime(), const QDateTime &maxValue=QDateTime())
Constructor for QgsProcessingParameterDateTime.
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.
virtual QVariant valueAsJsonObject(const QVariant &value, QgsProcessingContext &context) const
Returns a version of the parameter input value, which is suitable for use in a JSON object.
QVariant defaultValue() const
Returns the default value for the parameter.
QVariant guiDefaultValueOverride() const
Returns the default value to use in the GUI for the parameter.
QString valueAsStringPrivate(const QVariant &value, QgsProcessingContext &context, bool &ok, ValueAsStringFlags flags) const
Internal method for evaluating values as string.
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...
Qgis::ProcessingParameterFlags mFlags
Parameter flags.
virtual QString userFriendlyString(const QVariant &value) const
Returns a user-friendly string representation of the provided parameter value.
QFlags< ValueAsStringFlag > ValueAsStringFlags
virtual QStringList valueAsStringList(const QVariant &value, QgsProcessingContext &context, bool &ok) const
Returns a string list version of the parameter input value (if possible).
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.
@ AllowMapLayerValues
Enable map layer value handling.
QString mName
Parameter name.
virtual QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonOutputType::PythonQgsProcessingAlgorithmSubclass) const
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
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.
QVariant defaultValueForGui() const
Returns the default value to use for the parameter in a GUI.
friend class QgsProcessingAlgorithm
virtual QString valueAsString(const QVariant &value, QgsProcessingContext &context, bool &ok) const
Returns a string version of the parameter input value (if possible).
QVariantMap mMetadata
Freeform metadata for parameter. Mostly used by widget wrappers to customize their appearance and beh...
QString mDescription
Parameter description.
virtual QString type() const =0
Unique parameter type name.
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.
Qgis::ProcessingParameterFlags flags() const
Returns any flags associated with the 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.
QVariant defaultGuiValueFromSetting() const
Default gui value for an algorithm parameter from settings.
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.
QVariant valueAsJsonObjectPrivate(const QVariant &value, QgsProcessingContext &context, ValueAsStringFlags flags) const
Internal method for evaluating values as JSON objects.
virtual QColor modelColor() const
Returns the color to use for the parameter in model designer windows.
void setParentParameterName(const QString &parentParameterName)
Sets the name of the parent layer parameter.
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonOutputType::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 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.
Qgis::DistanceUnit defaultUnit() const
Returns the default distance unit for the parameter.
QgsProcessingParameterDistance * clone() const override
Creates a clone of the parameter definition.
QString userFriendlyString(const QVariant &value) const override
Returns a user-friendly string representation of the provided parameter value.
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.
Qgis::TemporalUnit defaultUnit() const
Returns the default duration unit for the parameter.
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
QString userFriendlyString(const QVariant &value) const override
Returns a user-friendly string representation of the provided parameter value.
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::PythonOutputType::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...
QString userFriendlyString(const QVariant &value) const override
Returns a user-friendly string representation of the provided parameter value.
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...
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.
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonOutputType::PythonQgsProcessingAlgorithmSubclass) const override
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
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.
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonOutputType::PythonQgsProcessingAlgorithmSubclass) const override
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
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 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.
QgsProcessingParameterExpression(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), const QString &parentLayerParameterName=QString(), bool optional=false, Qgis::ExpressionType type=Qgis::ExpressionType::Qgis)
Constructor for QgsProcessingParameterExpression.
QStringList dependsOnOtherParameters() const override
Returns a list of other parameter names on which this parameter is dependent (e.g.
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.
QString type() const override
Unique parameter type name.
static QString typeName()
Returns the type name for the parameter class.
Qgis::ExpressionType expressionType() const
Returns the parameter's expression type.
void setExpressionType(Qgis::ExpressionType type)
Sets the parameter's expression type.
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.
QVariant valueAsJsonObject(const QVariant &value, QgsProcessingContext &context) const override
Returns a version of the parameter input value, which is suitable for use in a JSON object.
QString valueAsString(const QVariant &value, QgsProcessingContext &context, bool &ok) const override
Returns a string version of the parameter input value (if possible).
QgsProcessingParameterFeatureSink(const QString &name, const QString &description=QString(), Qgis::ProcessingSourceType type=Qgis::ProcessingSourceType::VectorAnyGeometry, const QVariant &defaultValue=QVariant(), bool optional=false, bool createByDefault=true, bool supportsAppend=false)
Constructor for QgsProcessingParameterFeatureSink.
QString generateTemporaryDestination(const QgsProcessingContext *context=nullptr) 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.
void setDataType(Qgis::ProcessingSourceType type)
Sets the layer type for the 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.
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.
bool supportsAppend() const
Returns true if the sink supports appending features to an existing table.
Qgis::ProcessingSourceType dataType() const
Returns the layer type for sinks associated with the parameter.
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.
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonOutputType::PythonQgsProcessingAlgorithmSubclass) const override
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
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 valueAsString(const QVariant &value, QgsProcessingContext &context, bool &ok) const override
Returns a string version of the parameter input value (if possible).
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 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 asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonOutputType::PythonQgsProcessingAlgorithmSubclass) const override
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
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.
QVariant valueAsJsonObject(const QVariant &value, QgsProcessingContext &context) const override
Returns a version of the parameter input value, which is suitable for use in a JSON object.
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 setParentLayerParameterName(const QString &parentLayerParameterName)
Sets the name of the parent layer parameter.
Qgis::ProcessingFieldParameterDataType dataType() const
Returns the acceptable data type for the field.
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.
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonOutputType::PythonQgsProcessingAlgorithmSubclass) const override
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
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.
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 setDataType(Qgis::ProcessingFieldParameterDataType type)
Sets the acceptable data type for the field.
void setAllowMultiple(bool allowMultiple)
Sets whether multiple field selections are permitted.
QgsProcessingParameterField(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), const QString &parentLayerParameterName=QString(), Qgis::ProcessingFieldParameterDataType type=Qgis::ProcessingFieldParameterDataType::Any, bool allowMultiple=false, bool optional=false, bool defaultToAllFields=false)
Constructor for QgsProcessingParameterField.
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.
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::PythonOutputType::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.
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 asScriptCode() const override
Returns the parameter definition encoded in a string which can be used within a Processing script.
QgsProcessingParameterFile(const QString &name, const QString &description=QString(), Qgis::ProcessingFileParameterBehavior behavior=Qgis::ProcessingFileParameterBehavior::File, const QString &extension=QString(), const QVariant &defaultValue=QVariant(), bool optional=false, const QString &fileFilter=QString())
Constructor for QgsProcessingParameterFile.
void setFileFilter(const QString &filter)
Sets the file filter string for file destinations compatible with this parameter.
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonOutputType::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.
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.
QString createFileFilter() const override
This method needs to be reimplemented in all classes which implement this interface and return a file...
static QgsProcessingParameterFile * fromScriptCode(const QString &name, const QString &description, bool isOptional, const QString &definition, Qgis::ProcessingFileParameterBehavior behavior=Qgis::ProcessingFileParameterBehavior::File)
Creates a new parameter using the definition from a script code.
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
Qgis::ProcessingFileParameterBehavior behavior() const
Returns the parameter behavior (e.g.
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.
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 asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonOutputType::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.
bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
bool allowMultipart() const
Returns the parameter allow multipart geometries.
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.
QList< int > geometryTypes() const
Returns the parameter allowed geometries, as a list of Qgis::GeometryType values.
QVariantMap toVariantMap() const override
Saves this parameter to a QVariantMap.
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
QString userFriendlyString(const QVariant &value) const override
Returns a user-friendly string representation of the provided parameter value.
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.
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.
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.
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonOutputType::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.
QStringList dependsOnOtherParameters() const override
Returns a list of other parameter names on which this parameter is dependent (e.g.
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonOutputType::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.
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.
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.
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 valueAsString(const QVariant &value, QgsProcessingContext &context, bool &ok) const override
Returns a string version of the parameter input value (if possible).
QString createFileFilter() const override
This method needs to be reimplemented in all classes which implement this interface and return a file...
QString type() const override
Unique parameter type name.
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonOutputType::PythonQgsProcessingAlgorithmSubclass) const override
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
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.
QVariant valueAsJsonObject(const QVariant &value, QgsProcessingContext &context) const override
Returns a version of the parameter input value, which is suitable for use in a JSON object.
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 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::PythonOutputType::PythonQgsProcessingAlgorithmSubclass) const override
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
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.
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.
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonOutputType::PythonQgsProcessingAlgorithmSubclass) const override
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
bool hasFixedNumberRows() const
Returns whether the table has a fixed number of rows.
bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
QString valueAsString(const QVariant &value, QgsProcessingContext &context, bool &ok) const override
Returns a string version of the parameter input value (if possible).
QgsProcessingParameterMeshLayer(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), bool optional=false)
Constructor for QgsProcessingParameterMeshLayer.
QVariant valueAsJsonObject(const QVariant &value, QgsProcessingContext &context) const override
Returns a version of the parameter input value, which is suitable for use in a JSON object.
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.
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
QVariant valueAsJsonObject(const QVariant &value, QgsProcessingContext &context) const override
Returns a version of the parameter input value, which is suitable for use in a JSON object.
QString valueAsString(const QVariant &value, QgsProcessingContext &context, bool &ok) const override
Returns a string version of the parameter input value (if possible).
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.
Qgis::ProcessingSourceType layerType() const
Returns the layer type for layers 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...
static QString typeName()
Returns the type name for the parameter class.
void setLayerType(Qgis::ProcessingSourceType type)
Sets the layer type for layers acceptable by the parameter.
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...
QgsProcessingParameterMultipleLayers(const QString &name, const QString &description=QString(), Qgis::ProcessingSourceType layerType=Qgis::ProcessingSourceType::VectorAnyGeometry, const QVariant &defaultValue=QVariant(), bool optional=false)
Constructor for QgsProcessingParameterMultipleLayers.
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonOutputType::PythonQgsProcessingAlgorithmSubclass) const override
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
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.
QString type() const override
Unique parameter type name.
int minimumNumberInputs() const
Returns the minimum number of layers required for the parameter.
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 maximum() const
Returns the maximum value acceptable by the parameter.
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonOutputType::PythonQgsProcessingAlgorithmSubclass) const override
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
QString type() const override
Unique parameter type name.
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.
Qgis::ProcessingNumberParameterType dataType() const
Returns the acceptable data type for the parameter.
static QString typeName()
Returns the type name for the parameter class.
QgsProcessingParameterNumber(const QString &name, const QString &description=QString(), Qgis::ProcessingNumberParameterType type=Qgis::ProcessingNumberParameterType::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(Qgis::ProcessingNumberParameterType type)
Sets the acceptable data type for the parameter.
QgsProcessingParameterPointCloudAttribute(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), const QString &parentLayerParameterName=QString(), bool allowMultiple=false, bool optional=false, bool defaultToAllAttributes=false)
Constructor for QgsProcessingParameterField.
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.
void setDefaultToAllAttributes(bool enabled)
Sets whether a parameter which allows multiple selections (see allowMultiple()) should automatically ...
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonOutputType::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.
void setParentLayerParameterName(const QString &parentLayerParameterName)
Sets the name of the parent layer parameter.
QString parentLayerParameterName() const
Returns the name of the parent layer parameter, or an empty string if this is not set.
static QgsProcessingParameterPointCloudAttribute * 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 field selections are permitted.
void setAllowMultiple(bool allowMultiple)
Sets whether multiple field selections are permitted.
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.
QVariantMap toVariantMap() const override
Saves this parameter to a QVariantMap.
bool defaultToAllAttributes() const
Returns whether a parameter which allows multiple selections (see allowMultiple()) should automatical...
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.
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...
static QgsProcessingParameterPointCloudDestination * fromScriptCode(const QString &name, const QString &description, bool isOptional, const QString &definition)
Creates a new parameter using the definition from a script code.
virtual QStringList supportedOutputPointCloudLayerExtensions() const
Returns a list of the point cloud format file extensions supported for this parameter.
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.
static QString typeName()
Returns the type name for the parameter class.
QgsProcessingParameterPointCloudDestination(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), bool optional=false, bool createByDefault=true)
Constructor for QgsProcessingParameterPointCloudDestination.
QgsProcessingOutputDefinition * toOutputDefinition() const override
Returns a new QgsProcessingOutputDefinition corresponding to the definition of the destination parame...
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 valueAsString(const QVariant &value, QgsProcessingContext &context, bool &ok) const override
Returns a string version of the parameter input value (if possible).
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.
QVariant valueAsJsonObject(const QVariant &value, QgsProcessingContext &context) const override
Returns a version of the parameter input value, which is suitable for use in a JSON object.
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.
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...
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::PythonOutputType::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.
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
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::PythonOutputType::PythonQgsProcessingAlgorithmSubclass) const override
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
Qgis::ProcessingNumberParameterType dataType() const
Returns the acceptable data type for the range.
QgsProcessingParameterRange(const QString &name, const QString &description=QString(), Qgis::ProcessingNumberParameterType type=Qgis::ProcessingNumberParameterType::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...
void setDataType(Qgis::ProcessingNumberParameterType dataType)
Sets the acceptable data type for the range.
QString type() const override
Unique parameter type name.
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.
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.
Qgis::RasterProcessingParameterCapabilities parameterCapabilities() const
Returns flags containing the supported capabilities of the raster layer parameter.
QString valueAsString(const QVariant &value, QgsProcessingContext &context, bool &ok) const override
Returns a string version of the parameter input value (if possible).
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.
QVariant valueAsJsonObject(const QVariant &value, QgsProcessingContext &context) const override
Returns a version of the parameter input value, which is suitable for use in a JSON object.
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...
void setParameterCapabilities(Qgis::RasterProcessingParameterCapabilities capabilities)
Sets the supported capabilities of the raster layer parameter.
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::PythonOutputType::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.
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 asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonOutputType::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...
Makes metadata of processing parameters available.
virtual QgsProcessingParameterDefinition * create(const QString &name) const =0
Creates a new parameter of this type.
virtual QColor modelColor() const
Returns the color to use for the parameter in model designer windows.
static QColor defaultModelColor()
Returns the default color for a processing parameter.
QgsProcessingParameterVectorDestination(const QString &name, const QString &description=QString(), Qgis::ProcessingSourceType type=Qgis::ProcessingSourceType::VectorAnyGeometry, const QVariant &defaultValue=QVariant(), bool optional=false, bool createByDefault=true)
Constructor for QgsProcessingParameterVectorDestination.
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...
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.
Qgis::ProcessingSourceType dataType() const
Returns the layer type for this created vector layer.
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.
void setDataType(Qgis::ProcessingSourceType type)
Sets the layer type for the created vector layer.
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...
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonOutputType::PythonQgsProcessingAlgorithmSubclass) const override
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonOutputType::PythonQgsProcessingAlgorithmSubclass) const override
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
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.
QString valueAsString(const QVariant &value, QgsProcessingContext &context, bool &ok) const override
Returns a string version of the parameter input value (if possible).
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...
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.
QVariant valueAsJsonObject(const QVariant &value, QgsProcessingContext &context) const override
Returns a version of the parameter input value, which is suitable for use in a JSON object.
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.
QgsProcessingOutputDefinition * toOutputDefinition() const override
Returns a new QgsProcessingOutputDefinition corresponding to the definition of the destination parame...
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...
QgsProcessingParameterVectorTileDestination(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), bool optional=false, bool createByDefault=true)
Constructor for QgsProcessingParameterVectorTileDestination.
bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
virtual QStringList supportedOutputVectorTileLayerExtensions() const
Returns a list of the point cloud format file extensions supported for this parameter.
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
static QgsProcessingParameterVectorTileDestination * 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.
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...
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
QString userFriendlyString(const QVariant &value) const override
Returns a user-friendly string representation of the provided parameter value.
static QString typeName()
Returns the type name for the parameter class.
QgsProcessingParameterVolume(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), const QString &parentParameterName=QString(), bool optional=false, double minValue=0, double maxValue=std::numeric_limits< double >::max())
Constructor for QgsProcessingParameterVolume.
Qgis::VolumeUnit defaultUnit() const
Returns the default volume unit for the parameter.
void setParentParameterName(const QString &parentParameterName)
Sets the name of the parent layer parameter.
QgsProcessingParameterVolume * clone() const override
Creates a clone of the parameter definition.
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 parentParameterName() const
Returns the name of the parent parameter, or an empty string if this is not set.
QString type() const override
Unique parameter type name.
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonOutputType::PythonQgsProcessingAlgorithmSubclass) const override
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
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 QgsFeatureSink * parameterAsSink(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, const QgsFields &fields, Qgis::WkbType 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 QgsPrintLayout * parameterAsLayout(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context)
Evaluates the parameter with matching definition to a print layout.
static QList< QgsMapLayer * > parameterAsLayerList(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context, QgsProcessing::LayerOptionsFlags flags=QgsProcessing::LayerOptionsFlags())
Evaluates the parameter with matching definition to a list of map layers.
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 QStringList parameterAsStrings(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context)
Evaluates the parameter with matching definition to a list of strings (e.g.
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 bool parameterAsBoolean(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, const QgsProcessingContext &context)
Evaluates the parameter with matching definition to a static boolean value.
static QgsPointCloudLayer * parameterAsPointCloudLayer(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context, QgsProcessing::LayerOptionsFlags flags=QgsProcessing::LayerOptionsFlags())
Evaluates the parameter with matching definition to a point cloud layer.
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 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 QgsMapLayer * parameterAsLayer(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context, QgsProcessingUtils::LayerHint layerHint=QgsProcessingUtils::LayerHint::UnknownType, QgsProcessing::LayerOptionsFlags flags=QgsProcessing::LayerOptionsFlags())
Evaluates the parameter with matching definition to a map layer.
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 Q_DECL_DEPRECATED 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...
Encapsulates settings relating to a raster layer input to a processing algorithm.
double referenceScale
If set to a value > 0, sets a scale at which a raster (e.g., a WMS) should be requested or rendered.
int dpi
Indicates the resolution of the raster source (e.g., a WMS server).
QgsProperty source
Source definition.
bool loadVariant(const QVariantMap &map)
Loads this raster layer definition from a QVariantMap, wrapped in a QVariant.
QVariant toVariant() const
Saves this raster layer definition to a QVariantMap, wrapped in a QVariant.
QgsProcessingParameterType * parameterType(const QString &id) const
Returns the parameter type registered for id.
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 layerToStringIdentifier(const QgsMapLayer *layer, const QString &layerName=QString())
Returns a string representation of the source for a layer.
static QString generateTempFilename(const QString &basename, const QgsProcessingContext *context=nullptr)
Returns a temporary filename for a given file, putting it into a temporary folder (creating that fold...
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.
@ VectorTile
Vector tile layer type, since QGIS 3.32.
@ 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 QgsProcessingFeatureSource * variantToSource(const QVariant &value, QgsProcessingContext &context, const QVariant &fallbackValue=QVariant())
Converts a variant value to a new feature source.
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 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, const QString &filterExpression=QString())
Converts a source vector layer to a file path and layer name of a vector layer of compatible format.
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, const QString &filterExpression=QString())
Converts a source vector layer to a file path of a vector layer of compatible format.
static QgsFeatureSink * createFeatureSink(QString &destination, QgsProcessingContext &context, const QgsFields &fields, Qgis::WkbType 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 defaultRasterExtension()
Returns the default raster extension to use, in the absence of all other constraints (e....
static QString defaultVectorTileExtension()
Returns the default vector tile extension to use, in the absence of all other constraints (e....
static QgsMapLayer * mapLayerFromString(const QString &string, QgsProcessingContext &context, bool allowLoadingNewLayers=true, QgsProcessingUtils::LayerHint typeHint=QgsProcessingUtils::LayerHint::UnknownType, QgsProcessing::LayerOptionsFlags flags=QgsProcessing::LayerOptionsFlags())
Interprets a string as a map layer within the supplied context.
static QString defaultPointCloudExtension()
Returns the default point cloud extension to use, in the absence of all other constraints (e....
QFlags< LayerOptionsFlag > LayerOptionsFlags
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.
static QString sourceTypeToString(Qgis::ProcessingSourceType type)
Converts a source type to a string representation.
@ SkipIndexGeneration
Do not generate index when creating a layer. Makes sense only for point cloud layers.
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.
QString asExpression() const
Returns an expression string representing the state of the property, or an empty string if the proper...
QString expressionString() const
Returns the expression used for the property value.
Qgis::PropertyType propertyType() const
Returns the property type.
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.
QString field() const
Returns the current field name the property references.
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 staticValue() const
Returns the current static value for the property.
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.
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.
Stores settings for use within QGIS.
QVariant value(const QString &key, const QVariant &defaultValue=QVariant(), Section section=NoSection) const
Returns the value for setting key.
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,...
static Q_INVOKABLE QString toAbbreviatedString(Qgis::DistanceUnit unit)
Returns a translated abbreviation representing a distance unit.
static bool isNull(const QVariant &variant, bool silenceNullWarnings=false)
Returns true if the specified variant should be considered a NULL value.
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 dataset.
static Q_INVOKABLE QString geometryDisplayString(Qgis::GeometryType type)
Returns a display string for a geometry type.
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
T qgsEnumKeyToValue(const QString &key, const T &defaultValue, bool tryValueAsKey=true, bool *returnOk=nullptr)
Returns the value corresponding to the given key of an enum.
QString qgsDoubleToString(double a, int precision=17)
Returns a string representation of a double.
QString qgsEnumValueToKey(const T &value, bool *returnOk=nullptr)
Returns the value for the given key of an enum.
#define QgsDebugError(str)
QString parameterAsCompatibleSourceLayerPathInternal(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context, const QStringList &compatibleFormats, const QString &preferredFormat, QgsProcessingFeedback *feedback, QString *layerName)
QString createAllMapLayerFileFilter()