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() );
984 val = parameters.value( definition->
name() );
985 if ( val.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
989 format = fromVar.
format();
997 QVariant val = value;
1001 if ( val.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
1011 if ( definition && val.userType() == qMetaTypeId<QgsProperty>() )
1015 else if ( definition && ( !val.isValid() || val.toString().isEmpty() ) )
1022 dest = val.toString();
1027 dest = destParam->generateTemporaryDestination( &context );
1030 if ( destinationProject )
1033 if ( destName.isEmpty() && definition )
1038 outputName = definition->
name();
1062 val = parameters.value( definition->
name() );
1069 QVariant val = value;
1071 if ( val.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
1079 if ( definition && val.userType() == qMetaTypeId<QgsProperty>() )
1083 else if ( definition && ( !val.isValid() || val.toString().isEmpty() ) )
1090 dest = val.toString();
1095 dest = destParam->generateTemporaryDestination( &context );
1115 return parameterAsCrs( definition, parameters.value( definition->
name() ), context );
1140 QVariant val = value;
1142 if ( val.userType() == qMetaTypeId<QgsRectangle>() )
1146 if ( val.userType() == qMetaTypeId< QgsGeometry>() )
1152 if ( val.userType() == qMetaTypeId<QgsReferencedRectangle>() )
1171 if ( val.userType() == qMetaTypeId<QgsProcessingFeatureSourceDefinition>() )
1177 else if ( val.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
1190 QgsMapLayer *layer = qobject_cast< QgsMapLayer * >( qvariant_cast<QObject *>( val ) );
1193 if ( val.userType() == qMetaTypeId<QgsProperty>() )
1196 rectText = val.toString();
1198 if ( rectText.isEmpty() && !layer )
1201 const thread_local QRegularExpression rx( QStringLiteral(
"^(.*?)\\s*,\\s*(.*?),\\s*(.*?),\\s*(.*?)\\s*(?:\\[(.*)\\])?\\s*$" ) );
1202 const QRegularExpressionMatch match = rx.match( rectText );
1203 if ( match.hasMatch() )
1205 bool xMinOk =
false;
1206 const double xMin = match.captured( 1 ).toDouble( &xMinOk );
1207 bool xMaxOk =
false;
1208 const double xMax = match.captured( 2 ).toDouble( &xMaxOk );
1209 bool yMinOk =
false;
1210 const double yMin = match.captured( 3 ).toDouble( &yMinOk );
1211 bool yMaxOk =
false;
1212 const double yMax = match.captured( 4 ).toDouble( &yMaxOk );
1213 if ( xMinOk && xMaxOk && yMinOk && yMaxOk )
1264 QVariant val = parameters.value( definition->
name() );
1266 if ( val.userType() == qMetaTypeId<QgsReferencedRectangle>() )
1272 g = g.densifyByCount( 20 );
1286 if ( val.userType() == qMetaTypeId<QgsProcessingFeatureSourceDefinition>() )
1292 else if ( val.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
1305 if ( val.userType() == qMetaTypeId<QgsProperty>() )
1308 rectText = val.toString();
1310 if ( !rectText.isEmpty() )
1312 const thread_local QRegularExpression rx( QStringLiteral(
"^(.*?)\\s*,\\s*(.*?),\\s*(.*?),\\s*(.*?)\\s*(?:\\[(.*)\\])?\\s*$" ) );
1313 const QRegularExpressionMatch match = rx.match( rectText );
1314 if ( match.hasMatch() )
1316 bool xMinOk =
false;
1317 const double xMin = match.captured( 1 ).toDouble( &xMinOk );
1318 bool xMaxOk =
false;
1319 const double xMax = match.captured( 2 ).toDouble( &xMaxOk );
1320 bool yMinOk =
false;
1321 const double yMin = match.captured( 3 ).toDouble( &yMinOk );
1322 bool yMaxOk =
false;
1323 const double yMax = match.captured( 4 ).toDouble( &yMaxOk );
1324 if ( xMinOk && xMaxOk && yMinOk && yMaxOk )
1354 QgsMapLayer *layer = qobject_cast< QgsMapLayer * >( qvariant_cast<QObject *>( val ) );
1383 const QVariant val = parameters.value( definition->
name() );
1389 QVariant val = value;
1390 if ( val.userType() == qMetaTypeId<QgsReferencedRectangle>() )
1399 if ( val.userType() == qMetaTypeId<QgsProcessingFeatureSourceDefinition>() )
1405 else if ( val.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
1417 QString valueAsString;
1418 if ( val.userType() == qMetaTypeId<QgsProperty>() )
1421 valueAsString = val.toString();
1423 const thread_local QRegularExpression rx( QStringLiteral(
"^(.*?)\\s*,\\s*(.*?),\\s*(.*?),\\s*(.*?)\\s*(?:\\[(.*)\\])?\\s*$" ) );
1425 const QRegularExpressionMatch match = rx.match( valueAsString );
1426 if ( match.hasMatch() )
1433 if ( val.userType() == qMetaTypeId<QgsProcessingFeatureSourceDefinition>() )
1439 else if ( val.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
1452 if (
QgsMapLayer *layer = qobject_cast< QgsMapLayer * >( qvariant_cast<QObject *>( val ) ) )
1453 return layer->crs();
1455 return layer->crs();
1457 if (
auto *lProject = context.
project() )
1458 return lProject->crs();
1476 const QVariant val = value;
1477 if ( val.userType() == qMetaTypeId<QgsPointXY>() )
1481 if ( val.userType() == qMetaTypeId< QgsGeometry>() )
1487 if ( val.userType() == qMetaTypeId<QgsReferencedPointXY>() )
1506 if ( pointText.isEmpty() )
1509 if ( pointText.isEmpty() )
1512 const thread_local QRegularExpression rx( QStringLiteral(
"^\\s*\\(?\\s*(.*?)\\s*,\\s*(.*?)\\s*(?:\\[(.*)\\])?\\s*\\)?\\s*$" ) );
1515 const QRegularExpressionMatch match = rx.match( valueAsString );
1516 if ( match.hasMatch() )
1519 const double x = match.captured( 1 ).toDouble( &xOk );
1521 const double y = match.captured( 2 ).toDouble( &yOk );
1549 const QVariant val = parameters.value( definition->
name() );
1555 if ( value.userType() == qMetaTypeId<QgsReferencedPointXY>() )
1564 const thread_local QRegularExpression rx( QStringLiteral(
"^\\s*\\(?\\s*(.*?)\\s*,\\s*(.*?)\\s*(?:\\[(.*)\\])?\\s*\\)?\\s*$" ) );
1567 const QRegularExpressionMatch match = rx.match( valueAsString );
1568 if ( match.hasMatch() )
1575 if (
auto *lProject = context.
project() )
1576 return lProject->crs();
1594 const QVariant val = value;
1595 if ( val.userType() == qMetaTypeId< QgsGeometry>() )
1600 if ( val.userType() == qMetaTypeId<QgsPointXY>() )
1605 if ( val.userType() == qMetaTypeId<QgsRectangle>() )
1610 if ( val.userType() == qMetaTypeId<QgsReferencedPointXY>() )
1628 if ( val.userType() == qMetaTypeId<QgsReferencedRectangle>() )
1634 g = g.densifyByCount( 20 );
1648 if ( val.userType() == qMetaTypeId<QgsReferencedGeometry>() )
1667 if ( valueAsString.isEmpty() )
1670 if ( valueAsString.isEmpty() )
1673 const thread_local QRegularExpression rx( QStringLiteral(
"^\\s*(?:CRS=(.*);)?(.*?)$" ) );
1675 const QRegularExpressionMatch match = rx.match( valueAsString );
1676 if ( match.hasMatch() )
1703 const QVariant val = parameters.value( definition->
name() );
1709 if ( value.userType() == qMetaTypeId<QgsReferencedGeometry>() )
1718 if ( value.userType() == qMetaTypeId<QgsReferencedPointXY>() )
1727 if ( value.userType() == qMetaTypeId<QgsReferencedRectangle>() )
1737 const QRegularExpression rx( QStringLiteral(
"^\\s*(?:CRS=(.*);)?(.*?)$" ) );
1740 const QRegularExpressionMatch match = rx.match( valueAsString );
1741 if ( match.hasMatch() )
1748 if (
auto *lProject = context.
project() )
1749 return lProject->crs();
1760 if ( fileText.isEmpty() )
1771 if ( fileText.isEmpty() )
1779 return QVariantList();
1787 return QVariantList();
1789 QString resultString;
1790 const QVariant val = value;
1791 if ( val.userType() == qMetaTypeId<QgsProperty>() )
1793 else if ( val.userType() == QMetaType::Type::QVariantList )
1794 return val.toList();
1796 resultString = val.toString();
1798 if ( resultString.isEmpty() )
1801 if ( definition->
defaultValue().userType() == QMetaType::Type::QVariantList )
1807 QVariantList result;
1808 const auto constSplit = resultString.split(
',' );
1811 for (
const QString &s : constSplit )
1813 number = s.toDouble( &ok );
1814 result << ( ok ? QVariant( number ) : s );
1823 return QList<QgsMapLayer *>();
1831 return QList<QgsMapLayer *>();
1833 const QVariant val = value;
1834 if (
QgsMapLayer *layer = qobject_cast< QgsMapLayer * >( qvariant_cast<QObject *>( val ) ) )
1836 return QList<QgsMapLayer *>() << layer;
1839 QList<QgsMapLayer *> layers;
1841 std::function< void(
const QVariant &var ) > processVariant;
1842 processVariant = [ &layers, &context, &definition, flags, &processVariant](
const QVariant & var )
1844 if ( var.userType() == QMetaType::Type::QVariantList )
1846 const auto constToList = var.toList();
1847 for (
const QVariant &listVar : constToList )
1849 processVariant( listVar );
1852 else if ( var.userType() == QMetaType::Type::QStringList )
1854 const auto constToStringList = var.toStringList();
1855 for (
const QString &s : constToStringList )
1857 processVariant( s );
1860 else if ( var.userType() == qMetaTypeId<QgsProperty>() )
1862 else if ( var.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
1866 const QVariant sink = fromVar.
sink;
1867 if ( sink.userType() == qMetaTypeId<QgsProperty>() )
1872 else if (
QgsMapLayer *layer = qobject_cast< QgsMapLayer * >( qvariant_cast<QObject *>( var ) ) )
1884 processVariant( val );
1886 if ( layers.isEmpty() )
1889 if (
QgsMapLayer *layer = qobject_cast< QgsMapLayer * >( qvariant_cast<QObject *>( definition->
defaultValue() ) ) )
1893 else if ( definition->
defaultValue().userType() == QMetaType::Type::QVariantList )
1895 const auto constToList = definition->
defaultValue().toList();
1896 for (
const QVariant &var : constToList )
1898 if (
QgsMapLayer *layer = qobject_cast< QgsMapLayer * >( qvariant_cast<QObject *>( var ) ) )
1904 processVariant( var );
1918 return QStringList();
1920 const QVariant val = value;
1924 std::function< void(
const QVariant &var ) > processVariant;
1925 processVariant = [ &files, &context, &definition, &processVariant ](
const QVariant & var )
1927 if ( var.userType() == QMetaType::Type::QVariantList )
1929 const auto constToList = var.toList();
1930 for (
const QVariant &listVar : constToList )
1932 processVariant( listVar );
1935 else if ( var.userType() == QMetaType::Type::QStringList )
1937 const auto constToStringList = var.toStringList();
1938 for (
const QString &s : constToStringList )
1940 processVariant( s );
1943 else if ( var.userType() == qMetaTypeId<QgsProperty>() )
1947 files << var.toString();
1951 processVariant( val );
1953 if ( files.isEmpty() )
1964 return QStringList();
1972 return QList<double>();
1980 return QList<double>();
1982 QStringList resultStringList;
1983 const QVariant val = value;
1985 if ( val.userType() == qMetaTypeId<QgsProperty>() )
1987 else if ( val.userType() == QMetaType::Type::QVariantList )
1989 const auto constToList = val.toList();
1990 for (
const QVariant &var : constToList )
1991 resultStringList << var.toString();
1994 resultStringList << val.toString();
1996 if ( ( resultStringList.isEmpty() || ( resultStringList.size() == 1 && resultStringList.at( 0 ).isEmpty() ) ) )
1998 resultStringList.clear();
2000 if ( definition->
defaultValue().userType() == QMetaType::Type::QVariantList )
2002 const auto constToList = definition->
defaultValue().toList();
2003 for (
const QVariant &var : constToList )
2004 resultStringList << var.toString();
2007 resultStringList << definition->
defaultValue().toString();
2010 if ( resultStringList.size() == 1 )
2012 resultStringList = resultStringList.at( 0 ).split(
',' );
2015 if ( resultStringList.size() < 2 )
2016 return QList< double >() << std::numeric_limits<double>::quiet_NaN() << std::numeric_limits<double>::quiet_NaN() ;
2018 QList< double > result;
2020 double n = resultStringList.at( 0 ).toDouble( &ok );
2024 result << std::numeric_limits<double>::quiet_NaN() ;
2026 n = resultStringList.at( 1 ).toDouble( &ok );
2030 result << std::numeric_limits<double>::quiet_NaN() ;
2038 return QStringList();
2051 return QStringList();
2059 return QStringList();
2061 QStringList resultStringList;
2062 const QVariant val = value;
2063 if ( val.isValid() )
2065 if ( val.userType() == qMetaTypeId<QgsProperty>() )
2067 else if ( val.userType() == QMetaType::Type::QVariantList )
2069 const auto constToList = val.toList();
2070 for (
const QVariant &var : constToList )
2071 resultStringList << var.toString();
2073 else if ( val.userType() == QMetaType::Type::QStringList )
2075 resultStringList = val.toStringList();
2078 resultStringList.append( val.toString().split(
';' ) );
2081 if ( ( resultStringList.isEmpty() || resultStringList.at( 0 ).isEmpty() ) )
2083 resultStringList.clear();
2087 if ( definition->
defaultValue().userType() == QMetaType::Type::QVariantList )
2089 const auto constToList = definition->
defaultValue().toList();
2090 for (
const QVariant &var : constToList )
2091 resultStringList << var.toString();
2093 else if ( definition->
defaultValue().userType() == QMetaType::Type::QStringList )
2095 resultStringList = definition->
defaultValue().toStringList();
2098 resultStringList.append( definition->
defaultValue().toString().split(
';' ) );
2102 return resultStringList;
2116 if ( layoutName.isEmpty() )
2168 QVariant val = value;
2169 if ( val.userType() == qMetaTypeId<QgsProperty>() )
2173 if ( val.userType() == QMetaType::Type::QColor )
2175 QColor
c = val.value< QColor >();
2177 if ( !colorParam->opacityEnabled() )
2185 if ( definition->
defaultValue().userType() == QMetaType::Type::QColor )
2191 if ( colorText.isEmpty() )
2194 bool containsAlpha =
false;
2197 if (
c.isValid() && !colorParam->opacityEnabled() )
2269 const QString type = map.value( QStringLiteral(
"parameter_type" ) ).toString();
2270 const QString name = map.value( QStringLiteral(
"name" ) ).toString();
2271 std::unique_ptr< QgsProcessingParameterDefinition > def;
2277 def = std::make_unique<QgsProcessingParameterBoolean>( name );
2279 def = std::make_unique<QgsProcessingParameterCrs>( name );
2281 def = std::make_unique<QgsProcessingParameterMapLayer>( name );
2283 def = std::make_unique<QgsProcessingParameterExtent>( name );
2285 def = std::make_unique<QgsProcessingParameterPoint>( name );
2287 def = std::make_unique<QgsProcessingParameterFile>( name );
2289 def = std::make_unique<QgsProcessingParameterMatrix>( name );
2291 def = std::make_unique<QgsProcessingParameterMultipleLayers>( name );
2293 def = std::make_unique<QgsProcessingParameterNumber>( name );
2295 def = std::make_unique<QgsProcessingParameterRange>( name );
2297 def = std::make_unique<QgsProcessingParameterRasterLayer>( name );
2299 def = std::make_unique<QgsProcessingParameterEnum>( name );
2301 def = std::make_unique<QgsProcessingParameterString>( name );
2303 def = std::make_unique<QgsProcessingParameterAuthConfig>( name );
2305 def = std::make_unique<QgsProcessingParameterExpression>( name );
2307 def = std::make_unique<QgsProcessingParameterVectorLayer>( name );
2309 def = std::make_unique<QgsProcessingParameterField>( name );
2311 def = std::make_unique<QgsProcessingParameterFeatureSource>( name );
2313 def = std::make_unique<QgsProcessingParameterFeatureSink>( name );
2315 def = std::make_unique<QgsProcessingParameterVectorDestination>( name );
2317 def = std::make_unique<QgsProcessingParameterRasterDestination>( name );
2319 def = std::make_unique<QgsProcessingParameterPointCloudDestination>( name );
2321 def = std::make_unique<QgsProcessingParameterFileDestination>( name );
2323 def = std::make_unique<QgsProcessingParameterFolderDestination>( name );
2325 def = std::make_unique<QgsProcessingParameterBand>( name );
2327 def = std::make_unique<QgsProcessingParameterMeshLayer>( name );
2329 def = std::make_unique<QgsProcessingParameterLayout>( name );
2331 def = std::make_unique<QgsProcessingParameterLayoutItem>( name );
2333 def = std::make_unique<QgsProcessingParameterColor>( name );
2335 def = std::make_unique<QgsProcessingParameterCoordinateOperation>( name );
2337 def = std::make_unique<QgsProcessingParameterPointCloudLayer>( name );
2339 def = std::make_unique<QgsProcessingParameterAnnotationLayer>( name );
2341 def = std::make_unique<QgsProcessingParameterPointCloudAttribute>( name );
2343 def = std::make_unique<QgsProcessingParameterVectorTileDestination>( name );
2348 def.reset( paramType->
create( name ) );
2354 def->fromVariantMap( map );
2355 return def.release();
2360 QString desc = name;
2361 desc.replace(
'_',
' ' );
2367 bool isOptional =
false;
2371 if ( !parseScriptCodeParameterOptions( code, isOptional, name, type, definition ) )
2376 if ( type == QLatin1String(
"boolean" ) )
2378 else if ( type == QLatin1String(
"crs" ) )
2380 else if ( type == QLatin1String(
"layer" ) )
2382 else if ( type == QLatin1String(
"extent" ) )
2384 else if ( type == QLatin1String(
"point" ) )
2386 else if ( type == QLatin1String(
"geometry" ) )
2388 else if ( type == QLatin1String(
"file" ) )
2390 else if ( type == QLatin1String(
"folder" ) )
2392 else if ( type == QLatin1String(
"matrix" ) )
2394 else if ( type == QLatin1String(
"multiple" ) )
2396 else if ( type == QLatin1String(
"number" ) )
2398 else if ( type == QLatin1String(
"distance" ) )
2400 else if ( type == QLatin1String(
"area" ) )
2402 else if ( type == QLatin1String(
"volume" ) )
2404 else if ( type == QLatin1String(
"duration" ) )
2406 else if ( type == QLatin1String(
"scale" ) )
2408 else if ( type == QLatin1String(
"range" ) )
2410 else if ( type == QLatin1String(
"raster" ) )
2412 else if ( type == QLatin1String(
"enum" ) )
2414 else if ( type == QLatin1String(
"string" ) )
2416 else if ( type == QLatin1String(
"authcfg" ) )
2418 else if ( type == QLatin1String(
"expression" ) )
2420 else if ( type == QLatin1String(
"field" ) )
2422 else if ( type == QLatin1String(
"vector" ) )
2424 else if ( type == QLatin1String(
"source" ) )
2426 else if ( type == QLatin1String(
"sink" ) )
2428 else if ( type == QLatin1String(
"vectordestination" ) )
2430 else if ( type == QLatin1String(
"rasterdestination" ) )
2432 else if ( type == QLatin1String(
"pointclouddestination" ) )
2434 else if ( type == QLatin1String(
"filedestination" ) )
2436 else if ( type == QLatin1String(
"folderdestination" ) )
2438 else if ( type == QLatin1String(
"band" ) )
2440 else if ( type == QLatin1String(
"mesh" ) )
2442 else if ( type == QLatin1String(
"layout" ) )
2444 else if ( type == QLatin1String(
"layoutitem" ) )
2446 else if ( type == QLatin1String(
"color" ) )
2448 else if ( type == QLatin1String(
"coordinateoperation" ) )
2450 else if ( type == QLatin1String(
"maptheme" ) )
2452 else if ( type == QLatin1String(
"datetime" ) )
2454 else if ( type == QLatin1String(
"providerconnection" ) )
2456 else if ( type == QLatin1String(
"databaseschema" ) )
2458 else if ( type == QLatin1String(
"databasetable" ) )
2460 else if ( type == QLatin1String(
"pointcloud" ) )
2462 else if ( type == QLatin1String(
"annotation" ) )
2464 else if ( type == QLatin1String(
"attribute" ) )
2466 else if ( type == QLatin1String(
"vectortiledestination" ) )
2472bool QgsProcessingParameters::parseScriptCodeParameterOptions(
const QString &code,
bool &isOptional, QString &name, QString &type, QString &definition )
2474 const thread_local QRegularExpression re( QStringLiteral(
"(?:#*)(.*?)=\\s*(.*)" ) );
2475 QRegularExpressionMatch m = re.match( code );
2476 if ( !m.hasMatch() )
2479 name = m.captured( 1 );
2480 QString tokens = m.captured( 2 );
2481 if ( tokens.startsWith( QLatin1String(
"optional" ), Qt::CaseInsensitive ) )
2484 tokens.remove( 0, 8 );
2491 tokens = tokens.trimmed();
2493 const thread_local QRegularExpression re2( QStringLiteral(
"(.*?)\\s+(.*)" ) );
2494 m = re2.match( tokens );
2495 if ( !m.hasMatch() )
2497 type = tokens.toLower().trimmed();
2502 type = m.captured( 1 ).toLower().trimmed();
2503 definition = m.captured( 2 );
2517 ,
mFlags( optional ?
Qgis::ProcessingParameterFlag::Optional :
Qgis::ProcessingParameterFlag() )
2523 if ( defaultSettingsValue.isValid() )
2525 return defaultSettingsValue;
2533 if ( defaultSettingsValue.isValid() )
2535 return defaultSettingsValue;
2545 QVariant settingValue = s.
value( QStringLiteral(
"/Processing/DefaultGuiParam/%1/%2" ).arg(
mAlgorithm->id() ).arg(
mName ) );
2546 if ( settingValue.isValid() )
2548 return settingValue;
2556 if ( !input.isValid() && !
mDefault.isValid() )
2559 if ( ( input.userType() == QMetaType::Type::QString && input.toString().isEmpty() )
2560 || ( !input.isValid() &&
mDefault.userType() == QMetaType::Type::QString &&
mDefault.toString().isEmpty() ) )
2568 if ( !value.isValid() )
2569 return QStringLiteral(
"None" );
2571 if ( value.userType() == qMetaTypeId<QgsProperty>() )
2572 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( value.value<
QgsProperty >().
asExpression() );
2584 if ( !value.isValid() )
2588 if ( value.userType() == QMetaType::Type::QVariantMap )
2590 const QVariantMap sourceMap = value.toMap();
2591 QVariantMap resultMap;
2592 for (
auto it = sourceMap.constBegin(); it != sourceMap.constEnd(); it++ )
2598 else if ( value.userType() == QMetaType::Type::QVariantList || value.userType() == QMetaType::Type::QStringList )
2600 const QVariantList sourceList = value.toList();
2601 QVariantList resultList;
2602 resultList.reserve( sourceList.size() );
2603 for (
const QVariant &v : sourceList )
2611 switch ( value.userType() )
2614 case QMetaType::Bool:
2615 case QMetaType::Char:
2616 case QMetaType::Int:
2617 case QMetaType::Double:
2618 case QMetaType::Float:
2619 case QMetaType::LongLong:
2620 case QMetaType::ULongLong:
2621 case QMetaType::UInt:
2622 case QMetaType::ULong:
2623 case QMetaType::UShort:
2630 if ( value.userType() == qMetaTypeId<QgsProperty>() )
2640 return QVariantMap( {{QStringLiteral(
"type" ), QStringLiteral(
"data_defined" )}, {QStringLiteral(
"field" ), prop.
field() }} );
2642 return QVariantMap( {{QStringLiteral(
"type" ), QStringLiteral(
"data_defined" )}, {QStringLiteral(
"expression" ), prop.
expressionString() }} );
2647 if ( value.userType() == qMetaTypeId<QgsCoordinateReferenceSystem>() )
2652 else if ( !crs.
authid().isEmpty() )
2657 else if ( value.userType() == qMetaTypeId<QgsRectangle>() )
2665 else if ( value.userType() == qMetaTypeId<QgsReferencedRectangle>() )
2674 else if ( value.userType() == qMetaTypeId< QgsGeometry>() )
2686 else if ( value.userType() == qMetaTypeId<QgsReferencedGeometry>() )
2701 else if ( value.userType() == qMetaTypeId<QgsPointXY>() )
2707 else if ( value.userType() == qMetaTypeId<QgsReferencedPointXY>() )
2714 else if ( value.userType() == qMetaTypeId<QgsProcessingFeatureSourceDefinition>() )
2721 else if ( value.userType() == qMetaTypeId<QgsProcessingRasterLayerDefinition>() )
2728 else if ( value.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
2733 else if ( value.userType() == qMetaTypeId<QColor>() )
2735 const QColor fromVar = value.value< QColor >();
2736 if ( !fromVar.isValid() )
2739 return QStringLiteral(
"rgba( %1, %2, %3, %4 )" ).arg( fromVar.red() ).arg( fromVar.green() ).arg( fromVar.blue() ).arg( QString::number( fromVar.alphaF(),
'f', 2 ) );
2741 else if ( value.userType() == qMetaTypeId<QDateTime>() )
2743 const QDateTime fromVar = value.toDateTime();
2744 if ( !fromVar.isValid() )
2747 return fromVar.toString( Qt::ISODate );
2749 else if ( value.userType() == qMetaTypeId<QDate>() )
2751 const QDate fromVar = value.toDate();
2752 if ( !fromVar.isValid() )
2755 return fromVar.toString( Qt::ISODate );
2757 else if ( value.userType() == qMetaTypeId<QTime>() )
2759 const QTime fromVar = value.toTime();
2760 if ( !fromVar.isValid() )
2763 return fromVar.toString( Qt::ISODate );
2770 p.insert(
name(), value );
2778 if ( value.userType() == QMetaType::QString )
2783 Q_ASSERT_X(
false,
"QgsProcessingParameterDefinition::valueAsJsonObject", QStringLiteral(
"unsupported variant type %1" ).arg( QMetaType::typeName( value.userType() ) ).toLocal8Bit() );
2796 if ( !value.isValid() )
2799 switch ( value.userType() )
2802 case QMetaType::Bool:
2803 case QMetaType::Char:
2804 case QMetaType::Int:
2805 case QMetaType::Double:
2806 case QMetaType::Float:
2807 case QMetaType::LongLong:
2808 case QMetaType::ULongLong:
2809 case QMetaType::UInt:
2810 case QMetaType::ULong:
2811 case QMetaType::UShort:
2812 return value.toString();
2818 if ( value.userType() == qMetaTypeId<QgsProperty>() )
2828 return QStringLiteral(
"field:%1" ).arg( prop.
field() );
2835 if ( value.userType() == qMetaTypeId<QgsCoordinateReferenceSystem>() )
2840 else if ( !crs.
authid().isEmpty() )
2845 else if ( value.userType() == qMetaTypeId<QgsRectangle>() )
2853 else if ( value.userType() == qMetaTypeId<QgsReferencedRectangle>() )
2861 else if ( value.userType() == qMetaTypeId< QgsGeometry>() )
2873 else if ( value.userType() == qMetaTypeId<QgsReferencedGeometry>() )
2888 else if ( value.userType() == qMetaTypeId<QgsPointXY>() )
2894 else if ( value.userType() == qMetaTypeId<QgsReferencedPointXY>() )
2901 else if ( value.userType() == qMetaTypeId<QgsProcessingFeatureSourceDefinition>() )
2906 else if ( value.userType() == qMetaTypeId<QgsProcessingRasterLayerDefinition>() )
2911 else if ( value.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
2916 else if ( value.userType() == qMetaTypeId<QColor>() )
2918 const QColor fromVar = value.value< QColor >();
2919 if ( !fromVar.isValid() )
2922 return QStringLiteral(
"rgba( %1, %2, %3, %4 )" ).arg( fromVar.red() ).arg( fromVar.green() ).arg( fromVar.blue() ).arg( QString::number( fromVar.alphaF(),
'f', 2 ) );
2924 else if ( value.userType() == qMetaTypeId<QDateTime>() )
2926 const QDateTime fromVar = value.toDateTime();
2927 if ( !fromVar.isValid() )
2930 return fromVar.toString( Qt::ISODate );
2932 else if ( value.userType() == qMetaTypeId<QDate>() )
2934 const QDate fromVar = value.toDate();
2935 if ( !fromVar.isValid() )
2938 return fromVar.toString( Qt::ISODate );
2940 else if ( value.userType() == qMetaTypeId<QTime>() )
2942 const QTime fromVar = value.toTime();
2943 if ( !fromVar.isValid() )
2946 return fromVar.toString( Qt::ISODate );
2953 p.insert(
name(), value );
2961 if ( value.userType() == QMetaType::QString )
2962 return value.toString();
2965 QgsDebugError( QStringLiteral(
"unsupported variant type %1" ).arg( QMetaType::typeName( value.userType() ) ) );
2967 return value.toString();
2973 if ( !value.isValid( ) )
2974 return QStringList();
2976 if ( value.userType() == QMetaType::Type::QVariantList || value.userType() == QMetaType::Type::QStringList )
2978 const QVariantList sourceList = value.toList();
2979 QStringList resultList;
2980 resultList.reserve( sourceList.size() );
2981 for (
const QVariant &v : sourceList )
2990 return QStringList();
3002 QString code = QStringLiteral(
"##%1=" ).arg(
mName );
3004 code += QLatin1String(
"optional " );
3005 code +=
type() +
' ';
3007 return code.trimmed();
3015 switch ( outputType )
3019 QString code = t->className() + QStringLiteral(
"('%1', %2" )
3022 code += QLatin1String(
", optional=True" );
3038 map.insert( QStringLiteral(
"parameter_type" ),
type() );
3039 map.insert( QStringLiteral(
"name" ),
mName );
3040 map.insert( QStringLiteral(
"description" ),
mDescription );
3041 map.insert( QStringLiteral(
"help" ),
mHelp );
3042 map.insert( QStringLiteral(
"default" ),
mDefault );
3043 map.insert( QStringLiteral(
"defaultGui" ),
mGuiDefault );
3044 map.insert( QStringLiteral(
"flags" ),
static_cast< int >(
mFlags ) );
3045 map.insert( QStringLiteral(
"metadata" ),
mMetadata );
3051 mName = map.value( QStringLiteral(
"name" ) ).toString();
3052 mDescription = map.value( QStringLiteral(
"description" ) ).toString();
3053 mHelp = map.value( QStringLiteral(
"help" ) ).toString();
3054 mDefault = map.value( QStringLiteral(
"default" ) );
3055 mGuiDefault = map.value( QStringLiteral(
"defaultGui" ) );
3057 mMetadata = map.value( QStringLiteral(
"metadata" ) ).toMap();
3073 QString text = QStringLiteral(
"<p><b>%1</b></p>" ).arg(
description() );
3074 if ( !
help().isEmpty() )
3076 text += QStringLiteral(
"<p>%1</p>" ).arg(
help() );
3078 text += QStringLiteral(
"<p>%1</p>" ).arg( QObject::tr(
"Python identifier: ‘%1’" ).arg( QStringLiteral(
"<i>%1</i>" ).arg(
name() ) ) );
3107 if ( value.userType() == qMetaTypeId<QgsPointXY>() )
3114 else if ( value.userType() == qMetaTypeId<QgsReferencedPointXY>() )
3117 return QStringLiteral(
"%1, %2 [%3]" ).arg(
3124 else if ( value.userType() == qMetaTypeId<QgsRectangle>() )
3130 else if ( value.userType() == qMetaTypeId<QgsReferencedRectangle>() )
3141 else if ( value.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
3154 return value.toString();
3160 if ( !val.isValid() )
3161 return QStringLiteral(
"None" );
3163 if ( val.userType() == qMetaTypeId<QgsProperty>() )
3165 return val.toBool() ? QStringLiteral(
"True" ) : QStringLiteral(
"False" );
3170 QString code = QStringLiteral(
"##%1=" ).arg(
mName );
3172 code += QLatin1String(
"optional " );
3173 code +=
type() +
' ';
3174 code +=
mDefault.toBool() ? QStringLiteral(
"true" ) : QStringLiteral(
"false" );
3175 return code.trimmed();
3197 if ( !input.isValid() )
3205 if ( input.userType() == qMetaTypeId<QgsCoordinateReferenceSystem>() )
3209 else if ( input.userType() == qMetaTypeId<QgsProcessingFeatureSourceDefinition>() )
3213 else if ( input.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
3218 if ( input.userType() == qMetaTypeId<QgsProperty>() )
3223 if ( input.type() == QVariant::String )
3225 const QString
string = input.toString();
3226 if (
string.compare( QLatin1String(
"ProjectCrs" ), Qt::CaseInsensitive ) == 0 )
3235 if ( qobject_cast< QgsMapLayer * >( qvariant_cast<QObject *>( input ) ) )
3238 if ( input.userType() != QMetaType::Type::QString || input.toString().isEmpty() )
3246 if ( !value.isValid() )
3247 return QStringLiteral(
"None" );
3249 if ( value.userType() == qMetaTypeId<QgsCoordinateReferenceSystem>() )
3252 return QStringLiteral(
"QgsCoordinateReferenceSystem()" );
3257 if ( value.userType() == qMetaTypeId<QgsProperty>() )
3258 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( value.value<
QgsProperty >().
asExpression() );
3260 if ( value.type() == QVariant::String )
3262 const QString
string = value.toString();
3263 if (
string.compare( QLatin1String(
"ProjectCrs" ), Qt::CaseInsensitive ) == 0 )
3272 p.insert(
name(), value );
3282 if ( value.type() == QVariant::String )
3284 const QString
string = value.toString();
3285 if (
string.compare( QLatin1String(
"ProjectCrs" ), Qt::CaseInsensitive ) == 0 )
3298 if ( value.type() == QVariant::String )
3300 const QString
string = value.toString();
3301 if (
string.compare( QLatin1String(
"ProjectCrs" ), Qt::CaseInsensitive ) == 0 )
3327 return QObject::tr(
"Invalid CRS" );
3348 if ( !input.isValid() )
3356 if ( input.userType() == qMetaTypeId<QgsProperty>() )
3361 if ( qobject_cast< QgsMapLayer * >( qvariant_cast<QObject *>( input ) ) )
3366 if ( input.userType() != QMetaType::Type::QString || input.toString().isEmpty() )
3384 if ( !val.isValid() )
3385 return QStringLiteral(
"None" );
3387 if ( val.userType() == qMetaTypeId<QgsProperty>() )
3391 p.insert(
name(), val );
3411 for (
const QString &raster : rasters )
3413 if ( !vectors.contains( raster ) )
3417 for (
const QString &mesh : meshFilters )
3419 if ( !vectors.contains( mesh ) )
3423 for (
const QString &pointCloud : pointCloudFilters )
3425 if ( !vectors.contains( pointCloud ) )
3426 vectors << pointCloud;
3428 vectors.removeAll( QObject::tr(
"All files (*.*)" ) );
3429 std::sort( vectors.begin(), vectors.end() );
3431 return QObject::tr(
"All files (*.*)" ) + QStringLiteral(
";;" ) + vectors.join( QLatin1String(
";;" ) );
3441 QString code = QStringLiteral(
"##%1=" ).arg(
mName );
3443 code += QLatin1String(
"optional " );
3444 code += QLatin1String(
"layer " );
3451 code += QLatin1String(
"table " );
3455 code += QLatin1String(
"hasgeometry " );
3459 code += QLatin1String(
"point " );
3463 code += QLatin1String(
"line " );
3467 code += QLatin1String(
"polygon " );
3471 code += QLatin1String(
"raster " );
3475 code += QLatin1String(
"mesh " );
3479 code += QLatin1String(
"plugin " );
3483 code += QLatin1String(
"pointcloud " );
3487 code += QLatin1String(
"annotation " );
3491 code += QLatin1String(
"vectortile " );
3495 code += QLatin1String(
"tiledscene " );
3504 return code.trimmed();
3510 QString def = definition;
3513 if ( def.startsWith( QLatin1String(
"table" ), Qt::CaseInsensitive ) )
3519 if ( def.startsWith( QLatin1String(
"hasgeometry" ), Qt::CaseInsensitive ) )
3522 def = def.mid( 12 );
3525 else if ( def.startsWith( QLatin1String(
"point" ), Qt::CaseInsensitive ) )
3531 else if ( def.startsWith( QLatin1String(
"line" ), Qt::CaseInsensitive ) )
3537 else if ( def.startsWith( QLatin1String(
"polygon" ), Qt::CaseInsensitive ) )
3543 else if ( def.startsWith( QLatin1String(
"raster" ), Qt::CaseInsensitive ) )
3549 else if ( def.startsWith( QLatin1String(
"mesh" ), Qt::CaseInsensitive ) )
3555 else if ( def.startsWith( QLatin1String(
"plugin" ), Qt::CaseInsensitive ) )
3561 else if ( def.startsWith( QLatin1String(
"pointcloud" ), Qt::CaseInsensitive ) )
3564 def = def.mid( 11 );
3567 else if ( def.startsWith( QLatin1String(
"annotation" ), Qt::CaseInsensitive ) )
3570 def = def.mid( 11 );
3573 else if ( def.startsWith( QLatin1String(
"vectortile" ), Qt::CaseInsensitive ) )
3576 def = def.mid( 11 );
3579 else if ( def.startsWith( QLatin1String(
"tiledscene" ), Qt::CaseInsensitive ) )
3582 def = def.mid( 11 );
3593 switch ( outputType )
3597 QString code = QStringLiteral(
"QgsProcessingParameterMapLayer('%1', %2" )
3600 code += QLatin1String(
", optional=True" );
3607 QStringList options;
3611 code += QStringLiteral(
", types=[%1])" ).arg( options.join(
',' ) );
3615 code += QLatin1Char(
')' );
3632 map.insert( QStringLiteral(
"data_types" ), types );
3640 const QVariantList values = map.value( QStringLiteral(
"data_types" ) ).toList();
3641 for (
const QVariant &val : values )
3662 if ( !input.isValid() )
3670 if ( input.userType() == qMetaTypeId<QgsProcessingFeatureSourceDefinition>() )
3674 else if ( input.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
3679 if ( input.userType() == qMetaTypeId<QgsProperty>() )
3684 if ( input.userType() == qMetaTypeId<QgsRectangle>() )
3689 if ( input.userType() == qMetaTypeId< QgsGeometry>() )
3693 if ( input.userType() == qMetaTypeId<QgsReferencedRectangle>() )
3700 if ( qobject_cast< QgsMapLayer * >( qvariant_cast<QObject *>( input ) ) )
3703 if ( input.userType() != QMetaType::Type::QString || input.toString().isEmpty() )
3706 if ( variantIsValidStringForExtent( input ) )
3719bool QgsProcessingParameterExtent::variantIsValidStringForExtent(
const QVariant &value )
3721 if ( value.userType() == QMetaType::Type::QString )
3723 const thread_local QRegularExpression rx( QStringLiteral(
"^(.*?)\\s*,\\s*(.*?)\\s*,\\s*(.*?)\\s*,\\s*(.*?)\\s*(?:\\[(.*)\\])?\\s*$" ) );
3724 const QRegularExpressionMatch match = rx.match( value.toString() );
3725 if ( match.hasMatch() )
3727 bool xMinOk =
false;
3728 ( void )match.captured( 1 ).toDouble( &xMinOk );
3729 bool xMaxOk =
false;
3730 ( void )match.captured( 2 ).toDouble( &xMaxOk );
3731 bool yMinOk =
false;
3732 ( void )match.captured( 3 ).toDouble( &yMinOk );
3733 bool yMaxOk =
false;
3734 ( void )match.captured( 4 ).toDouble( &yMaxOk );
3735 if ( xMinOk && xMaxOk && yMinOk && yMaxOk )
3744 if ( !value.isValid() )
3745 return QStringLiteral(
"None" );
3747 if ( value.userType() == qMetaTypeId<QgsProperty>() )
3748 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( value.value<
QgsProperty >().
asExpression() );
3750 if ( value.userType() == qMetaTypeId<QgsRectangle>() )
3758 else if ( value.userType() == qMetaTypeId<QgsReferencedRectangle>() )
3767 else if ( value.userType() == qMetaTypeId< QgsGeometry>() )
3772 const QString wkt = g.
asWkt();
3773 return QStringLiteral(
"QgsGeometry.fromWkt('%1')" ).arg( wkt );
3776 else if ( variantIsValidStringForExtent( value ) )
3782 p.insert(
name(), value );
3792 if ( variantIsValidStringForExtent( value ) )
3794 return value.toString();
3802 if ( variantIsValidStringForExtent( value ) )
3829 if ( !input.isValid() )
3837 if ( input.userType() == qMetaTypeId<QgsProperty>() )
3842 if ( input.userType() == qMetaTypeId<QgsPointXY>() )
3846 if ( input.userType() == qMetaTypeId<QgsReferencedPointXY>() )
3850 if ( input.userType() == qMetaTypeId< QgsGeometry>() )
3855 if ( input.userType() == QMetaType::Type::QString )
3857 if ( input.toString().isEmpty() )
3861 const thread_local QRegularExpression rx( QStringLiteral(
"^\\s*\\(?\\s*(.*?)\\s*,\\s*(.*?)\\s*(?:\\[(.*)\\])?\\s*\\)?\\s*$" ) );
3863 const QRegularExpressionMatch match = rx.match( input.toString() );
3864 if ( match.hasMatch() )
3867 ( void )match.captured( 1 ).toDouble( &xOk );
3869 ( void )match.captured( 2 ).toDouble( &yOk );
3878 if ( !value.isValid() )
3879 return QStringLiteral(
"None" );
3881 if ( value.userType() == qMetaTypeId<QgsProperty>() )
3882 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( value.value<
QgsProperty >().
asExpression() );
3884 if ( value.userType() == qMetaTypeId<QgsPointXY>() )
3890 else if ( value.userType() == qMetaTypeId<QgsReferencedPointXY>() )
3897 else if ( value.userType() == qMetaTypeId< QgsGeometry>() )
3902 const QString wkt = g.
asWkt();
3903 return QStringLiteral(
"QgsGeometry.fromWkt('%1')" ).arg( wkt );
3933 if ( !input.isValid() )
3941 if ( input.userType() == qMetaTypeId<QgsProperty>() )
3948 if ( input.userType() == qMetaTypeId< QgsGeometry>() )
3950 return ( anyTypeAllowed || mGeomTypes.contains(
static_cast< int >( input.value<
QgsGeometry>().
type() ) ) ) &&
3954 if ( input.userType() == qMetaTypeId<QgsReferencedGeometry>() )
3960 if ( input.userType() == qMetaTypeId<QgsPointXY>() )
3965 if ( input.userType() == qMetaTypeId<QgsRectangle>() )
3970 if ( input.userType() == qMetaTypeId<QgsReferencedPointXY>() )
3975 if ( input.userType() == qMetaTypeId<QgsReferencedRectangle>() )
3980 if ( input.userType() == QMetaType::Type::QString )
3982 if ( input.toString().isEmpty() )
3987 const thread_local QRegularExpression rx( QStringLiteral(
"^\\s*(?:CRS=(.*);)?(.*?)$" ) );
3989 const QRegularExpressionMatch match = rx.match( input.toString() );
3990 if ( match.hasMatch() )
3995 return ( anyTypeAllowed || mGeomTypes.contains(
static_cast< int >( g.
type() ) ) ) && ( mAllowMultipart || !g.
isMultipart() );
4009 if ( !crs.isValid() )
4015 if ( !value.isValid() )
4016 return QStringLiteral(
"None" );
4018 if ( value.userType() == qMetaTypeId<QgsProperty>() )
4021 if ( value.userType() == qMetaTypeId< QgsGeometry>() )
4028 if ( value.userType() == qMetaTypeId<QgsReferencedGeometry>() )
4035 if ( value.userType() == qMetaTypeId<QgsPointXY>() )
4042 if ( value.userType() == qMetaTypeId<QgsReferencedPointXY>() )
4049 if ( value.userType() == qMetaTypeId<QgsRectangle>() )
4056 if ( value.userType() == qMetaTypeId<QgsReferencedRectangle>() )
4068 QString code = QStringLiteral(
"##%1=" ).arg(
mName );
4070 code += QLatin1String(
"optional " );
4071 code +=
type() +
' ';
4073 for (
const int type : mGeomTypes )
4078 code += QLatin1String(
"point " );
4082 code += QLatin1String(
"line " );
4086 code += QLatin1String(
"polygon " );
4090 code += QLatin1String(
"unknown " );
4096 return code.trimmed();
4101 switch ( outputType )
4105 QString code = QStringLiteral(
"QgsProcessingParameterGeometry('%1', %2" )
4108 code += QLatin1String(
", optional=True" );
4110 if ( !mGeomTypes.empty() )
4117 return QStringLiteral(
"PointGeometry" );
4120 return QStringLiteral(
"LineGeometry" );
4123 return QStringLiteral(
"PolygonGeometry" );
4126 return QStringLiteral(
"UnknownGeometry" );
4129 return QStringLiteral(
"NullGeometry" );
4134 QStringList options;
4135 options.reserve( mGeomTypes.size() );
4136 for (
const int type : mGeomTypes )
4138 options << QStringLiteral(
" QgsWkbTypes.%1" ).arg( geomTypeToString(
static_cast<Qgis::GeometryType>(
type ) ) );
4140 code += QStringLiteral(
", geometryTypes=[%1 ]" ).arg( options.join(
',' ) );
4143 if ( ! mAllowMultipart )
4145 code += QLatin1String(
", allowMultipart=False" );
4160 for (
const int type : mGeomTypes )
4164 map.insert( QStringLiteral(
"geometrytypes" ), types );
4165 map.insert( QStringLiteral(
"multipart" ), mAllowMultipart );
4173 const QVariantList values = map.value( QStringLiteral(
"geometrytypes" ) ).toList();
4174 for (
const QVariant &val : values )
4176 mGeomTypes << val.toInt();
4178 mAllowMultipart = map.value( QStringLiteral(
"multipart" ) ).toBool();
4192 if ( value.isValid() )
4195 if ( value.userType() == qMetaTypeId< QgsGeometry>() )
4201 else if ( value.userType() == qMetaTypeId<QgsReferencedGeometry>() )
4211 else if ( value.userType() == QMetaType::QString )
4223 return QObject::tr(
"Invalid geometry" );
4243 if ( !input.isValid() )
4251 if ( input.userType() == qMetaTypeId<QgsProperty>() )
4256 const QString
string = input.toString().trimmed();
4258 if ( input.userType() != QMetaType::Type::QString ||
string.isEmpty() )
4261 switch ( mBehavior )
4265 if ( !mExtension.isEmpty() )
4267 return string.endsWith( mExtension, Qt::CaseInsensitive );
4269 else if ( !mFileFilter.isEmpty() )
4287 QString code = QStringLiteral(
"##%1=" ).arg(
mName );
4289 code += QLatin1String(
"optional " );
4292 return code.trimmed();
4297 switch ( outputType )
4302 QString code = QStringLiteral(
"QgsProcessingParameterFile('%1', %2" )
4305 code += QLatin1String(
", optional=True" );
4306 code += QStringLiteral(
", behavior=%1" ).arg( mBehavior ==
Qgis::ProcessingFileParameterBehavior::File ? QStringLiteral(
"QgsProcessingParameterFile.File" ) : QStringLiteral(
"QgsProcessingParameterFile.Folder" ) );
4307 if ( !mExtension.isEmpty() )
4308 code += QStringLiteral(
", extension='%1'" ).arg( mExtension );
4309 if ( !mFileFilter.isEmpty() )
4310 code += QStringLiteral(
", fileFilter='%1'" ).arg( mFileFilter );
4321 switch ( mBehavior )
4325 if ( !mFileFilter.isEmpty() )
4326 return mFileFilter != QObject::tr(
"All files (*.*)" ) ? mFileFilter + QStringLiteral(
";;" ) + QObject::tr(
"All files (*.*)" ) : mFileFilter;
4327 else if ( !mExtension.isEmpty() )
4328 return QObject::tr(
"%1 files" ).arg( mExtension.toUpper() ) + QStringLiteral(
" (*." ) + mExtension.toLower() + QStringLiteral(
");;" ) + QObject::tr(
"All files (*.*)" );
4330 return QObject::tr(
"All files (*.*)" );
4342 mFileFilter.clear();
4352 mFileFilter = filter;
4359 map.insert( QStringLiteral(
"behavior" ),
static_cast< int >( mBehavior ) );
4360 map.insert( QStringLiteral(
"extension" ), mExtension );
4361 map.insert( QStringLiteral(
"filefilter" ), mFileFilter );
4369 mExtension = map.value( QStringLiteral(
"extension" ) ).toString();
4370 mFileFilter = map.value( QStringLiteral(
"filefilter" ) ).toString();
4383 , mFixedNumberRows( fixedNumberRows )
4396 if ( !input.isValid() )
4404 if ( input.userType() == QMetaType::Type::QString )
4406 if ( input.toString().isEmpty() )
4410 else if ( input.userType() == QMetaType::Type::QVariantList )
4412 if ( input.toList().isEmpty() )
4416 else if ( input.userType() == QMetaType::Type::Double || input.userType() == QMetaType::Type::Int )
4426 if ( !value.isValid() )
4427 return QStringLiteral(
"None" );
4429 if ( value.userType() == qMetaTypeId<QgsProperty>() )
4430 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( value.value<
QgsProperty >().
asExpression() );
4433 p.insert(
name(), value );
4441 switch ( outputType )
4445 QString code = QStringLiteral(
"QgsProcessingParameterMatrix('%1', %2" )
4448 code += QLatin1String(
", optional=True" );
4449 code += QStringLiteral(
", numberRows=%1" ).arg( mNumberRows );
4450 code += QStringLiteral(
", hasFixedNumberRows=%1" ).arg( mFixedNumberRows ? QStringLiteral(
"True" ) : QStringLiteral(
"False" ) );
4453 headers.reserve( mHeaders.size() );
4454 for (
const QString &h : mHeaders )
4456 code += QStringLiteral(
", headers=[%1]" ).arg(
headers.join(
',' ) );
4488 return mFixedNumberRows;
4493 mFixedNumberRows = fixedNumberRows;
4499 map.insert( QStringLiteral(
"headers" ), mHeaders );
4500 map.insert( QStringLiteral(
"rows" ), mNumberRows );
4501 map.insert( QStringLiteral(
"fixed_number_rows" ), mFixedNumberRows );
4508 mHeaders = map.value( QStringLiteral(
"headers" ) ).toStringList();
4509 mNumberRows = map.value( QStringLiteral(
"rows" ) ).toInt();
4510 mFixedNumberRows = map.value( QStringLiteral(
"fixed_number_rows" ) ).toBool();
4534 if ( !input.isValid() )
4544 if ( qobject_cast< QgsMapLayer * >( qvariant_cast<QObject *>( input ) ) )
4550 if ( input.userType() == QMetaType::Type::QString )
4552 if ( input.toString().isEmpty() )
4555 if ( mMinimumNumberInputs > 1 )
4566 else if ( input.userType() == QMetaType::Type::QVariantList )
4568 if ( input.toList().count() < mMinimumNumberInputs )
4571 if ( mMinimumNumberInputs > input.toList().count() )
4579 const auto constToList = input.toList();
4580 for (
const QVariant &v : constToList )
4582 if ( qobject_cast< QgsMapLayer * >( qvariant_cast<QObject *>( v ) ) )
4591 else if ( input.userType() == QMetaType::Type::QStringList )
4593 if ( input.toStringList().count() < mMinimumNumberInputs )
4596 if ( mMinimumNumberInputs > input.toStringList().count() )
4604 const auto constToStringList = input.toStringList();
4605 for (
const QString &v : constToStringList )
4618 if ( !value.isValid() )
4619 return QStringLiteral(
"None" );
4621 if ( value.userType() == qMetaTypeId<QgsProperty>() )
4622 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( value.value<
QgsProperty >().
asExpression() );
4627 if ( value.userType() == QMetaType::Type::QStringList )
4629 const QStringList list = value.toStringList();
4630 parts.reserve( list.count() );
4631 for (
const QString &v : list )
4634 else if ( value.userType() == QMetaType::Type::QVariantList )
4636 const QVariantList list = value.toList();
4637 parts.reserve( list.count() );
4638 for (
const QVariant &v : list )
4641 if ( !parts.isEmpty() )
4642 return parts.join(
',' ).prepend(
'[' ).append(
']' );
4647 p.insert(
name(), value );
4649 if ( !list.isEmpty() )
4652 parts.reserve( list.count() );
4657 return parts.join(
',' ).prepend(
'[' ).append(
']' );
4676 QString code = QStringLiteral(
"##%1=" ).arg(
mName );
4678 code += QLatin1String(
"optional " );
4679 switch ( mLayerType )
4682 code += QLatin1String(
"multiple raster" );
4686 code += QLatin1String(
"multiple file" );
4690 code += QLatin1String(
"multiple vector" );
4694 if (
mDefault.userType() == QMetaType::Type::QVariantList )
4697 const auto constToList =
mDefault.toList();
4698 for (
const QVariant &var : constToList )
4700 parts << var.toString();
4702 code += parts.join(
',' );
4704 else if (
mDefault.userType() == QMetaType::Type::QStringList )
4706 code +=
mDefault.toStringList().join(
',' );
4712 return code.trimmed();
4717 switch ( outputType )
4721 QString code = QStringLiteral(
"QgsProcessingParameterMultipleLayers('%1', %2" )
4724 code += QLatin1String(
", optional=True" );
4728 code += QStringLiteral(
", layerType=%1" ).arg(
layerType );
4739 switch ( mLayerType )
4742 return QObject::tr(
"All files (*.*)" );
4782 return mMinimumNumberInputs;
4794 map.insert( QStringLiteral(
"layer_type" ),
static_cast< int >( mLayerType ) );
4795 map.insert( QStringLiteral(
"min_inputs" ), mMinimumNumberInputs );
4803 mMinimumNumberInputs = map.value( QStringLiteral(
"min_inputs" ) ).toInt();
4809 QString
type = definition;
4811 const thread_local QRegularExpression re( QStringLiteral(
"(.*?)\\s+(.*)" ) );
4812 const QRegularExpressionMatch m = re.match( definition );
4815 type = m.captured( 1 ).toLower().trimmed();
4816 defaultVal = m.captured( 2 );
4819 if (
type == QLatin1String(
"vector" ) )
4821 else if (
type == QLatin1String(
"raster" ) )
4823 else if (
type == QLatin1String(
"file" ) )
4836 QgsMessageLog::logMessage( QObject::tr(
"Invalid number parameter \"%1\": min value %2 is >= max value %3!" ).arg(
name ).arg( mMin ).arg( mMax ), QObject::tr(
"Processing" ) );
4847 QVariant input = value;
4848 if ( !input.isValid() )
4856 if ( input.userType() == qMetaTypeId<QgsProperty>() )
4862 const double res = input.toDouble( &ok );
4866 return !( res < mMin || res > mMax );
4871 if ( !value.isValid() )
4872 return QStringLiteral(
"None" );
4874 if ( value.userType() == qMetaTypeId<QgsProperty>() )
4875 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( value.value<
QgsProperty >().
asExpression() );
4877 return value.toString();
4884 if ( mMin > std::numeric_limits<double>::lowest() + 1 )
4885 parts << QObject::tr(
"Minimum value: %1" ).arg( mMin );
4886 if ( mMax < std::numeric_limits<double>::max() )
4887 parts << QObject::tr(
"Maximum value: %1" ).arg( mMax );
4890 const QString extra = parts.join( QLatin1String(
"<br />" ) );
4891 if ( !extra.isEmpty() )
4892 text += QStringLiteral(
"<p>%1</p>" ).arg( extra );
4898 switch ( outputType )
4902 QString code = QStringLiteral(
"QgsProcessingParameterNumber('%1', %2" )
4905 code += QLatin1String(
", optional=True" );
4907 code += QStringLiteral(
", type=%1" ).arg( mDataType ==
Qgis::ProcessingNumberParameterType::Integer ? QStringLiteral(
"QgsProcessingParameterNumber.Integer" ) : QStringLiteral(
"QgsProcessingParameterNumber.Double" ) );
4909 if ( mMin != std::numeric_limits<double>::lowest() + 1 )
4910 code += QStringLiteral(
", minValue=%1" ).arg( mMin );
4911 if ( mMax != std::numeric_limits<double>::max() )
4912 code += QStringLiteral(
", maxValue=%1" ).arg( mMax );
4954 map.insert( QStringLiteral(
"min" ), mMin );
4955 map.insert( QStringLiteral(
"max" ), mMax );
4956 map.insert( QStringLiteral(
"data_type" ),
static_cast< int >( mDataType ) );
4963 mMin = map.value( QStringLiteral(
"min" ) ).toDouble();
4964 mMax = map.value( QStringLiteral(
"max" ) ).toDouble();
4972 : ( definition.toLower().trimmed() == QLatin1String(
"none" ) ? QVariant() : definition ), isOptional );
4990 if ( !input.isValid() )
4998 if ( input.userType() == qMetaTypeId<QgsProperty>() )
5003 if ( input.userType() == QMetaType::Type::QString )
5005 const QStringList list = input.toString().split(
',' );
5006 if ( list.count() != 2 )
5009 list.at( 0 ).toDouble( &ok );
5011 list.at( 1 ).toDouble( &ok2 );
5016 else if ( input.userType() == QMetaType::Type::QVariantList )
5018 if ( input.toList().count() != 2 )
5022 input.toList().at( 0 ).toDouble( &ok );
5024 input.toList().at( 1 ).toDouble( &ok2 );
5035 if ( !value.isValid() )
5036 return QStringLiteral(
"None" );
5038 if ( value.userType() == qMetaTypeId<QgsProperty>() )
5039 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( value.value<
QgsProperty >().
asExpression() );
5042 p.insert(
name(), value );
5045 QStringList stringParts;
5046 const auto constParts = parts;
5047 for (
const double v : constParts )
5049 stringParts << QString::number( v );
5051 return stringParts.join(
',' ).prepend(
'[' ).append(
']' );
5056 switch ( outputType )
5060 QString code = QStringLiteral(
"QgsProcessingParameterRange('%1', %2" )
5063 code += QLatin1String(
", optional=True" );
5065 code += QStringLiteral(
", type=%1" ).arg( mDataType ==
Qgis::ProcessingNumberParameterType::Integer ? QStringLiteral(
"QgsProcessingParameterNumber.Integer" ) : QStringLiteral(
"QgsProcessingParameterNumber.Double" ) );
5088 map.insert( QStringLiteral(
"data_type" ),
static_cast< int >( mDataType ) );
5102 : ( definition.toLower().trimmed() == QLatin1String(
"none" ) ? QVariant() : definition ), isOptional );
5119 if ( !input.isValid() )
5127 if ( input.userType() == qMetaTypeId<QgsProcessingRasterLayerDefinition>() )
5133 if ( input.userType() == qMetaTypeId<QgsProperty>() )
5146 if ( qobject_cast< QgsRasterLayer * >( qvariant_cast<QObject *>( input ) ) )
5149 if ( input.userType() != QMetaType::Type::QString || input.toString().isEmpty() )
5167 if ( !val.isValid() )
5168 return QStringLiteral(
"None" );
5170 if ( val.userType() == qMetaTypeId<QgsProperty>() )
5173 if ( val.userType() == qMetaTypeId<QgsProcessingRasterLayerDefinition>() )
5182 layerString = layer->source();
5186 return QStringLiteral(
"QgsProcessingRasterLayerDefinition(%1, referenceScale=%2, dpi=%3)" )
5189 QString::number( fromVar.
dpi ) );
5200 return QStringLiteral(
"QgsProcessingRasterLayerDefinition(QgsProperty.fromExpression(%1), referenceScale=%2, dpi=%3)" )
5203 QString::number( fromVar.
dpi ) );
5213 p.insert(
name(), val );
5241 mCapabilities = capabilities;
5246 return mCapabilities;
5265 QVariant input = value;
5266 if ( !input.isValid() )
5274 if ( input.userType() == qMetaTypeId<QgsProperty>() )
5279 if ( mUsesStaticStrings )
5281 if ( input.userType() == QMetaType::Type::QVariantList )
5283 if ( !mAllowMultiple )
5286 const QVariantList values = input.toList();
5290 for (
const QVariant &val : values )
5292 if ( !mOptions.contains( val.toString() ) )
5298 else if ( input.userType() == QMetaType::Type::QStringList )
5300 if ( !mAllowMultiple )
5303 const QStringList values = input.toStringList();
5308 if ( values.count() > 1 && !mAllowMultiple )
5311 for (
const QString &val : values )
5313 if ( !mOptions.contains( val ) )
5318 else if ( input.userType() == QMetaType::Type::QString )
5320 const QStringList parts = input.toString().split(
',' );
5321 if ( parts.count() > 1 && !mAllowMultiple )
5324 const auto constParts = parts;
5325 for (
const QString &part : constParts )
5327 if ( !mOptions.contains( part ) )
5335 if ( input.userType() == QMetaType::Type::QVariantList )
5337 if ( !mAllowMultiple )
5340 const QVariantList values = input.toList();
5344 for (
const QVariant &val : values )
5347 const int res = val.toInt( &ok );
5350 else if ( res < 0 || res >= mOptions.count() )
5356 else if ( input.userType() == QMetaType::Type::QString )
5358 const QStringList parts = input.toString().split(
',' );
5359 if ( parts.count() > 1 && !mAllowMultiple )
5362 const auto constParts = parts;
5363 for (
const QString &part : constParts )
5366 const int res = part.toInt( &ok );
5369 else if ( res < 0 || res >= mOptions.count() )
5374 else if ( input.userType() == QMetaType::Type::Int || input.userType() == QMetaType::Type::Double )
5377 const int res = input.toInt( &ok );
5380 else if ( res >= 0 && res < mOptions.count() )
5390 if ( !value.isValid() )
5391 return QStringLiteral(
"None" );
5393 if ( value.userType() == qMetaTypeId<QgsProperty>() )
5394 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( value.value<
QgsProperty >().
asExpression() );
5396 if ( mUsesStaticStrings )
5398 if ( value.userType() == QMetaType::Type::QVariantList || value.userType() == QMetaType::Type::QStringList )
5401 const QStringList constList = value.toStringList();
5402 for (
const QString &val : constList )
5406 return parts.join(
',' ).prepend(
'[' ).append(
']' );
5408 else if ( value.userType() == QMetaType::Type::QString )
5411 const QStringList constList = value.toString().split(
',' );
5412 if ( constList.count() > 1 )
5414 for (
const QString &val : constList )
5418 return parts.join(
',' ).prepend(
'[' ).append(
']' );
5426 if ( value.userType() == QMetaType::Type::QVariantList )
5429 const auto constToList = value.toList();
5430 for (
const QVariant &val : constToList )
5432 parts << QString::number( static_cast< int >( val.toDouble() ) );
5434 return parts.join(
',' ).prepend(
'[' ).append(
']' );
5436 else if ( value.userType() == QMetaType::Type::QString )
5438 const QStringList parts = value.toString().split(
',' );
5439 if ( parts.count() > 1 )
5441 return parts.join(
',' ).prepend(
'[' ).append(
']' );
5445 return QString::number(
static_cast< int >( value.toDouble() ) );
5451 if ( !value.isValid() )
5454 if ( value.userType() == qMetaTypeId<QgsProperty>() )
5457 if ( mUsesStaticStrings )
5463 if ( value.userType() == QMetaType::Type::QVariantList )
5466 const QVariantList toList = value.toList();
5467 parts.reserve( toList.size() );
5468 for (
const QVariant &val : toList )
5470 parts << mOptions.value(
static_cast< int >( val.toDouble() ) );
5472 return parts.join(
',' );
5474 else if ( value.userType() == QMetaType::Type::QString )
5476 const QStringList parts = value.toString().split(
',' );
5477 QStringList comments;
5478 if ( parts.count() > 1 )
5480 for (
const QString &part : parts )
5483 const int val = part.toInt( &ok );
5485 comments << mOptions.value( val );
5487 return comments.join(
',' );
5491 return mOptions.value(
static_cast< int >( value.toDouble() ) );
5497 QString code = QStringLiteral(
"##%1=" ).arg(
mName );
5499 code += QLatin1String(
"optional " );
5500 code += QLatin1String(
"enum " );
5502 if ( mAllowMultiple )
5503 code += QLatin1String(
"multiple " );
5505 if ( mUsesStaticStrings )
5506 code += QLatin1String(
"static " );
5508 code += mOptions.join(
';' ) +
' ';
5511 return code.trimmed();
5516 switch ( outputType )
5520 QString code = QStringLiteral(
"QgsProcessingParameterEnum('%1', %2" )
5523 code += QLatin1String(
", optional=True" );
5526 options.reserve( mOptions.size() );
5527 for (
const QString &o : mOptions )
5529 code += QStringLiteral(
", options=[%1]" ).arg(
options.join(
',' ) );
5531 code += QStringLiteral(
", allowMultiple=%1" ).arg( mAllowMultiple ? QStringLiteral(
"True" ) : QStringLiteral(
"False" ) );
5533 code += QStringLiteral(
", usesStaticStrings=%1" ).arg( mUsesStaticStrings ? QStringLiteral(
"True" ) : QStringLiteral(
"False" ) );
5549 return options().value( value.toInt() );
5564 return mAllowMultiple;
5574 return mUsesStaticStrings;
5585 map.insert( QStringLiteral(
"options" ), mOptions );
5586 map.insert( QStringLiteral(
"allow_multiple" ), mAllowMultiple );
5587 map.insert( QStringLiteral(
"uses_static_strings" ), mUsesStaticStrings );
5594 mOptions = map.value( QStringLiteral(
"options" ) ).toStringList();
5595 mAllowMultiple = map.value( QStringLiteral(
"allow_multiple" ) ).toBool();
5596 mUsesStaticStrings = map.value( QStringLiteral(
"uses_static_strings" ) ).toBool();
5603 QString def = definition;
5605 bool multiple =
false;
5606 if ( def.startsWith( QLatin1String(
"multiple" ), Qt::CaseInsensitive ) )
5612 bool staticStrings =
false;
5613 if ( def.startsWith( QLatin1String(
"static" ), Qt::CaseInsensitive ) )
5615 staticStrings =
true;
5619 const thread_local QRegularExpression re( QStringLiteral(
"(.*)\\s+(.*?)$" ) );
5620 const QRegularExpressionMatch m = re.match( def );
5621 QString values = def;
5624 values = m.captured( 1 ).trimmed();
5625 defaultVal = m.captured( 2 );
5646 return QStringLiteral(
"None" );
5648 if ( value.userType() == qMetaTypeId<QgsProperty>() )
5649 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( value.value<
QgsProperty >().
asExpression() );
5651 const QString s = value.toString();
5657 QString code = QStringLiteral(
"##%1=" ).arg(
mName );
5659 code += QLatin1String(
"optional " );
5660 code += QLatin1String(
"string " );
5663 code += QLatin1String(
"long " );
5666 return code.trimmed();
5671 switch ( outputType )
5675 QString code = QStringLiteral(
"QgsProcessingParameterString('%1', %2" )
5678 code += QLatin1String(
", optional=True" );
5679 code += QStringLiteral(
", multiLine=%1" ).arg( mMultiLine ? QStringLiteral(
"True" ) : QStringLiteral(
"False" ) );
5702 map.insert( QStringLiteral(
"multiline" ), mMultiLine );
5709 mMultiLine = map.value( QStringLiteral(
"multiline" ) ).toBool();
5715 QString def = definition;
5717 if ( def.startsWith( QLatin1String(
"long" ), Qt::CaseInsensitive ) )
5723 if ( def.startsWith(
'"' ) || def.startsWith(
'\'' ) )
5725 if ( def.endsWith(
'"' ) || def.endsWith(
'\'' ) )
5729 if ( def == QLatin1String(
"None" ) )
5752 if ( !value.isValid() )
5753 return QStringLiteral(
"None" );
5755 const QString s = value.toString();
5761 QString code = QStringLiteral(
"##%1=" ).arg(
mName );
5763 code += QLatin1String(
"optional " );
5764 code += QLatin1String(
"authcfg " );
5767 return code.trimmed();
5772 QString def = definition;
5774 if ( def.startsWith(
'"' ) || def.startsWith(
'\'' ) )
5776 if ( def.endsWith(
'"' ) || def.endsWith(
'\'' ) )
5780 if ( def == QLatin1String(
"None" ) )
5794 , mExpressionType(
type )
5806 if ( !value.isValid() )
5807 return QStringLiteral(
"None" );
5809 if ( value.userType() == qMetaTypeId<QgsProperty>() )
5810 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( value.value<
QgsProperty >().
asExpression() );
5812 const QString s = value.toString();
5818 QStringList depends;
5819 if ( !mParentLayerParameterName.isEmpty() )
5820 depends << mParentLayerParameterName;
5826 switch ( outputType )
5830 QString code = QStringLiteral(
"QgsProcessingParameterExpression('%1', %2" )
5833 code += QLatin1String(
", optional=True" );
5835 code += QStringLiteral(
", parentLayerParameterName='%1'" ).arg( mParentLayerParameterName );
5841 switch ( mExpressionType )
5844 code += QLatin1String(
", type=Qgis.ExpressionType.PointCloud)" );
5847 code += QLatin1String(
", type=Qgis.ExpressionType.RasterCalculator)" );
5850 code += QLatin1Char(
')' );
5861 return mParentLayerParameterName;
5871 return mExpressionType;
5882 map.insert( QStringLiteral(
"parent_layer" ), mParentLayerParameterName );
5883 map.insert( QStringLiteral(
"expression_type" ),
static_cast< int >( mExpressionType ) );
5890 mParentLayerParameterName = map.value( QStringLiteral(
"parent_layer" ) ).toString();
5891 mExpressionType =
static_cast< Qgis::ExpressionType >( map.value( QStringLiteral(
"expression_type" ) ).toInt() );
5916 if ( !var.isValid() )
5924 if ( var.userType() == qMetaTypeId<QgsProperty>() )
5937 if ( qobject_cast< QgsVectorLayer * >( qvariant_cast<QObject *>( var ) ) )
5940 if ( var.userType() != QMetaType::Type::QString || var.toString().isEmpty() )
5958 if ( !val.isValid() )
5959 return QStringLiteral(
"None" );
5961 if ( val.userType() == qMetaTypeId<QgsProperty>() )
5965 p.insert(
name(), val );
5983 switch ( outputType )
5987 QString code = QStringLiteral(
"QgsProcessingParameterVectorLayer('%1', %2" )
5990 code += QLatin1String(
", optional=True" );
5994 QStringList options;
5997 code += QStringLiteral(
", types=[%1]" ).arg( options.join(
',' ) );
6031 map.insert( QStringLiteral(
"data_types" ), types );
6039 const QVariantList values = map.value( QStringLiteral(
"data_types" ) ).toList();
6040 for (
const QVariant &val : values )
6068 if ( !var.isValid() )
6076 if ( var.userType() == qMetaTypeId<QgsProperty>() )
6089 if ( qobject_cast< QgsMeshLayer * >( qvariant_cast<QObject *>( var ) ) )
6092 if ( var.userType() != QMetaType::Type::QString || var.toString().isEmpty() )
6110 if ( !val.isValid() )
6111 return QStringLiteral(
"None" );
6113 if ( val.userType() == qMetaTypeId<QgsProperty>() )
6117 p.insert(
name(), val );
6162 if ( !input.isValid() )
6170 if ( input.userType() == qMetaTypeId<QgsProperty>() )
6175 if ( input.userType() == QMetaType::Type::QVariantList || input.userType() == QMetaType::Type::QStringList )
6177 if ( !mAllowMultiple )
6183 else if ( input.userType() == QMetaType::Type::QString )
6185 if ( input.toString().isEmpty() )
6188 const QStringList parts = input.toString().split(
';' );
6189 if ( parts.count() > 1 && !mAllowMultiple )
6194 if ( input.toString().isEmpty() )
6202 if ( !value.isValid() )
6203 return QStringLiteral(
"None" );
6205 if ( value.userType() == qMetaTypeId<QgsProperty>() )
6206 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( value.value<
QgsProperty >().
asExpression() );
6208 if ( value.userType() == QMetaType::Type::QVariantList )
6211 const auto constToList = value.toList();
6212 for (
const QVariant &val : constToList )
6216 return parts.join(
',' ).prepend(
'[' ).append(
']' );
6218 else if ( value.userType() == QMetaType::Type::QStringList )
6221 const auto constToStringList = value.toStringList();
6222 for (
const QString &s : constToStringList )
6226 return parts.join(
',' ).prepend(
'[' ).append(
']' );
6234 QString code = QStringLiteral(
"##%1=" ).arg(
mName );
6236 code += QLatin1String(
"optional " );
6237 code += QLatin1String(
"field " );
6239 switch ( mDataType )
6242 code += QLatin1String(
"numeric " );
6246 code += QLatin1String(
"string " );
6250 code += QLatin1String(
"datetime " );
6254 code += QLatin1String(
"binary " );
6258 code += QLatin1String(
"boolean " );
6265 if ( mAllowMultiple )
6266 code += QLatin1String(
"multiple " );
6268 if ( mDefaultToAllFields )
6269 code += QLatin1String(
"default_to_all_fields " );
6271 code += mParentLayerParameterName +
' ';
6274 return code.trimmed();
6279 switch ( outputType )
6283 QString code = QStringLiteral(
"QgsProcessingParameterField('%1', %2" )
6286 code += QLatin1String(
", optional=True" );
6289 switch ( mDataType )
6292 dataType = QStringLiteral(
"QgsProcessingParameterField.Any" );
6296 dataType = QStringLiteral(
"QgsProcessingParameterField.Numeric" );
6300 dataType = QStringLiteral(
"QgsProcessingParameterField.String" );
6304 dataType = QStringLiteral(
"QgsProcessingParameterField.DateTime" );
6308 dataType = QStringLiteral(
"QgsProcessingParameterField.Binary" );
6312 dataType = QStringLiteral(
"QgsProcessingParameterField.Boolean" );
6315 code += QStringLiteral(
", type=%1" ).arg(
dataType );
6317 code += QStringLiteral(
", parentLayerParameterName='%1'" ).arg( mParentLayerParameterName );
6318 code += QStringLiteral(
", allowMultiple=%1" ).arg( mAllowMultiple ? QStringLiteral(
"True" ) : QStringLiteral(
"False" ) );
6322 if ( mDefaultToAllFields )
6323 code += QLatin1String(
", defaultToAllFields=True" );
6335 QStringList depends;
6336 if ( !mParentLayerParameterName.isEmpty() )
6337 depends << mParentLayerParameterName;
6343 return mParentLayerParameterName;
6363 return mAllowMultiple;
6373 return mDefaultToAllFields;
6378 mDefaultToAllFields = enabled;
6384 map.insert( QStringLiteral(
"parent_layer" ), mParentLayerParameterName );
6385 map.insert( QStringLiteral(
"data_type" ),
static_cast< int >( mDataType ) );
6386 map.insert( QStringLiteral(
"allow_multiple" ), mAllowMultiple );
6387 map.insert( QStringLiteral(
"default_to_all_fields" ), mDefaultToAllFields );
6394 mParentLayerParameterName = map.value( QStringLiteral(
"parent_layer" ) ).toString();
6396 mAllowMultiple = map.value( QStringLiteral(
"allow_multiple" ) ).toBool();
6397 mDefaultToAllFields = map.value( QStringLiteral(
"default_to_all_fields" ) ).toBool();
6407 QString def = definition;
6409 if ( def.startsWith( QLatin1String(
"numeric " ), Qt::CaseInsensitive ) )
6414 else if ( def.startsWith( QLatin1String(
"string " ), Qt::CaseInsensitive ) )
6419 else if ( def.startsWith( QLatin1String(
"datetime " ), Qt::CaseInsensitive ) )
6424 else if ( def.startsWith( QLatin1String(
"binary " ), Qt::CaseInsensitive ) )
6429 else if ( def.startsWith( QLatin1String(
"boolean " ), Qt::CaseInsensitive ) )
6435 if ( def.startsWith( QLatin1String(
"multiple" ), Qt::CaseInsensitive ) )
6438 def = def.mid( 8 ).trimmed();
6441 if ( def.startsWith( QLatin1String(
"default_to_all_fields" ), Qt::CaseInsensitive ) )
6444 def = def.mid( 21 ).trimmed();
6447 const thread_local QRegularExpression re( QStringLiteral(
"(.*?)\\s+(.*)$" ) );
6448 const QRegularExpressionMatch m = re.match( def );
6451 parent = m.captured( 1 ).trimmed();
6452 def = m.captured( 2 );
6477 QVariant var = input;
6478 if ( !var.isValid() )
6486 if ( var.userType() == qMetaTypeId<QgsProcessingFeatureSourceDefinition>() )
6491 else if ( var.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
6498 if ( var.userType() == qMetaTypeId<QgsProperty>() )
6510 if ( qobject_cast< QgsVectorLayer * >( qvariant_cast<QObject *>( input ) ) )
6515 if ( var.userType() != QMetaType::Type::QString || var.toString().isEmpty() )
6533 if ( !value.isValid() )
6534 return QStringLiteral(
"None" );
6536 if ( value.userType() == qMetaTypeId<QgsProperty>() )
6539 if ( value.userType() == qMetaTypeId<QgsProcessingFeatureSourceDefinition>() )
6542 QString geometryCheckString;
6546 geometryCheckString = QStringLiteral(
"QgsFeatureRequest.GeometryNoCheck" );
6550 geometryCheckString = QStringLiteral(
"QgsFeatureRequest.GeometrySkipInvalid" );
6554 geometryCheckString = QStringLiteral(
"QgsFeatureRequest.GeometryAbortOnInvalid" );
6561 flags << QStringLiteral(
"QgsProcessingFeatureSourceDefinition.FlagOverrideDefaultGeometryCheck" );
6563 flags << QStringLiteral(
"QgsProcessingFeatureSourceDefinition.FlagCreateIndividualOutputPerInputFeature" );
6564 if ( !
flags.empty() )
6565 flagString =
flags.join( QLatin1String(
" | " ) );
6572 layerString = layer->source();
6579 flagString.isEmpty() ? QString() : ( QStringLiteral(
", flags=%1" ).arg( flagString ) ),
6580 geometryCheckString,
6592 return QStringLiteral(
"QgsProcessingFeatureSourceDefinition(QgsProperty.fromExpression(%1), selectedFeaturesOnly=%2, featureLimit=%3%4%6, geometryCheck=%5)" )
6596 flagString.isEmpty() ? QString() : ( QStringLiteral(
", flags=%1" ).arg( flagString ) ),
6597 geometryCheckString,
6606 else if (
QgsVectorLayer *layer = qobject_cast< QgsVectorLayer * >( qvariant_cast<QObject *>( value ) ) )
6611 QString layerString = value.toString();
6615 layerString = layer->providerType() != QLatin1String(
"ogr" ) && layer->providerType() != QLatin1String(
"gdal" ) && layer->providerType() != QLatin1String(
"mdal" ) ?
QgsProcessingUtils::encodeProviderKeyAndUri( layer->providerType(), layer->source() ) : layer->source();
6632 QString code = QStringLiteral(
"##%1=" ).arg(
mName );
6634 code += QLatin1String(
"optional " );
6635 code += QLatin1String(
"source " );
6642 code += QLatin1String(
"point " );
6646 code += QLatin1String(
"line " );
6650 code += QLatin1String(
"polygon " );
6659 return code.trimmed();
6664 switch ( outputType )
6668 QString code = QStringLiteral(
"QgsProcessingParameterFeatureSource('%1', %2" )
6671 code += QLatin1String(
", optional=True" );
6675 QStringList options;
6679 code += QStringLiteral(
", types=[%1]" ).arg( options.join(
',' ) );
6709 map.insert( QStringLiteral(
"data_types" ), types );
6717 const QVariantList values = map.value( QStringLiteral(
"data_types" ) ).toList();
6718 for (
const QVariant &val : values )
6728 QString def = definition;
6731 if ( def.startsWith( QLatin1String(
"point" ), Qt::CaseInsensitive ) )
6737 else if ( def.startsWith( QLatin1String(
"line" ), Qt::CaseInsensitive ) )
6743 else if ( def.startsWith( QLatin1String(
"polygon" ), Qt::CaseInsensitive ) )
6769 QVariant var = input;
6770 if ( !var.isValid() )
6778 if ( var.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
6784 if ( var.userType() == qMetaTypeId<QgsProperty>() )
6797 if ( var.userType() != QMetaType::Type::QString )
6800 if ( var.toString().isEmpty() )
6808 if ( !value.isValid() )
6809 return QStringLiteral(
"None" );
6811 if ( value.userType() == qMetaTypeId<QgsProperty>() )
6812 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( value.value<
QgsProperty >().
asExpression() );
6814 if ( value.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
6823 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( fromVar.
sink.
asExpression() );
6832 QString code = QStringLiteral(
"##%1=" ).arg(
mName );
6834 code += QLatin1String(
"optional " );
6835 code += QLatin1String(
"sink " );
6837 switch ( mDataType )
6840 code += QLatin1String(
"point " );
6844 code += QLatin1String(
"line " );
6848 code += QLatin1String(
"polygon " );
6852 code += QLatin1String(
"table " );
6860 return code.trimmed();
6872 return lOriginalProvider->defaultVectorFileExtension(
hasGeometry() );
6876 return p->defaultVectorFileExtension(
hasGeometry() );
6886 return QStringLiteral(
"dbf" );
6893 switch ( outputType )
6897 QString code = QStringLiteral(
"QgsProcessingParameterFeatureSink('%1', %2" )
6900 code += QLatin1String(
", optional=True" );
6904 code += QStringLiteral(
", createByDefault=%1" ).arg(
createByDefault() ? QStringLiteral(
"True" ) : QStringLiteral(
"False" ) );
6905 if ( mSupportsAppend )
6906 code += QLatin1String(
", supportsAppend=True" );
6919 QStringList filters;
6920 for (
const QString &ext : exts )
6922 filters << QObject::tr(
"%1 files (*.%2)" ).arg( ext.toUpper(), ext.toLower() );
6924 return filters.join( QLatin1String(
";;" ) ) + QStringLiteral(
";;" ) + QObject::tr(
"All files (*.*)" );
6933 return lOriginalProvider->supportedOutputVectorLayerExtensions();
6935 return lOriginalProvider->supportedOutputTableExtensions();
6940 return p->supportedOutputVectorLayerExtensions();
6942 return p->supportedOutputTableExtensions();
6957 switch ( mDataType )
6988 map.insert( QStringLiteral(
"data_type" ),
static_cast< int >( mDataType ) );
6989 map.insert( QStringLiteral(
"supports_append" ), mSupportsAppend );
6997 mSupportsAppend = map.value( QStringLiteral(
"supports_append" ),
false ).toBool();
7004 return QStringLiteral(
"memory:%1" ).arg(
description() );
7012 QString def = definition;
7013 if ( def.startsWith( QLatin1String(
"point" ), Qt::CaseInsensitive ) )
7018 else if ( def.startsWith( QLatin1String(
"line" ), Qt::CaseInsensitive ) )
7023 else if ( def.startsWith( QLatin1String(
"polygon" ), Qt::CaseInsensitive ) )
7028 else if ( def.startsWith( QLatin1String(
"table" ), Qt::CaseInsensitive ) )
7039 return mSupportsAppend;
7059 QVariant var = input;
7060 if ( !var.isValid() )
7068 if ( var.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
7074 if ( var.userType() == qMetaTypeId<QgsProperty>() )
7087 if ( var.userType() != QMetaType::Type::QString )
7090 if ( var.toString().isEmpty() )
7098 if ( !value.isValid() )
7099 return QStringLiteral(
"None" );
7101 if ( value.userType() == qMetaTypeId<QgsProperty>() )
7102 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( value.value<
QgsProperty >().
asExpression() );
7104 if ( value.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
7113 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( fromVar.
sink.
asExpression() );
7129 return lOriginalProvider->defaultRasterFileFormat();
7133 return p->defaultRasterFileFormat();
7145 if ( !extensions.isEmpty() )
7146 return extensions[0];
7148 return QStringLiteral(
"tif" );
7153 QStringList filters;
7155 for (
const QPair<QString, QString> &formatAndExt : std::as_const( formatAndExtensions ) )
7157 QString format = formatAndExt.first;
7158 const QString &extension = formatAndExt.second;
7159 if ( format.isEmpty() )
7161 filters << QObject::tr(
"%1 files (*.%2)" ).arg( format.toUpper(), extension.toLower() );
7164 return filters.join( QLatin1String(
";;" ) ) + QStringLiteral(
";;" ) + QObject::tr(
"All files (*.*)" );
7170 QSet< QString > extensions;
7171 for (
const QPair<QString, QString> &formatAndExt : std::as_const( formatAndExtensions ) )
7173 extensions.insert( formatAndExt.second );
7175 return QStringList( extensions.constBegin(), extensions.constEnd() );
7182 return lOriginalProvider->supportedOutputRasterLayerFormatAndExtensions();
7186 return p->supportedOutputRasterLayerFormatAndExtensions();
7214 QVariant var = input;
7215 if ( !var.isValid() )
7223 if ( var.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
7229 if ( var.userType() == qMetaTypeId<QgsProperty>() )
7242 if ( var.userType() != QMetaType::Type::QString )
7245 if ( var.toString().isEmpty() )
7255 if ( !value.isValid() )
7256 return QStringLiteral(
"None" );
7258 if ( value.userType() == qMetaTypeId<QgsProperty>() )
7259 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( value.value<
QgsProperty >().
asExpression() );
7261 if ( value.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
7270 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( fromVar.
sink.
asExpression() );
7279 if ( !mFileFilter.isEmpty() && mFileFilter.contains( QStringLiteral(
"htm" ), Qt::CaseInsensitive ) )
7291 if ( mFileFilter.isEmpty() || mFileFilter == QObject::tr(
"All files (*.*)" ) )
7292 return QStringLiteral(
"file" );
7295 const thread_local QRegularExpression rx( QStringLiteral(
".*?\\(\\*\\.([a-zA-Z0-9._]+).*" ) );
7296 const QRegularExpressionMatch match = rx.match( mFileFilter );
7297 if ( !match.hasMatch() )
7298 return QStringLiteral(
"file" );
7300 return match.captured( 1 );
7305 switch ( outputType )
7309 QString code = QStringLiteral(
"QgsProcessingParameterFileDestination('%1', %2" )
7312 code += QLatin1String(
", optional=True" );
7316 code += QStringLiteral(
", createByDefault=%1" ).arg(
createByDefault() ? QStringLiteral(
"True" ) : QStringLiteral(
"False" ) );
7328 return (
fileFilter().isEmpty() ? QString() :
fileFilter() + QStringLiteral(
";;" ) ) + QObject::tr(
"All files (*.*)" );
7344 map.insert( QStringLiteral(
"file_filter" ), mFileFilter );
7351 mFileFilter = map.value( QStringLiteral(
"file_filter" ) ).toString();
7372 QVariant var = input;
7373 if ( !var.isValid() )
7381 if ( var.userType() == qMetaTypeId<QgsProperty>() )
7394 if ( var.userType() != QMetaType::Type::QString )
7397 if ( var.toString().isEmpty() )
7428 map.insert( QStringLiteral(
"supports_non_file_outputs" ), mSupportsNonFileBasedOutputs );
7429 map.insert( QStringLiteral(
"create_by_default" ), mCreateByDefault );
7436 mSupportsNonFileBasedOutputs = map.value( QStringLiteral(
"supports_non_file_outputs" ) ).toBool();
7437 mCreateByDefault = map.value( QStringLiteral(
"create_by_default" ), QStringLiteral(
"1" ) ).toBool();
7443 switch ( outputType )
7450 QString code = t->className() + QStringLiteral(
"('%1', %2" )
7453 code += QLatin1String(
", optional=True" );
7455 code += QStringLiteral(
", createByDefault=%1" ).arg( mCreateByDefault ? QStringLiteral(
"True" ) : QStringLiteral(
"False" ) );
7470 return QObject::tr(
"Default extension" ) + QStringLiteral(
" (*." ) +
defaultFileExtension() +
')';
7477 const thread_local QRegularExpression rx( QStringLiteral(
"[.]" ) );
7478 QString sanitizedName =
name();
7479 sanitizedName.replace( rx, QStringLiteral(
"_" ) );
7494 return lOriginalProvider->isSupportedOutputValue( value,
this, context, error );
7503 return mCreateByDefault;
7525 QVariant var = input;
7526 if ( !var.isValid() )
7534 if ( var.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
7540 if ( var.userType() == qMetaTypeId<QgsProperty>() )
7553 if ( var.userType() != QMetaType::Type::QString )
7556 if ( var.toString().isEmpty() )
7564 if ( !value.isValid() )
7565 return QStringLiteral(
"None" );
7567 if ( value.userType() == qMetaTypeId<QgsProperty>() )
7568 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( value.value<
QgsProperty >().
asExpression() );
7570 if ( value.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
7579 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( fromVar.
sink.
asExpression() );
7588 QString code = QStringLiteral(
"##%1=" ).arg(
mName );
7590 code += QLatin1String(
"optional " );
7591 code += QLatin1String(
"vectorDestination " );
7593 switch ( mDataType )
7596 code += QLatin1String(
"point " );
7600 code += QLatin1String(
"line " );
7604 code += QLatin1String(
"polygon " );
7612 return code.trimmed();
7624 return lOriginalProvider->defaultVectorFileExtension(
hasGeometry() );
7628 return p->defaultVectorFileExtension(
hasGeometry() );
7638 return QStringLiteral(
"dbf" );
7645 switch ( outputType )
7649 QString code = QStringLiteral(
"QgsProcessingParameterVectorDestination('%1', %2" )
7652 code += QLatin1String(
", optional=True" );
7656 code += QStringLiteral(
", createByDefault=%1" ).arg(
createByDefault() ? QStringLiteral(
"True" ) : QStringLiteral(
"False" ) );
7669 QStringList filters;
7670 for (
const QString &ext : exts )
7672 filters << QObject::tr(
"%1 files (*.%2)" ).arg( ext.toUpper(), ext.toLower() );
7674 return filters.join( QLatin1String(
";;" ) ) + QStringLiteral(
";;" ) + QObject::tr(
"All files (*.*)" );
7682 return lOriginalProvider->supportedOutputVectorLayerExtensions();
7684 return lOriginalProvider->supportedOutputTableExtensions();
7689 return p->supportedOutputVectorLayerExtensions();
7691 return p->supportedOutputTableExtensions();
7706 switch ( mDataType )
7737 map.insert( QStringLiteral(
"data_type" ),
static_cast< int >( mDataType ) );
7751 QString def = definition;
7752 if ( def.startsWith( QLatin1String(
"point" ), Qt::CaseInsensitive ) )
7757 else if ( def.startsWith( QLatin1String(
"line" ), Qt::CaseInsensitive ) )
7762 else if ( def.startsWith( QLatin1String(
"polygon" ), Qt::CaseInsensitive ) )
7786 QVariant input = value;
7787 if ( !input.isValid() )
7795 if ( input.userType() == qMetaTypeId<QgsProperty>() )
7800 if ( input.userType() == QMetaType::Type::QVariantList || input.userType() == QMetaType::Type::QStringList )
7802 if ( !mAllowMultiple )
7811 const double res = input.toInt( &ok );
7821 return mAllowMultiple;
7831 if ( !value.isValid() )
7832 return QStringLiteral(
"None" );
7834 if ( value.userType() == qMetaTypeId<QgsProperty>() )
7835 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( value.value<
QgsProperty >().
asExpression() );
7837 if ( value.userType() == QMetaType::Type::QVariantList )
7840 const QVariantList values = value.toList();
7841 for (
auto it = values.constBegin(); it != values.constEnd(); ++it )
7843 parts << QString::number( static_cast< int >( it->toDouble() ) );
7845 return parts.join(
',' ).prepend(
'[' ).append(
']' );
7847 else if ( value.userType() == QMetaType::Type::QStringList )
7850 const QStringList values = value.toStringList();
7851 for (
auto it = values.constBegin(); it != values.constEnd(); ++it )
7853 parts << QString::number( static_cast< int >( it->toDouble() ) );
7855 return parts.join(
',' ).prepend(
'[' ).append(
']' );
7858 return value.toString();
7863 QString code = QStringLiteral(
"##%1=" ).arg(
mName );
7865 code += QLatin1String(
"optional " );
7866 code += QLatin1String(
"band " );
7868 if ( mAllowMultiple )
7869 code += QLatin1String(
"multiple " );
7871 code += mParentLayerParameterName +
' ';
7874 return code.trimmed();
7879 QStringList depends;
7880 if ( !mParentLayerParameterName.isEmpty() )
7881 depends << mParentLayerParameterName;
7887 switch ( outputType )
7891 QString code = QStringLiteral(
"QgsProcessingParameterBand('%1', %2" )
7894 code += QLatin1String(
", optional=True" );
7896 code += QStringLiteral(
", parentLayerParameterName='%1'" ).arg( mParentLayerParameterName );
7897 code += QStringLiteral(
", allowMultiple=%1" ).arg( mAllowMultiple ? QStringLiteral(
"True" ) : QStringLiteral(
"False" ) );
7909 return mParentLayerParameterName;
7920 map.insert( QStringLiteral(
"parent_layer" ), mParentLayerParameterName );
7921 map.insert( QStringLiteral(
"allow_multiple" ), mAllowMultiple );
7928 mParentLayerParameterName = map.value( QStringLiteral(
"parent_layer" ) ).toString();
7929 mAllowMultiple = map.value( QStringLiteral(
"allow_multiple" ) ).toBool();
7936 QString def = definition;
7939 if ( def.startsWith( QLatin1String(
"multiple" ), Qt::CaseInsensitive ) )
7942 def = def.mid( 8 ).trimmed();
7945 const thread_local QRegularExpression re( QStringLiteral(
"(.*?)\\s+(.*)$" ) );
7946 const QRegularExpressionMatch m = re.match( def );
7949 parent = m.captured( 1 ).trimmed();
7950 def = m.captured( 2 );
7984 QStringList depends;
7985 if ( !mParentParameterName.isEmpty() )
7986 depends << mParentParameterName;
7992 switch ( outputType )
7996 QString code = QStringLiteral(
"QgsProcessingParameterDistance('%1', %2" )
7999 code += QLatin1String(
", optional=True" );
8001 code += QStringLiteral(
", parentParameterName='%1'" ).arg( mParentParameterName );
8003 if (
minimum() != std::numeric_limits<double>::lowest() + 1 )
8004 code += QStringLiteral(
", minValue=%1" ).arg(
minimum() );
8005 if (
maximum() != std::numeric_limits<double>::max() )
8006 code += QStringLiteral(
", maxValue=%1" ).arg(
maximum() );
8017 return mParentParameterName;
8028 map.insert( QStringLiteral(
"parent" ), mParentParameterName );
8029 map.insert( QStringLiteral(
"default_unit" ),
static_cast< int >( mDefaultUnit ) );
8036 mParentParameterName = map.value( QStringLiteral(
"parent" ) ).toString();
8074 QStringList depends;
8075 if ( !mParentParameterName.isEmpty() )
8076 depends << mParentParameterName;
8082 switch ( outputType )
8086 QString code = QStringLiteral(
"QgsProcessingParameterArea('%1', %2" )
8089 code += QLatin1String(
", optional=True" );
8091 code += QStringLiteral(
", parentParameterName='%1'" ).arg( mParentParameterName );
8094 code += QStringLiteral(
", minValue=%1" ).arg(
minimum() );
8095 if (
maximum() != std::numeric_limits<double>::max() )
8096 code += QStringLiteral(
", maxValue=%1" ).arg(
maximum() );
8107 return mParentParameterName;
8118 map.insert( QStringLiteral(
"parent" ), mParentParameterName );
8119 map.insert( QStringLiteral(
"default_unit" ),
qgsEnumValueToKey( mDefaultUnit ) );
8126 mParentParameterName = map.value( QStringLiteral(
"parent" ) ).toString();
8164 QStringList depends;
8165 if ( !mParentParameterName.isEmpty() )
8166 depends << mParentParameterName;
8172 switch ( outputType )
8176 QString code = QStringLiteral(
"QgsProcessingParameterVolume('%1', %2" )
8179 code += QLatin1String(
", optional=True" );
8181 code += QStringLiteral(
", parentParameterName='%1'" ).arg( mParentParameterName );
8184 code += QStringLiteral(
", minValue=%1" ).arg(
minimum() );
8185 if (
maximum() != std::numeric_limits<double>::max() )
8186 code += QStringLiteral(
", maxValue=%1" ).arg(
maximum() );
8197 return mParentParameterName;
8208 map.insert( QStringLiteral(
"parent" ), mParentParameterName );
8209 map.insert( QStringLiteral(
"default_unit" ),
qgsEnumValueToKey( mDefaultUnit ) );
8216 mParentParameterName = map.value( QStringLiteral(
"parent" ) ).toString();
8250 switch ( outputType )
8254 QString code = QStringLiteral(
"QgsProcessingParameterDuration('%1', %2" )
8257 code += QLatin1String(
", optional=True" );
8259 if (
minimum() != std::numeric_limits<double>::lowest() + 1 )
8260 code += QStringLiteral(
", minValue=%1" ).arg(
minimum() );
8261 if (
maximum() != std::numeric_limits<double>::max() )
8262 code += QStringLiteral(
", maxValue=%1" ).arg(
maximum() );
8274 map.insert( QStringLiteral(
"default_unit" ),
static_cast< int >( mDefaultUnit ) );
8316 switch ( outputType )
8320 QString code = QStringLiteral(
"QgsProcessingParameterScale('%1', %2" )
8323 code += QLatin1String(
", optional=True" );
8335 : ( definition.toLower().trimmed() == QLatin1String(
"none" ) ? QVariant() : definition ), isOptional );
8355 return QStringLiteral(
"None" );
8357 if ( value.userType() == qMetaTypeId<QgsProperty>() )
8358 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( value.value<
QgsProperty >().
asExpression() );
8360 const QString s = value.toString();
8366 QString code = QStringLiteral(
"##%1=" ).arg(
mName );
8368 code += QLatin1String(
"optional " );
8369 code += QLatin1String(
"layout " );
8372 return code.trimmed();
8377 switch ( outputType )
8381 QString code = QStringLiteral(
"QgsProcessingParameterLayout('%1', %2" )
8384 code += QLatin1String(
", optional=True" );
8395 QString def = definition;
8397 if ( def.startsWith(
'"' ) || def.startsWith(
'\'' ) )
8399 if ( def.endsWith(
'"' ) || def.endsWith(
'\'' ) )
8403 if ( def == QLatin1String(
"None" ) )
8430 return QStringLiteral(
"None" );
8432 if ( value.userType() == qMetaTypeId<QgsProperty>() )
8433 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( value.value<
QgsProperty >().
asExpression() );
8435 const QString s = value.toString();
8441 QString code = QStringLiteral(
"##%1=" ).arg(
mName );
8443 code += QLatin1String(
"optional " );
8444 code += QLatin1String(
"layoutitem " );
8445 if ( mItemType >= 0 )
8446 code += QString::number( mItemType ) +
' ';
8448 code += mParentLayoutParameterName +
' ';
8451 return code.trimmed();
8456 switch ( outputType )
8460 QString code = QStringLiteral(
"QgsProcessingParameterLayoutItem('%1', %2" )
8463 code += QLatin1String(
", optional=True" );
8465 if ( mItemType >= 0 )
8466 code += QStringLiteral(
", itemType=%1" ).arg( mItemType );
8468 code += QStringLiteral(
", parentLayoutParameterName='%1'" ).arg( mParentLayoutParameterName );
8481 map.insert( QStringLiteral(
"parent_layout" ), mParentLayoutParameterName );
8482 map.insert( QStringLiteral(
"item_type" ), mItemType );
8489 mParentLayoutParameterName = map.value( QStringLiteral(
"parent_layout" ) ).toString();
8490 mItemType = map.value( QStringLiteral(
"item_type" ) ).toInt();
8496 QStringList depends;
8497 if ( !mParentLayoutParameterName.isEmpty() )
8498 depends << mParentLayoutParameterName;
8505 QString def = definition;
8507 const thread_local QRegularExpression re( QStringLiteral(
"(\\d+)?\\s*(.*?)\\s+(.*)$" ) );
8508 const QRegularExpressionMatch m = re.match( def );
8511 itemType = m.captured( 1 ).trimmed().isEmpty() ? -1 : m.captured( 1 ).trimmed().toInt();
8512 parent = m.captured( 2 ).trimmed().isEmpty() ? m.captured( 3 ).trimmed() : m.captured( 2 ).trimmed();
8513 def = !m.captured( 2 ).trimmed().isEmpty() ? m.captured( 3 ) : QString();
8526 return mParentLayoutParameterName;
8531 mParentLayoutParameterName =
name;
8563 return QStringLiteral(
"None" );
8565 if ( value.userType() == qMetaTypeId<QgsProperty>() )
8566 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( value.value<
QgsProperty >().
asExpression() );
8568 if ( value.canConvert< QColor >() && !value.value< QColor >().isValid() )
8569 return QStringLiteral(
"QColor()" );
8571 if ( value.canConvert< QColor >() )
8573 const QColor
c = value.value< QColor >();
8574 if ( !mAllowOpacity ||
c.alpha() == 255 )
8575 return QStringLiteral(
"QColor(%1, %2, %3)" ).arg(
c.red() ).arg(
c.green() ).arg(
c.blue() );
8577 return QStringLiteral(
"QColor(%1, %2, %3, %4)" ).arg(
c.red() ).arg(
c.green() ).arg(
c.blue() ).arg(
c.alpha() );
8580 const QString s = value.toString();
8586 QString code = QStringLiteral(
"##%1=" ).arg(
mName );
8588 code += QLatin1String(
"optional " );
8589 code += QLatin1String(
"color " );
8591 if ( mAllowOpacity )
8592 code += QLatin1String(
"withopacity " );
8595 return code.trimmed();
8600 switch ( outputType )
8604 QString code = QStringLiteral(
"QgsProcessingParameterColor('%1', %2" )
8607 code += QLatin1String(
", optional=True" );
8609 code += QStringLiteral(
", opacityEnabled=%1" ).arg( mAllowOpacity ? QStringLiteral(
"True" ) : QStringLiteral(
"False" ) );
8621 if ( !input.isValid() && (
mDefault.isValid() && ( !
mDefault.toString().isEmpty() ||
mDefault.value< QColor >().isValid() ) ) )
8624 if ( !input.isValid() )
8627 if ( input.userType() == QMetaType::Type::QColor )
8631 else if ( input.userType() == qMetaTypeId<QgsProperty>() )
8636 if ( input.userType() != QMetaType::Type::QString || input.toString().isEmpty() )
8639 bool containsAlpha =
false;
8646 map.insert( QStringLiteral(
"opacityEnabled" ), mAllowOpacity );
8653 mAllowOpacity = map.value( QStringLiteral(
"opacityEnabled" ) ).toBool();
8659 return mAllowOpacity;
8664 mAllowOpacity = enabled;
8669 QString def = definition;
8671 bool allowOpacity =
false;
8672 if ( def.startsWith( QLatin1String(
"withopacity" ), Qt::CaseInsensitive ) )
8674 allowOpacity =
true;
8675 def = def.mid( 12 );
8678 if ( def.startsWith(
'"' ) || def.startsWith(
'\'' ) )
8680 if ( def.endsWith(
'"' ) || def.endsWith(
'\'' ) )
8684 if ( def == QLatin1String(
"None" ) || def.isEmpty() )
8697 , mSourceCrs( staticSourceCrs )
8698 , mDestCrs( staticDestinationCrs )
8710 return valueAsPythonStringPrivate( value, context,
false );
8713QString QgsProcessingParameterCoordinateOperation::valueAsPythonStringPrivate(
const QVariant &value,
QgsProcessingContext &context,
bool allowNonStringValues )
const
8716 return QStringLiteral(
"None" );
8718 if ( allowNonStringValues && value.userType() == qMetaTypeId<QgsCoordinateReferenceSystem>() )
8721 return QStringLiteral(
"QgsCoordinateReferenceSystem()" );
8726 if ( value.userType() == qMetaTypeId<QgsProperty>() )
8727 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( value.value< QgsProperty >().asExpression() );
8729 if ( allowNonStringValues )
8732 p.insert(
name(), value );
8738 const QString s = value.toString();
8744 QString code = QStringLiteral(
"##%1=" ).arg(
mName );
8746 code += QLatin1String(
"optional " );
8747 code += QLatin1String(
"coordinateoperation " );
8750 return code.trimmed();
8755 switch ( outputType )
8760 QString code = QStringLiteral(
"QgsProcessingParameterCoordinateOperation('%1', %2" )
8763 code += QLatin1String(
", optional=True" );
8764 if ( !mSourceParameterName.isEmpty() )
8765 code += QStringLiteral(
", sourceCrsParameterName=%1" ).arg( valueAsPythonStringPrivate( mSourceParameterName,
c,
false ) );
8766 if ( !mDestParameterName.isEmpty() )
8767 code += QStringLiteral(
", destinationCrsParameterName=%1" ).arg( valueAsPythonStringPrivate( mDestParameterName,
c,
false ) );
8769 if ( mSourceCrs.isValid() )
8770 code += QStringLiteral(
", staticSourceCrs=%1" ).arg( valueAsPythonStringPrivate( mSourceCrs,
c,
true ) );
8771 if ( mDestCrs.isValid() )
8772 code += QStringLiteral(
", staticDestinationCrs=%1" ).arg( valueAsPythonStringPrivate( mDestCrs,
c,
true ) );
8774 code += QStringLiteral(
", defaultValue=%1)" ).arg( valueAsPythonStringPrivate(
mDefault,
c,
false ) );
8784 if ( !mSourceParameterName.isEmpty() )
8785 res << mSourceParameterName;
8786 if ( !mDestParameterName.isEmpty() )
8787 res << mDestParameterName;
8794 map.insert( QStringLiteral(
"source_crs_parameter_name" ), mSourceParameterName );
8795 map.insert( QStringLiteral(
"dest_crs_parameter_name" ), mDestParameterName );
8796 map.insert( QStringLiteral(
"static_source_crs" ), mSourceCrs );
8797 map.insert( QStringLiteral(
"static_dest_crs" ), mDestCrs );
8804 mSourceParameterName = map.value( QStringLiteral(
"source_crs_parameter_name" ) ).toString();
8805 mDestParameterName = map.value( QStringLiteral(
"dest_crs_parameter_name" ) ).toString();
8806 mSourceCrs = map.value( QStringLiteral(
"static_source_crs" ) );
8807 mDestCrs = map.value( QStringLiteral(
"static_dest_crs" ) );
8813 QString def = definition;
8815 if ( def.startsWith(
'"' ) )
8818 if ( def.endsWith(
'"' ) )
8821 else if ( def.startsWith(
'\'' ) )
8824 if ( def.endsWith(
'\'' ) )
8829 if ( def == QLatin1String(
"None" ) )
8854 if ( !input.isValid() && !
mDefault.isValid() )
8857 if ( ( input.userType() == QMetaType::Type::QString && input.toString().isEmpty() )
8858 || ( !input.isValid() &&
mDefault.userType() == QMetaType::Type::QString &&
mDefault.toString().isEmpty() ) )
8866 if ( !value.isValid() )
8867 return QStringLiteral(
"None" );
8869 if ( value.userType() == qMetaTypeId<QgsProperty>() )
8870 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( value.value<
QgsProperty >().
asExpression() );
8877 QString code = QStringLiteral(
"##%1=" ).arg(
mName );
8879 code += QLatin1String(
"optional " );
8880 code += QLatin1String(
"maptheme " );
8883 return code.trimmed();
8888 switch ( outputType )
8892 QString code = QStringLiteral(
"QgsProcessingParameterMapTheme('%1', %2" )
8895 code += QLatin1String(
", optional=True" );
8920 QString def = definition;
8921 if ( def.startsWith(
'"' ) || def.startsWith(
'\'' ) )
8923 if ( def.endsWith(
'"' ) || def.endsWith(
'\'' ) )
8945 if ( mMin.isValid() && mMax.isValid() && mMin >= mMax )
8947 QgsMessageLog::logMessage( QObject::tr(
"Invalid datetime parameter \"%1\": min value %2 is >= max value %3!" ).arg( name, mMin.toString(), mMax.toString() ), QObject::tr(
"Processing" ) );
8958 QVariant input = value;
8959 if ( !input.isValid() )
8967 if ( input.userType() == qMetaTypeId<QgsProperty>() )
8972 if ( input.userType() != QMetaType::Type::QDateTime && input.userType() != QMetaType::Type::QDate && input.userType() != QMetaType::Type::QTime && input.userType() != QMetaType::Type::QString )
8978 if ( input.userType() == QMetaType::Type::QString )
8980 const QString s = input.toString();
8984 input = QDateTime::fromString( s, Qt::ISODate );
8987 if ( !input.toDateTime().isValid() )
8988 input = QTime::fromString( s );
8990 input = input.toDateTime().time();
8996 const QDateTime res = input.toDateTime();
8997 return res.isValid() && ( res >= mMin || !mMin.isValid() ) && ( res <= mMax || !mMax.isValid() );
9001 const QTime res = input.toTime();
9002 return res.isValid() && ( res >= mMin.time() || !mMin.isValid() ) && ( res <= mMax.time() || !mMax.isValid() );
9008 if ( !value.isValid() )
9009 return QStringLiteral(
"None" );
9011 if ( value.userType() == qMetaTypeId<QgsProperty>() )
9012 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( value.value<
QgsProperty >().
asExpression() );
9014 if ( value.userType() == QMetaType::Type::QDateTime )
9016 const QDateTime dt = value.toDateTime();
9017 if ( !dt.isValid() )
9018 return QStringLiteral(
"QDateTime()" );
9020 return QStringLiteral(
"QDateTime(QDate(%1, %2, %3), QTime(%4, %5, %6))" ).arg( dt.date().year() )
9021 .arg( dt.date().month() )
9022 .arg( dt.date().day() )
9023 .arg( dt.time().hour() )
9024 .arg( dt.time().minute() )
9025 .arg( dt.time().second() );
9027 else if ( value.userType() == QMetaType::Type::QDate )
9029 const QDate dt = value.toDate();
9030 if ( !dt.isValid() )
9031 return QStringLiteral(
"QDate()" );
9033 return QStringLiteral(
"QDate(%1, %2, %3)" ).arg( dt.year() )
9037 else if ( value.userType() == QMetaType::Type::QTime )
9039 const QTime dt = value.toTime();
9040 if ( !dt.isValid() )
9041 return QStringLiteral(
"QTime()" );
9043 return QStringLiteral(
"QTime(%4, %5, %6)" )
9046 .arg( dt.second() );
9048 return value.toString();
9055 if ( mMin.isValid() )
9056 parts << QObject::tr(
"Minimum value: %1" ).arg( mMin.toString( Qt::ISODate ) );
9057 if ( mMax.isValid() )
9058 parts << QObject::tr(
"Maximum value: %1" ).arg( mMax.toString( Qt::ISODate ) );
9062 const QString extra = parts.join( QLatin1String(
"<br />" ) );
9063 if ( !extra.isEmpty() )
9064 text += QStringLiteral(
"<p>%1</p>" ).arg( extra );
9070 switch ( outputType )
9074 QString code = QStringLiteral(
"QgsProcessingParameterDateTime('%1', %2" )
9077 code += QLatin1String(
", optional=True" );
9081 : QStringLiteral(
"QgsProcessingParameterDateTime.Time" ) );
9084 if ( mMin.isValid() )
9086 if ( mMax.isValid() )
9128 map.insert( QStringLiteral(
"min" ), mMin );
9129 map.insert( QStringLiteral(
"max" ), mMax );
9130 map.insert( QStringLiteral(
"data_type" ),
static_cast< int >( mDataType ) );
9137 mMin = map.value( QStringLiteral(
"min" ) ).toDateTime();
9138 mMax = map.value( QStringLiteral(
"max" ) ).toDateTime();
9146 : ( definition.toLower().trimmed() == QLatin1String(
"none" ) ? QVariant() : definition ), isOptional );
9155 if ( value.userType() == QMetaType::Type::QDateTime )
9157 const QDateTime dt = value.toDateTime();
9158 if ( !dt.isValid() )
9159 return QObject::tr(
"Invalid datetime" );
9161 return dt.toString( Qt::ISODate );
9164 else if ( value.userType() == QMetaType::Type::QDate )
9166 const QDate dt = value.toDate();
9167 if ( !dt.isValid() )
9168 return QObject::tr(
"Invalid date" );
9170 return dt.toString( Qt::ISODate );
9173 else if ( value.userType() == QMetaType::Type::QTime )
9175 const QTime dt = value.toTime();
9176 if ( !dt.isValid() )
9177 return QObject::tr(
"Invalid time" );
9179 return dt.toString( Qt::ISODate );
9182 return value.toString();
9204 if ( !input.isValid() && !
mDefault.isValid() )
9207 if ( ( input.userType() == QMetaType::Type::QString && input.toString().isEmpty() )
9208 || ( !input.isValid() &&
mDefault.userType() == QMetaType::Type::QString &&
mDefault.toString().isEmpty() ) )
9216 if ( !value.isValid() )
9217 return QStringLiteral(
"None" );
9219 if ( value.userType() == qMetaTypeId<QgsProperty>() )
9220 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( value.value<
QgsProperty >().
asExpression() );
9227 QString code = QStringLiteral(
"##%1=" ).arg(
mName );
9229 code += QLatin1String(
"optional " );
9230 code += QLatin1String(
"providerconnection " );
9231 code += mProviderId +
' ';
9234 return code.trimmed();
9239 switch ( outputType )
9243 QString code = QStringLiteral(
"QgsProcessingParameterProviderConnection('%1', %2, '%3'" )
9246 code += QLatin1String(
", optional=True" );
9260 map.insert( QStringLiteral(
"provider" ), mProviderId );
9267 mProviderId = map.value( QStringLiteral(
"provider" ) ).toString();
9273 QString def = definition;
9275 if ( def.contains(
' ' ) )
9277 provider = def.left( def.indexOf(
' ' ) );
9278 def = def.mid( def.indexOf(
' ' ) + 1 );
9286 if ( def.startsWith(
'"' ) || def.startsWith(
'\'' ) )
9288 if ( def.endsWith(
'"' ) || def.endsWith(
'\'' ) )
9306 , mParentConnectionParameterName( parentLayerParameterName )
9319 if ( !input.isValid() && !
mDefault.isValid() )
9322 if ( ( input.userType() == QMetaType::Type::QString && input.toString().isEmpty() )
9323 || ( !input.isValid() &&
mDefault.userType() == QMetaType::Type::QString &&
mDefault.toString().isEmpty() ) )
9331 if ( !value.isValid() )
9332 return QStringLiteral(
"None" );
9334 if ( value.userType() == qMetaTypeId<QgsProperty>() )
9335 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( value.value<
QgsProperty >().
asExpression() );
9342 QString code = QStringLiteral(
"##%1=" ).arg(
mName );
9344 code += QLatin1String(
"optional " );
9345 code += QLatin1String(
"databaseschema " );
9347 code += mParentConnectionParameterName +
' ';
9350 return code.trimmed();
9355 switch ( outputType )
9359 QString code = QStringLiteral(
"QgsProcessingParameterDatabaseSchema('%1', %2" )
9362 code += QLatin1String(
", optional=True" );
9364 code += QStringLiteral(
", connectionParameterName='%1'" ).arg( mParentConnectionParameterName );
9378 QStringList depends;
9379 if ( !mParentConnectionParameterName.isEmpty() )
9380 depends << mParentConnectionParameterName;
9386 return mParentConnectionParameterName;
9391 mParentConnectionParameterName =
name;
9397 map.insert( QStringLiteral(
"mParentConnectionParameterName" ), mParentConnectionParameterName );
9404 mParentConnectionParameterName = map.value( QStringLiteral(
"mParentConnectionParameterName" ) ).toString();
9411 QString def = definition;
9413 const thread_local QRegularExpression re( QStringLiteral(
"(.*?)\\s+(.*)$" ) );
9414 const QRegularExpressionMatch m = re.match( def );
9417 parent = m.captured( 1 ).trimmed();
9418 def = m.captured( 2 );
9434 const QString &connectionParameterName,
9435 const QString &schemaParameterName,
9438 , mParentConnectionParameterName( connectionParameterName )
9439 , mParentSchemaParameterName( schemaParameterName )
9453 if ( !input.isValid() && !
mDefault.isValid() )
9456 if ( ( input.userType() == QMetaType::Type::QString && input.toString().isEmpty() )
9457 || ( !input.isValid() &&
mDefault.userType() == QMetaType::Type::QString &&
mDefault.toString().isEmpty() ) )
9465 if ( !value.isValid() )
9466 return QStringLiteral(
"None" );
9468 if ( value.userType() == qMetaTypeId<QgsProperty>() )
9469 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( value.value<
QgsProperty >().
asExpression() );
9476 QString code = QStringLiteral(
"##%1=" ).arg(
mName );
9478 code += QLatin1String(
"optional " );
9479 code += QLatin1String(
"databasetable " );
9481 code += ( mParentConnectionParameterName.isEmpty() ? QStringLiteral(
"none" ) : mParentConnectionParameterName ) +
' ';
9482 code += ( mParentSchemaParameterName.isEmpty() ? QStringLiteral(
"none" ) : mParentSchemaParameterName ) +
' ';
9485 return code.trimmed();
9490 switch ( outputType )
9494 QString code = QStringLiteral(
"QgsProcessingParameterDatabaseTable('%1', %2" )
9497 code += QLatin1String(
", optional=True" );
9499 if ( mAllowNewTableNames )
9500 code += QLatin1String(
", allowNewTableNames=True" );
9502 code += QStringLiteral(
", connectionParameterName='%1'" ).arg( mParentConnectionParameterName );
9503 code += QStringLiteral(
", schemaParameterName='%1'" ).arg( mParentSchemaParameterName );
9517 QStringList depends;
9518 if ( !mParentConnectionParameterName.isEmpty() )
9519 depends << mParentConnectionParameterName;
9520 if ( !mParentSchemaParameterName.isEmpty() )
9521 depends << mParentSchemaParameterName;
9527 return mParentConnectionParameterName;
9532 mParentConnectionParameterName =
name;
9537 return mParentSchemaParameterName;
9542 mParentSchemaParameterName =
name;
9548 map.insert( QStringLiteral(
"mParentConnectionParameterName" ), mParentConnectionParameterName );
9549 map.insert( QStringLiteral(
"mParentSchemaParameterName" ), mParentSchemaParameterName );
9550 map.insert( QStringLiteral(
"mAllowNewTableNames" ), mAllowNewTableNames );
9557 mParentConnectionParameterName = map.value( QStringLiteral(
"mParentConnectionParameterName" ) ).toString();
9558 mParentSchemaParameterName = map.value( QStringLiteral(
"mParentSchemaParameterName" ) ).toString();
9559 mAllowNewTableNames = map.value( QStringLiteral(
"mAllowNewTableNames" ),
false ).toBool();
9567 QString def = definition;
9569 const thread_local QRegularExpression re( QStringLiteral(
"(.*?)\\s+(.*+)\\b\\s*(.*)$" ) );
9570 const QRegularExpressionMatch m = re.match( def );
9573 connection = m.captured( 1 ).trimmed();
9574 if ( connection == QLatin1String(
"none" ) )
9576 schema = m.captured( 2 ).trimmed();
9577 if ( schema == QLatin1String(
"none" ) )
9579 def = m.captured( 3 );
9587 return mAllowNewTableNames;
9614 if ( !var.isValid() )
9622 if ( var.userType() == qMetaTypeId<QgsProperty>() )
9635 if ( qobject_cast< QgsPointCloudLayer * >( qvariant_cast<QObject *>( var ) ) )
9638 if ( var.userType() != QMetaType::Type::QString || var.toString().isEmpty() )
9656 if ( !val.isValid() )
9657 return QStringLiteral(
"None" );
9659 if ( val.userType() == qMetaTypeId<QgsProperty>() )
9663 p.insert(
name(), val );
9707 if ( !var.isValid() )
9715 if ( var.userType() == qMetaTypeId<QgsProperty>() )
9728 if ( qobject_cast< QgsAnnotationLayer * >( qvariant_cast<QObject *>( var ) ) )
9731 if ( var.userType() != QMetaType::Type::QString || var.toString().isEmpty() )
9749 if ( !val.isValid() )
9750 return QStringLiteral(
"None" );
9752 if ( val.userType() == qMetaTypeId<QgsProperty>() )
9756 p.insert(
name(), val );
9789 QVariant var = input;
9790 if ( !var.isValid() )
9798 if ( var.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
9804 if ( var.userType() == qMetaTypeId<QgsProperty>() )
9817 if ( var.userType() != QMetaType::Type::QString )
9820 if ( var.toString().isEmpty() )
9828 if ( !value.isValid() )
9829 return QStringLiteral(
"None" );
9831 if ( value.userType() == qMetaTypeId<QgsProperty>() )
9832 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( value.value<
QgsProperty >().
asExpression() );
9834 if ( value.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
9843 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( fromVar.
sink.
asExpression() );
9859 return lOriginalProvider->defaultPointCloudFileExtension();
9863 return p->defaultPointCloudFileExtension();
9874 QStringList filters;
9875 for (
const QString &ext : exts )
9877 filters << QObject::tr(
"%1 files (*.%2)" ).arg( ext.toUpper(), ext.toLower() );
9879 return filters.join( QLatin1String(
";;" ) ) + QStringLiteral(
";;" ) + QObject::tr(
"All files (*.*)" );
9886 return lOriginalProvider->supportedOutputPointCloudLayerExtensions();
9890 return p->supportedOutputPointCloudLayerExtensions();
9895 return QStringList() << ext;
9932 if ( input.userType() == qMetaTypeId<QgsProperty>() )
9937 if ( input.userType() == QMetaType::Type::QVariantList || input.userType() == QMetaType::Type::QStringList )
9939 if ( !mAllowMultiple )
9945 else if ( input.userType() == QMetaType::Type::QString )
9947 if ( input.toString().isEmpty() )
9950 const QStringList parts = input.toString().split(
';' );
9951 if ( parts.count() > 1 && !mAllowMultiple )
9956 if ( input.toString().isEmpty() )
9964 if ( !value.isValid() )
9965 return QStringLiteral(
"None" );
9967 if ( value.userType() == qMetaTypeId<QgsProperty>() )
9968 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( value.value<
QgsProperty >().
asExpression() );
9970 if ( value.userType() == QMetaType::Type::QVariantList )
9973 const auto constToList = value.toList();
9974 for (
const QVariant &val : constToList )
9978 return parts.join(
',' ).prepend(
'[' ).append(
']' );
9980 else if ( value.userType() == QMetaType::Type::QStringList )
9983 const auto constToStringList = value.toStringList();
9984 for (
const QString &s : constToStringList )
9988 return parts.join(
',' ).prepend(
'[' ).append(
']' );
9996 QString code = QStringLiteral(
"##%1=" ).arg(
mName );
9998 code += QLatin1String(
"optional " );
9999 code += QLatin1String(
"attribute " );
10001 if ( mAllowMultiple )
10002 code += QLatin1String(
"multiple " );
10004 if ( mDefaultToAllAttributes )
10005 code += QLatin1String(
"default_to_all_attributes " );
10007 code += mParentLayerParameterName +
' ';
10010 return code.trimmed();
10015 switch ( outputType )
10019 QString code = QStringLiteral(
"QgsProcessingParameterPointCloudAttribute('%1', %2" )
10022 code += QLatin1String(
", optional=True" );
10024 code += QStringLiteral(
", parentLayerParameterName='%1'" ).arg( mParentLayerParameterName );
10025 code += QStringLiteral(
", allowMultiple=%1" ).arg( mAllowMultiple ? QStringLiteral(
"True" ) : QStringLiteral(
"False" ) );
10029 if ( mDefaultToAllAttributes )
10030 code += QLatin1String(
", defaultToAllAttributes=True" );
10042 QStringList depends;
10043 if ( !mParentLayerParameterName.isEmpty() )
10044 depends << mParentLayerParameterName;
10050 return mParentLayerParameterName;
10060 return mAllowMultiple;
10070 return mDefaultToAllAttributes;
10075 mDefaultToAllAttributes = enabled;
10081 map.insert( QStringLiteral(
"parent_layer" ), mParentLayerParameterName );
10082 map.insert( QStringLiteral(
"allow_multiple" ), mAllowMultiple );
10083 map.insert( QStringLiteral(
"default_to_all_attributes" ), mDefaultToAllAttributes );
10090 mParentLayerParameterName = map.value( QStringLiteral(
"parent_layer" ) ).toString();
10091 mAllowMultiple = map.value( QStringLiteral(
"allow_multiple" ) ).toBool();
10092 mDefaultToAllAttributes = map.value( QStringLiteral(
"default_to_all_attributes" ) ).toBool();
10101 QString def = definition;
10103 if ( def.startsWith( QLatin1String(
"multiple" ), Qt::CaseInsensitive ) )
10106 def = def.mid( 8 ).trimmed();
10109 if ( def.startsWith( QLatin1String(
"default_to_all_attributes" ), Qt::CaseInsensitive ) )
10112 def = def.mid( 25 ).trimmed();
10115 const thread_local QRegularExpression re( QStringLiteral(
"(.*?)\\s+(.*)$" ) );
10116 const QRegularExpressionMatch m = re.match( def );
10117 if ( m.hasMatch() )
10119 parent = m.captured( 1 ).trimmed();
10120 def = m.captured( 2 );
10147 QVariant var = input;
10148 if ( !var.isValid() )
10156 if ( var.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
10159 var = fromVar.
sink;
10162 if ( var.userType() == qMetaTypeId<QgsProperty>() )
10175 if ( var.userType() != QMetaType::Type::QString )
10178 if ( var.toString().isEmpty() )
10186 if ( !value.isValid() )
10187 return QStringLiteral(
"None" );
10189 if ( value.userType() == qMetaTypeId<QgsProperty>() )
10190 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( value.value<
QgsProperty >().
asExpression() );
10192 if ( value.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
10201 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( fromVar.
sink.
asExpression() );
10221 QStringList filters;
10222 for (
const QString &ext : exts )
10224 filters << QObject::tr(
"%1 files (*.%2)" ).arg( ext.toUpper(), ext.toLower() );
10226 return filters.join( QLatin1String(
";;" ) ) + QStringLiteral(
";;" ) + QObject::tr(
"All files (*.*)" );
10232 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.
QString format() const
Returns the format (if set).
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.
QString defaultFileFormat() const
Returns the default file format for destination file paths associated with this parameter.
virtual Q_DECL_DEPRECATED 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.
virtual QList< QPair< QString, QString > > supportedOutputRasterLayerFormatAndExtensions() const
Returns a list of (format, file extension) supported by this provider.
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 QString parameterAsOutputFormat(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context)
Evaluates the parameter with matching definition to a output format.
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...
static QList< QPair< QString, QString > > supportedOutputRasterLayerFormatAndExtensionsDefault()
Returns a list of (format, file extension) supported by GDAL.
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 QString defaultRasterFormat()
Returns the default raster format to use, in the absence of all other constraints (e....
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 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 extensionsForFormat(const QString &format)
Returns a list of known file extensions for the given GDAL driver format.
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()