47#include "qgsvirtualpointcloudprovider.h"
49#include <QRegularExpression>
52using namespace Qt::StringLiterals;
57 map.insert( u
"source"_s,
source.toVariant() );
61 map.insert( u
"flags"_s,
static_cast< int >(
flags ) );
62 map.insert( u
"geometry_check"_s,
static_cast< int >(
geometryCheck ) );
68 source.loadVariant( map.value( u
"source"_s ) );
70 featureLimit = map.value( u
"feature_limit"_s, -1 ).toLongLong();
84 map.insert( u
"source"_s,
source.toVariant() );
86 map.insert( u
"dpi"_s,
dpi );
92 source.loadVariant( map.value( u
"source"_s ) );
94 dpi = map.value( u
"dpi"_s, 0 ).toInt();
105 mUseRemapping =
true;
106 mRemappingDefinition = definition;
112 map.insert( u
"sink"_s,
sink.toVariant() );
115 map.insert( u
"remapping"_s, QVariant::fromValue( mRemappingDefinition ) );
121 sink.loadVariant( map.value( u
"sink"_s ) );
123 if ( map.contains( u
"remapping"_s ) )
125 mUseRemapping =
true;
130 mUseRemapping =
false;
141 && mUseRemapping == other.mUseRemapping
142 && mRemappingDefinition == other.mRemappingDefinition;
147 return !( *
this == other );
152 const QVariant val = parameters.value( name );
153 if ( val.userType() == qMetaTypeId<QgsProperty>() )
172 QVariant val = value;
173 if ( val.userType() == qMetaTypeId<QgsProperty>() )
176 if ( !val.isValid() )
185 return destParam->generateTemporaryDestination( &context );
188 return val.toString();
204 const QVariant val = value;
205 if ( val.userType() == qMetaTypeId<QgsProperty>() )
208 if ( val.isValid() && !val.toString().isEmpty() )
212 return val.toString();
232 QVariant val = value;
233 if ( val.userType() == qMetaTypeId<QgsProperty>() )
237 const double res = val.toDouble( &ok );
243 return val.toDouble();
259 QVariant val = value;
260 if ( val.userType() == qMetaTypeId<QgsProperty>() )
264 double dbl = val.toDouble( &ok );
269 dbl = val.toDouble( &ok );
276 const double round = std::round( dbl );
277 if ( round > std::numeric_limits<int>::max() || round < -std::numeric_limits<int>::max() )
282 return static_cast< int >( std::round( dbl ) );
291 return QList< int >();
299 return QList< int >();
301 QList< int > resultList;
302 const QVariant val = value;
305 if ( val.userType() == qMetaTypeId<QgsProperty>() )
307 else if ( val.userType() == QMetaType::Type::QVariantList )
309 const QVariantList list = val.toList();
310 for (
auto it = list.constBegin(); it != list.constEnd(); ++it )
311 resultList << it->toInt();
315 const QStringList parts = val.toString().split(
';' );
316 for (
auto it = parts.constBegin(); it != parts.constEnd(); ++it )
317 resultList << it->toInt();
321 if ( resultList.isEmpty() )
326 if ( definition->
defaultValue().userType() == QMetaType::Type::QVariantList )
328 const QVariantList list = definition->
defaultValue().toList();
329 for (
auto it = list.constBegin(); it != list.constEnd(); ++it )
330 resultList << it->toInt();
334 const QStringList parts = definition->
defaultValue().toString().split(
';' );
335 for (
auto it = parts.constBegin(); it != parts.constEnd(); ++it )
336 resultList << it->toInt();
357 QVariant val = value;
358 if ( val.userType() == qMetaTypeId<QgsProperty>() )
361 QDateTime d = val.toDateTime();
362 if ( !d.isValid() && val.userType() == QMetaType::Type::QString )
364 d = QDateTime::fromString( val.toString() );
371 d = val.toDateTime();
373 if ( !d.isValid() && val.userType() == QMetaType::Type::QString )
375 d = QDateTime::fromString( val.toString() );
394 QVariant val = value;
395 if ( val.userType() == qMetaTypeId<QgsProperty>() )
398 QDate d = val.toDate();
399 if ( !d.isValid() && val.userType() == QMetaType::Type::QString )
401 d = QDate::fromString( val.toString() );
410 if ( !d.isValid() && val.userType() == QMetaType::Type::QString )
412 d = QDate::fromString( val.toString() );
431 QVariant val = value;
432 if ( val.userType() == qMetaTypeId<QgsProperty>() )
437 if ( val.userType() == QMetaType::Type::QDateTime )
438 d = val.toDateTime().time();
442 if ( !d.isValid() && val.userType() == QMetaType::Type::QString )
444 d = QTime::fromString( val.toString() );
453 if ( !d.isValid() && val.userType() == QMetaType::Type::QString )
455 d = QTime::fromString( val.toString() );
476 if ( enumDef && val >= enumDef->
options().size() )
496 QVariantList resultList;
497 const QVariant val = value;
498 if ( val.userType() == qMetaTypeId<QgsProperty>() )
500 else if ( val.userType() == QMetaType::Type::QVariantList )
502 const auto constToList = val.toList();
503 for (
const QVariant &var : constToList )
506 else if ( val.userType() == QMetaType::Type::QString )
508 const auto constSplit = val.toString().split(
',' );
509 for (
const QString &var : constSplit )
515 if ( resultList.isEmpty() )
516 return QList< int >();
518 if ( ( !val.isValid() || !resultList.at( 0 ).isValid() ) && definition )
522 if ( definition->
defaultValue().userType() == QMetaType::Type::QVariantList )
524 const auto constToList = definition->
defaultValue().toList();
525 for (
const QVariant &var : constToList )
528 else if ( definition->
defaultValue().userType() == QMetaType::Type::QString )
530 const auto constSplit = definition->
defaultValue().toString().split(
',' );
531 for (
const QString &var : constSplit )
540 const auto constResultList = resultList;
541 for (
const QVariant &var : constResultList )
543 const int resInt = var.toInt();
544 if ( !enumDef || resInt < enumDef->options().size() )
577 return QStringList();
585 return QStringList();
587 const QVariant val = value;
589 QStringList enumValues;
591 std::function< void(
const QVariant &var ) > processVariant;
592 processVariant = [&enumValues, &context, &definition, &processVariant](
const QVariant &var ) {
593 if ( var.userType() == QMetaType::Type::QVariantList )
595 const auto constToList = var.toList();
596 for (
const QVariant &listVar : constToList )
598 processVariant( listVar );
601 else if ( var.userType() == QMetaType::Type::QStringList )
603 const auto constToStringList = var.toStringList();
604 for (
const QString &s : constToStringList )
609 else if ( var.userType() == qMetaTypeId<QgsProperty>() )
613 const QStringList parts = var.toString().split(
',' );
614 for (
const QString &s : parts )
621 processVariant( val );
628 const QStringList options = enumDef->options();
629 const QSet<QString> subtraction = QSet<QString>( enumValues.begin(), enumValues.end() ).subtract( QSet<QString>( options.begin(), options.end() ) );
631 if ( enumValues.isEmpty() || !subtraction.isEmpty() )
665 const QVariant val = value;
666 if ( val.userType() == qMetaTypeId<QgsProperty>() )
668 else if ( val.isValid() )
681 const QVariant val = value;
682 if ( val.userType() == qMetaTypeId<QgsProperty>() )
684 else if ( val.isValid() )
692 const QVariantMap ¶meters,
697 QString &destinationIdentifier,
699 const QVariantMap &createOptions,
700 const QStringList &datasourceOptions,
701 const QStringList &layerOptions
707 val = parameters.value( definition->
name() );
710 return parameterAsSink( definition, val, fields, geometryType, crs, context, destinationIdentifier, sinkFlags, createOptions, datasourceOptions, layerOptions );
715 const QVariant &value,
720 QString &destinationIdentifier,
722 const QVariantMap &createOptions,
723 const QStringList &datasourceOptions,
724 const QStringList &layerOptions
727 QVariantMap options = createOptions;
728 QVariant val = value;
733 bool useRemapDefinition =
false;
734 if ( val.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
745 useRemapDefinition =
true;
751 if ( definition && val.userType() == qMetaTypeId<QgsProperty>() )
755 else if ( !val.isValid() || val.toString().isEmpty() )
771 dest = val.toString();
776 dest = destParam->generateTemporaryDestination( &context );
779 if ( dest.isEmpty() )
782 std::unique_ptr< QgsFeatureSink > sink(
783 QgsProcessingUtils::createFeatureSink( dest, context, fields, geometryType, crs, options, datasourceOptions, layerOptions, sinkFlags, useRemapDefinition ? &remapDefinition :
nullptr )
785 destinationIdentifier = dest;
787 if ( destinationProject )
789 if ( destName.isEmpty() && definition )
795 outputName = definition->
name();
799 return sink.release();
825 const QVariantMap ¶meters,
827 const QStringList &compatibleFormats,
828 const QString &preferredFormat,
836 QVariant val = parameters.value( definition->
name() );
838 bool selectedFeaturesOnly =
false;
839 long long featureLimit = -1;
840 QString filterExpression;
841 if ( val.userType() == qMetaTypeId<QgsProcessingFeatureSourceDefinition>() )
850 else if ( val.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
857 if ( val.userType() == qMetaTypeId<QgsProperty>() )
863 vl = qobject_cast< QgsVectorLayer * >( qvariant_cast<QObject *>( val ) );
868 if ( val.userType() == qMetaTypeId<QgsProperty>() )
872 else if ( !val.isValid() || val.toString().isEmpty() )
878 vl = qobject_cast< QgsVectorLayer * >( qvariant_cast<QObject *>( val ) );
884 layerRef = val.toString();
889 if ( layerRef.isEmpty() )
907 const QVariantMap ¶meters,
909 const QStringList &compatibleFormats,
910 const QString &preferredFormat,
919 const QVariantMap ¶meters,
921 const QStringList &compatibleFormats,
922 const QString &preferredFormat,
927 QString *destLayer = layerName;
944 return parameterAsLayer( definition, parameters.value( definition->
name() ), context, layerHint, flags );
954 QVariant val = value;
955 if ( val.userType() == qMetaTypeId<QgsProperty>() )
960 if (
QgsMapLayer *layer = qobject_cast< QgsMapLayer * >( qvariant_cast<QObject *>( val ) ) )
965 if ( val.userType() == qMetaTypeId<QgsProcessingRasterLayerDefinition>() )
971 if ( val.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
983 if ( !val.isValid() || val.toString().isEmpty() )
989 if (
QgsMapLayer *layer = qobject_cast< QgsMapLayer * >( qvariant_cast<QObject *>( val ) ) )
994 QString layerRef = val.toString();
995 if ( layerRef.isEmpty() )
998 if ( layerRef.isEmpty() )
1029 val = parameters.value( definition->
name() );
1040 val = parameters.value( definition->
name() );
1041 if ( val.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
1045 format = fromVar.
format();
1053 QVariant val = value;
1057 if ( val.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
1067 if ( definition && val.userType() == qMetaTypeId<QgsProperty>() )
1071 else if ( definition && ( !val.isValid() || val.toString().isEmpty() ) )
1078 dest = val.toString();
1083 dest = destParam->generateTemporaryDestination( &context );
1086 if ( destinationProject )
1089 if ( destName.isEmpty() && definition )
1094 outputName = definition->
name();
1118 val = parameters.value( definition->
name() );
1125 QVariant val = value;
1127 if ( val.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
1135 if ( definition && val.userType() == qMetaTypeId<QgsProperty>() )
1139 else if ( definition && ( !val.isValid() || val.toString().isEmpty() ) )
1146 dest = val.toString();
1151 dest = destParam->generateTemporaryDestination( &context );
1171 return parameterAsCrs( definition, parameters.value( definition->
name() ), context );
1197 QVariant val = value;
1199 if ( val.userType() == qMetaTypeId<QgsRectangle>() )
1203 if ( val.userType() == qMetaTypeId< QgsGeometry>() )
1209 if ( val.userType() == qMetaTypeId<QgsReferencedRectangle>() )
1228 if ( val.userType() == qMetaTypeId<QgsProcessingFeatureSourceDefinition>() )
1234 else if ( val.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
1247 QgsMapLayer *layer = qobject_cast< QgsMapLayer * >( qvariant_cast<QObject *>( val ) );
1250 if ( val.userType() == qMetaTypeId<QgsProperty>() )
1253 rectText = val.toString();
1255 if ( rectText.isEmpty() && !layer )
1258 const thread_local QRegularExpression rx( u
"^(.*?)\\s*,\\s*(.*?),\\s*(.*?),\\s*(.*?)\\s*(?:\\[(.*)\\])?\\s*$"_s );
1259 const QRegularExpressionMatch match = rx.match( rectText );
1260 if ( match.hasMatch() )
1262 bool xMinOk =
false;
1263 const double xMin = match.captured( 1 ).toDouble( &xMinOk );
1264 bool xMaxOk =
false;
1265 const double xMax = match.captured( 2 ).toDouble( &xMaxOk );
1266 bool yMinOk =
false;
1267 const double yMin = match.captured( 3 ).toDouble( &yMinOk );
1268 bool yMaxOk =
false;
1269 const double yMax = match.captured( 4 ).toDouble( &yMaxOk );
1270 if ( xMinOk && xMaxOk && yMinOk && yMaxOk )
1323 QVariant val = parameters.value( definition->
name() );
1325 if ( val.userType() == qMetaTypeId<QgsReferencedRectangle>() )
1331 g = g.densifyByCount( 20 );
1345 if ( val.userType() == qMetaTypeId<QgsProcessingFeatureSourceDefinition>() )
1351 else if ( val.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
1364 if ( val.userType() == qMetaTypeId<QgsProperty>() )
1367 rectText = val.toString();
1369 if ( !rectText.isEmpty() )
1371 const thread_local QRegularExpression rx( u
"^(.*?)\\s*,\\s*(.*?),\\s*(.*?),\\s*(.*?)\\s*(?:\\[(.*)\\])?\\s*$"_s );
1372 const QRegularExpressionMatch match = rx.match( rectText );
1373 if ( match.hasMatch() )
1375 bool xMinOk =
false;
1376 const double xMin = match.captured( 1 ).toDouble( &xMinOk );
1377 bool xMaxOk =
false;
1378 const double xMax = match.captured( 2 ).toDouble( &xMaxOk );
1379 bool yMinOk =
false;
1380 const double yMin = match.captured( 3 ).toDouble( &yMinOk );
1381 bool yMaxOk =
false;
1382 const double yMax = match.captured( 4 ).toDouble( &yMaxOk );
1383 if ( xMinOk && xMaxOk && yMinOk && yMaxOk )
1413 QgsMapLayer *layer = qobject_cast< QgsMapLayer * >( qvariant_cast<QObject *>( val ) );
1442 const QVariant val = parameters.value( definition->
name() );
1448 QVariant val = value;
1449 if ( val.userType() == qMetaTypeId<QgsReferencedRectangle>() )
1458 if ( val.userType() == qMetaTypeId<QgsProcessingFeatureSourceDefinition>() )
1464 else if ( val.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
1476 QString valueAsString;
1477 if ( val.userType() == qMetaTypeId<QgsProperty>() )
1480 valueAsString = val.toString();
1482 const thread_local QRegularExpression rx( u
"^(.*?)\\s*,\\s*(.*?),\\s*(.*?),\\s*(.*?)\\s*(?:\\[(.*)\\])?\\s*$"_s );
1484 const QRegularExpressionMatch match = rx.match( valueAsString );
1485 if ( match.hasMatch() )
1492 if ( val.userType() == qMetaTypeId<QgsProcessingFeatureSourceDefinition>() )
1498 else if ( val.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
1511 if (
QgsMapLayer *layer = qobject_cast< QgsMapLayer * >( qvariant_cast<QObject *>( val ) ) )
1512 return layer->crs();
1514 return layer->crs();
1516 if (
auto *lProject = context.
project() )
1517 return lProject->crs();
1537 const QVariant val = value;
1538 if ( val.userType() == qMetaTypeId<QgsPointXY>() )
1542 if ( val.userType() == qMetaTypeId< QgsGeometry>() )
1548 if ( val.userType() == qMetaTypeId<QgsReferencedPointXY>() )
1567 if ( pointText.isEmpty() )
1570 if ( pointText.isEmpty() )
1573 const thread_local QRegularExpression rx( u
"^\\s*\\(?\\s*(.*?)\\s*,\\s*(.*?)\\s*(?:\\[(.*)\\])?\\s*\\)?\\s*$"_s );
1576 const QRegularExpressionMatch match = rx.match( valueAsString );
1577 if ( match.hasMatch() )
1580 const double x = match.captured( 1 ).toDouble( &xOk );
1582 const double y = match.captured( 2 ).toDouble( &yOk );
1610 const QVariant val = parameters.value( definition->
name() );
1616 if ( value.userType() == qMetaTypeId<QgsReferencedPointXY>() )
1625 const thread_local QRegularExpression rx( u
"^\\s*\\(?\\s*(.*?)\\s*,\\s*(.*?)\\s*(?:\\[(.*)\\])?\\s*\\)?\\s*$"_s );
1628 const QRegularExpressionMatch match = rx.match( valueAsString );
1629 if ( match.hasMatch() )
1636 if (
auto *lProject = context.
project() )
1637 return lProject->crs();
1657 const QVariant val = value;
1658 if ( val.userType() == qMetaTypeId< QgsGeometry>() )
1663 if ( val.userType() == qMetaTypeId<QgsPointXY>() )
1668 if ( val.userType() == qMetaTypeId<QgsRectangle>() )
1673 if ( val.userType() == qMetaTypeId<QgsReferencedPointXY>() )
1691 if ( val.userType() == qMetaTypeId<QgsReferencedRectangle>() )
1697 g = g.densifyByCount( 20 );
1711 if ( val.userType() == qMetaTypeId<QgsReferencedGeometry>() )
1730 if ( valueAsString.isEmpty() )
1733 if ( valueAsString.isEmpty() )
1736 const thread_local QRegularExpression rx( u
"^\\s*(?:CRS=(.*);)?(.*?)$"_s );
1738 const QRegularExpressionMatch match = rx.match( valueAsString );
1739 if ( match.hasMatch() )
1766 const QVariant val = parameters.value( definition->
name() );
1772 if ( value.userType() == qMetaTypeId<QgsReferencedGeometry>() )
1781 if ( value.userType() == qMetaTypeId<QgsReferencedPointXY>() )
1790 if ( value.userType() == qMetaTypeId<QgsReferencedRectangle>() )
1800 const QRegularExpression rx( u
"^\\s*(?:CRS=(.*);)?(.*?)$"_s );
1803 const QRegularExpressionMatch match = rx.match( valueAsString );
1804 if ( match.hasMatch() )
1811 if (
auto *lProject = context.
project() )
1812 return lProject->crs();
1823 if ( fileText.isEmpty() )
1834 if ( fileText.isEmpty() )
1842 return QVariantList();
1850 return QVariantList();
1852 QString resultString;
1853 const QVariant val = value;
1854 if ( val.userType() == qMetaTypeId<QgsProperty>() )
1856 else if ( val.userType() == QMetaType::Type::QVariantList )
1857 return val.toList();
1859 resultString = val.toString();
1861 if ( resultString.isEmpty() )
1864 if ( definition->
defaultValue().userType() == QMetaType::Type::QVariantList )
1870 QVariantList result;
1871 const auto constSplit = resultString.split(
',' );
1874 for (
const QString &s : constSplit )
1876 number = s.toDouble( &ok );
1877 result << ( ok ? QVariant( number ) : s );
1888 return QList<QgsMapLayer *>();
1898 return QList<QgsMapLayer *>();
1900 const QVariant val = value;
1901 if (
QgsMapLayer *layer = qobject_cast< QgsMapLayer * >( qvariant_cast<QObject *>( val ) ) )
1903 return QList<QgsMapLayer *>() << layer;
1906 QList<QgsMapLayer *> layers;
1908 std::function< void(
const QVariant &var ) > processVariant;
1909 processVariant = [&layers, &context, &definition, flags, &processVariant](
const QVariant &var ) {
1910 if ( var.userType() == QMetaType::Type::QVariantList )
1912 const auto constToList = var.toList();
1913 for (
const QVariant &listVar : constToList )
1915 processVariant( listVar );
1918 else if ( var.userType() == QMetaType::Type::QStringList )
1920 const auto constToStringList = var.toStringList();
1921 for (
const QString &s : constToStringList )
1923 processVariant( s );
1926 else if ( var.userType() == qMetaTypeId<QgsProperty>() )
1928 else if ( var.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
1932 const QVariant sink = fromVar.
sink;
1933 if ( sink.userType() == qMetaTypeId<QgsProperty>() )
1938 else if (
QgsMapLayer *layer = qobject_cast< QgsMapLayer * >( qvariant_cast<QObject *>( var ) ) )
1950 processVariant( val );
1952 if ( layers.isEmpty() )
1955 if (
QgsMapLayer *layer = qobject_cast< QgsMapLayer * >( qvariant_cast<QObject *>( definition->
defaultValue() ) ) )
1959 else if ( definition->
defaultValue().userType() == QMetaType::Type::QVariantList )
1961 const auto constToList = definition->
defaultValue().toList();
1962 for (
const QVariant &var : constToList )
1964 if (
QgsMapLayer *layer = qobject_cast< QgsMapLayer * >( qvariant_cast<QObject *>( var ) ) )
1970 processVariant( var );
1984 return QStringList();
1986 const QVariant val = value;
1990 std::function< void(
const QVariant &var ) > processVariant;
1991 processVariant = [&files, &context, &definition, &processVariant](
const QVariant &var ) {
1992 if ( var.userType() == QMetaType::Type::QVariantList )
1994 const auto constToList = var.toList();
1995 for (
const QVariant &listVar : constToList )
1997 processVariant( listVar );
2000 else if ( var.userType() == QMetaType::Type::QStringList )
2002 const auto constToStringList = var.toStringList();
2003 for (
const QString &s : constToStringList )
2005 processVariant( s );
2008 else if ( var.userType() == qMetaTypeId<QgsProperty>() )
2012 files << var.toString();
2016 processVariant( val );
2018 if ( files.isEmpty() )
2029 return QStringList();
2037 return QList<double>();
2045 return QList<double>();
2047 QStringList resultStringList;
2048 const QVariant val = value;
2050 if ( val.userType() == qMetaTypeId<QgsProperty>() )
2052 else if ( val.userType() == QMetaType::Type::QVariantList )
2054 const auto constToList = val.toList();
2055 for (
const QVariant &var : constToList )
2056 resultStringList << var.toString();
2059 resultStringList << val.toString();
2061 if ( ( resultStringList.isEmpty() || ( resultStringList.size() == 1 && resultStringList.at( 0 ).isEmpty() ) ) )
2063 resultStringList.clear();
2065 if ( definition->
defaultValue().userType() == QMetaType::Type::QVariantList )
2067 const auto constToList = definition->
defaultValue().toList();
2068 for (
const QVariant &var : constToList )
2069 resultStringList << var.toString();
2072 resultStringList << definition->
defaultValue().toString();
2075 if ( resultStringList.size() == 1 )
2077 resultStringList = resultStringList.at( 0 ).split(
',' );
2080 if ( resultStringList.size() < 2 )
2081 return QList< double >() << std::numeric_limits<double>::quiet_NaN() << std::numeric_limits<double>::quiet_NaN();
2083 QList< double > result;
2085 double n = resultStringList.at( 0 ).toDouble( &ok );
2089 result << std::numeric_limits<double>::quiet_NaN();
2091 n = resultStringList.at( 1 ).toDouble( &ok );
2095 result << std::numeric_limits<double>::quiet_NaN();
2103 return QStringList();
2116 return QStringList();
2124 return QStringList();
2126 QStringList resultStringList;
2127 const QVariant val = value;
2128 if ( val.isValid() )
2130 if ( val.userType() == qMetaTypeId<QgsProperty>() )
2132 else if ( val.userType() == QMetaType::Type::QVariantList )
2134 const auto constToList = val.toList();
2135 for (
const QVariant &var : constToList )
2136 resultStringList << var.toString();
2138 else if ( val.userType() == QMetaType::Type::QStringList )
2140 resultStringList = val.toStringList();
2143 resultStringList.append( val.toString().split(
';' ) );
2146 if ( ( resultStringList.isEmpty() || resultStringList.at( 0 ).isEmpty() ) )
2148 resultStringList.clear();
2152 if ( definition->
defaultValue().userType() == QMetaType::Type::QVariantList )
2154 const auto constToList = definition->
defaultValue().toList();
2155 for (
const QVariant &var : constToList )
2156 resultStringList << var.toString();
2158 else if ( definition->
defaultValue().userType() == QMetaType::Type::QStringList )
2160 resultStringList = definition->
defaultValue().toStringList();
2163 resultStringList.append( definition->
defaultValue().toString().split(
';' ) );
2167 return resultStringList;
2181 if ( layoutName.isEmpty() )
2233 QVariant val = value;
2234 if ( val.userType() == qMetaTypeId<QgsProperty>() )
2238 if ( val.userType() == QMetaType::Type::QColor )
2240 QColor
c = val.value< QColor >();
2242 if ( !colorParam->opacityEnabled() )
2250 if ( definition->
defaultValue().userType() == QMetaType::Type::QColor )
2256 if ( colorText.isEmpty() )
2259 bool containsAlpha =
false;
2262 if (
c.isValid() && !colorParam->opacityEnabled() )
2338 const QString type = map.value( u
"parameter_type"_s ).toString();
2339 const QString name = map.value( u
"name"_s ).toString();
2340 std::unique_ptr< QgsProcessingParameterDefinition > def;
2346 def = std::make_unique<QgsProcessingParameterBoolean>( name );
2348 def = std::make_unique<QgsProcessingParameterCrs>( name );
2350 def = std::make_unique<QgsProcessingParameterMapLayer>( name );
2352 def = std::make_unique<QgsProcessingParameterExtent>( name );
2354 def = std::make_unique<QgsProcessingParameterPoint>( name );
2356 def = std::make_unique<QgsProcessingParameterFile>( name );
2358 def = std::make_unique<QgsProcessingParameterMatrix>( name );
2360 def = std::make_unique<QgsProcessingParameterMultipleLayers>( name );
2362 def = std::make_unique<QgsProcessingParameterNumber>( name );
2364 def = std::make_unique<QgsProcessingParameterRange>( name );
2366 def = std::make_unique<QgsProcessingParameterRasterLayer>( name );
2368 def = std::make_unique<QgsProcessingParameterEnum>( name );
2370 def = std::make_unique<QgsProcessingParameterString>( name );
2372 def = std::make_unique<QgsProcessingParameterAuthConfig>( name );
2374 def = std::make_unique<QgsProcessingParameterExpression>( name );
2376 def = std::make_unique<QgsProcessingParameterVectorLayer>( name );
2378 def = std::make_unique<QgsProcessingParameterField>( name );
2380 def = std::make_unique<QgsProcessingParameterFeatureSource>( name );
2382 def = std::make_unique<QgsProcessingParameterFeatureSink>( name );
2384 def = std::make_unique<QgsProcessingParameterVectorDestination>( name );
2386 def = std::make_unique<QgsProcessingParameterRasterDestination>( name );
2388 def = std::make_unique<QgsProcessingParameterPointCloudDestination>( name );
2390 def = std::make_unique<QgsProcessingParameterFileDestination>( name );
2392 def = std::make_unique<QgsProcessingParameterFolderDestination>( name );
2394 def = std::make_unique<QgsProcessingParameterBand>( name );
2396 def = std::make_unique<QgsProcessingParameterMeshLayer>( name );
2398 def = std::make_unique<QgsProcessingParameterLayout>( name );
2400 def = std::make_unique<QgsProcessingParameterLayoutItem>( name );
2402 def = std::make_unique<QgsProcessingParameterColor>( name );
2404 def = std::make_unique<QgsProcessingParameterCoordinateOperation>( name );
2406 def = std::make_unique<QgsProcessingParameterPointCloudLayer>( name );
2408 def = std::make_unique<QgsProcessingParameterAnnotationLayer>( name );
2410 def = std::make_unique<QgsProcessingParameterPointCloudAttribute>( name );
2412 def = std::make_unique<QgsProcessingParameterVectorTileDestination>( name );
2417 def.reset( paramType->
create( name ) );
2423 def->fromVariantMap( map );
2424 return def.release();
2429 QString desc = name;
2430 desc.replace(
'_',
' ' );
2436 bool isOptional =
false;
2440 if ( !parseScriptCodeParameterOptions( code, isOptional, name, type, definition ) )
2445 if ( type ==
"boolean"_L1 )
2447 else if ( type ==
"crs"_L1 )
2449 else if ( type ==
"layer"_L1 )
2451 else if ( type ==
"extent"_L1 )
2453 else if ( type ==
"point"_L1 )
2455 else if ( type ==
"geometry"_L1 )
2457 else if ( type ==
"file"_L1 )
2459 else if ( type ==
"folder"_L1 )
2461 else if ( type ==
"matrix"_L1 )
2463 else if ( type ==
"multiple"_L1 )
2465 else if ( type ==
"number"_L1 )
2467 else if ( type ==
"distance"_L1 )
2469 else if ( type ==
"area"_L1 )
2471 else if ( type ==
"volume"_L1 )
2473 else if ( type ==
"duration"_L1 )
2475 else if ( type ==
"scale"_L1 )
2477 else if ( type ==
"range"_L1 )
2479 else if ( type ==
"raster"_L1 )
2481 else if ( type ==
"enum"_L1 )
2483 else if ( type ==
"string"_L1 )
2485 else if ( type ==
"authcfg"_L1 )
2487 else if ( type ==
"expression"_L1 )
2489 else if ( type ==
"field"_L1 )
2491 else if ( type ==
"vector"_L1 )
2493 else if ( type ==
"source"_L1 )
2495 else if ( type ==
"sink"_L1 )
2497 else if ( type ==
"vectordestination"_L1 )
2499 else if ( type ==
"rasterdestination"_L1 )
2501 else if ( type ==
"pointclouddestination"_L1 )
2503 else if ( type ==
"filedestination"_L1 )
2505 else if ( type ==
"folderdestination"_L1 )
2507 else if ( type ==
"band"_L1 )
2509 else if ( type ==
"mesh"_L1 )
2511 else if ( type ==
"layout"_L1 )
2513 else if ( type ==
"layoutitem"_L1 )
2515 else if ( type ==
"color"_L1 )
2517 else if ( type ==
"coordinateoperation"_L1 )
2519 else if ( type ==
"maptheme"_L1 )
2521 else if ( type ==
"datetime"_L1 )
2523 else if ( type ==
"providerconnection"_L1 )
2525 else if ( type ==
"databaseschema"_L1 )
2527 else if ( type ==
"databasetable"_L1 )
2529 else if ( type ==
"pointcloud"_L1 )
2531 else if ( type ==
"annotation"_L1 )
2533 else if ( type ==
"attribute"_L1 )
2535 else if ( type ==
"vectortiledestination"_L1 )
2541bool QgsProcessingParameters::parseScriptCodeParameterOptions(
const QString &code,
bool &isOptional, QString &name, QString &type, QString &definition )
2543 const thread_local QRegularExpression re( u
"(?:#*)(.*?)=\\s*(.*)"_s );
2544 QRegularExpressionMatch m = re.match( code );
2545 if ( !m.hasMatch() )
2548 name = m.captured( 1 );
2549 QString tokens = m.captured( 2 );
2550 if ( tokens.startsWith(
"optional"_L1, Qt::CaseInsensitive ) )
2553 tokens.remove( 0, 8 );
2560 tokens = tokens.trimmed();
2562 const thread_local QRegularExpression re2( u
"(.*?)\\s+(.*)"_s );
2563 m = re2.match( tokens );
2564 if ( !m.hasMatch() )
2566 type = tokens.toLower().trimmed();
2571 type = m.captured( 1 ).toLower().trimmed();
2572 definition = m.captured( 2 );
2586 ,
mFlags( optional ?
Qgis::ProcessingParameterFlag::Optional :
Qgis::ProcessingParameterFlag() )
2592 if ( defaultSettingsValue.isValid() )
2594 return defaultSettingsValue;
2602 if ( defaultSettingsValue.isValid() )
2604 return defaultSettingsValue;
2614 if ( settingValue.isValid() )
2616 return settingValue;
2624 if ( !input.isValid() && !
mDefault.isValid() )
2627 if ( ( input.userType() == QMetaType::Type::QString && input.toString().isEmpty() ) || ( !input.isValid() &&
mDefault.userType() == QMetaType::Type::QString &&
mDefault.toString().isEmpty() ) )
2635 if ( !value.isValid() )
2638 if ( value.userType() == qMetaTypeId<QgsProperty>() )
2651 if ( !value.isValid() )
2655 if ( value.userType() == QMetaType::Type::QVariantMap )
2657 const QVariantMap sourceMap = value.toMap();
2658 QVariantMap resultMap;
2659 for (
auto it = sourceMap.constBegin(); it != sourceMap.constEnd(); it++ )
2665 else if ( value.userType() == QMetaType::Type::QVariantList || value.userType() == QMetaType::Type::QStringList )
2667 const QVariantList sourceList = value.toList();
2668 QVariantList resultList;
2669 resultList.reserve( sourceList.size() );
2670 for (
const QVariant &v : sourceList )
2678 switch ( value.userType() )
2681 case QMetaType::Bool:
2682 case QMetaType::Char:
2683 case QMetaType::Int:
2684 case QMetaType::Double:
2685 case QMetaType::Float:
2686 case QMetaType::LongLong:
2687 case QMetaType::ULongLong:
2688 case QMetaType::UInt:
2689 case QMetaType::ULong:
2690 case QMetaType::UShort:
2697 if ( value.userType() == qMetaTypeId<QgsProperty>() )
2707 return QVariantMap( { { u
"type"_s, u
"data_defined"_s }, { u
"field"_s, prop.
field() } } );
2709 return QVariantMap( { { u
"type"_s, u
"data_defined"_s }, { u
"expression"_s, prop.
expressionString() } } );
2714 if ( value.userType() == qMetaTypeId<QgsCoordinateReferenceSystem>() )
2719 else if ( !crs.
authid().isEmpty() )
2724 else if ( value.userType() == qMetaTypeId<QgsRectangle>() )
2729 else if ( value.userType() == qMetaTypeId<QgsReferencedRectangle>() )
2734 else if ( value.userType() == qMetaTypeId< QgsGeometry>() )
2746 else if ( value.userType() == qMetaTypeId<QgsReferencedGeometry>() )
2761 else if ( value.userType() == qMetaTypeId<QgsPointXY>() )
2766 else if ( value.userType() == qMetaTypeId<QgsReferencedPointXY>() )
2771 else if ( value.userType() == qMetaTypeId<QgsProcessingFeatureSourceDefinition>() )
2778 else if ( value.userType() == qMetaTypeId<QgsProcessingRasterLayerDefinition>() )
2785 else if ( value.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
2790 else if ( value.userType() == qMetaTypeId<QColor>() )
2792 const QColor fromVar = value.value< QColor >();
2793 if ( !fromVar.isValid() )
2796 return u
"rgba( %1, %2, %3, %4 )"_s.arg( fromVar.red() ).arg( fromVar.green() ).arg( fromVar.blue() ).arg( QString::number( fromVar.alphaF(),
'f', 2 ) );
2798 else if ( value.userType() == qMetaTypeId<QDateTime>() )
2800 const QDateTime fromVar = value.toDateTime();
2801 if ( !fromVar.isValid() )
2804 return fromVar.toString( Qt::ISODate );
2806 else if ( value.userType() == qMetaTypeId<QDate>() )
2808 const QDate fromVar = value.toDate();
2809 if ( !fromVar.isValid() )
2812 return fromVar.toString( Qt::ISODate );
2814 else if ( value.userType() == qMetaTypeId<QTime>() )
2816 const QTime fromVar = value.toTime();
2817 if ( !fromVar.isValid() )
2820 return fromVar.toString( Qt::ISODate );
2827 p.insert(
name(), value );
2835 if ( value.userType() == QMetaType::QString )
2840 Q_ASSERT_X(
false,
"QgsProcessingParameterDefinition::valueAsJsonObject", u
"unsupported variant type %1"_s.arg( QMetaType::typeName( value.userType() ) ).toLocal8Bit() );
2853 if ( !value.isValid() )
2856 switch ( value.userType() )
2859 case QMetaType::Bool:
2860 case QMetaType::Char:
2861 case QMetaType::Int:
2862 case QMetaType::Double:
2863 case QMetaType::Float:
2864 case QMetaType::LongLong:
2865 case QMetaType::ULongLong:
2866 case QMetaType::UInt:
2867 case QMetaType::ULong:
2868 case QMetaType::UShort:
2869 return value.toString();
2875 if ( value.userType() == qMetaTypeId<QgsProperty>() )
2885 return u
"field:%1"_s.arg( prop.
field() );
2892 if ( value.userType() == qMetaTypeId<QgsCoordinateReferenceSystem>() )
2897 else if ( !crs.
authid().isEmpty() )
2902 else if ( value.userType() == qMetaTypeId<QgsRectangle>() )
2907 else if ( value.userType() == qMetaTypeId<QgsReferencedRectangle>() )
2912 else if ( value.userType() == qMetaTypeId< QgsGeometry>() )
2924 else if ( value.userType() == qMetaTypeId<QgsReferencedGeometry>() )
2939 else if ( value.userType() == qMetaTypeId<QgsPointXY>() )
2944 else if ( value.userType() == qMetaTypeId<QgsReferencedPointXY>() )
2949 else if ( value.userType() == qMetaTypeId<QgsProcessingFeatureSourceDefinition>() )
2954 else if ( value.userType() == qMetaTypeId<QgsProcessingRasterLayerDefinition>() )
2959 else if ( value.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
2964 else if ( value.userType() == qMetaTypeId<QColor>() )
2966 const QColor fromVar = value.value< QColor >();
2967 if ( !fromVar.isValid() )
2970 return u
"rgba( %1, %2, %3, %4 )"_s.arg( fromVar.red() ).arg( fromVar.green() ).arg( fromVar.blue() ).arg( QString::number( fromVar.alphaF(),
'f', 2 ) );
2972 else if ( value.userType() == qMetaTypeId<QDateTime>() )
2974 const QDateTime fromVar = value.toDateTime();
2975 if ( !fromVar.isValid() )
2978 return fromVar.toString( Qt::ISODate );
2980 else if ( value.userType() == qMetaTypeId<QDate>() )
2982 const QDate fromVar = value.toDate();
2983 if ( !fromVar.isValid() )
2986 return fromVar.toString( Qt::ISODate );
2988 else if ( value.userType() == qMetaTypeId<QTime>() )
2990 const QTime fromVar = value.toTime();
2991 if ( !fromVar.isValid() )
2994 return fromVar.toString( Qt::ISODate );
3001 p.insert(
name(), value );
3009 if ( value.userType() == QMetaType::QString )
3010 return value.toString();
3013 QgsDebugError( u
"unsupported variant type %1"_s.arg( QMetaType::typeName( value.userType() ) ) );
3015 return value.toString();
3021 if ( !value.isValid() )
3022 return QStringList();
3024 if ( value.userType() == QMetaType::Type::QVariantList || value.userType() == QMetaType::Type::QStringList )
3026 const QVariantList sourceList = value.toList();
3027 QStringList resultList;
3028 resultList.reserve( sourceList.size() );
3029 for (
const QVariant &v : sourceList )
3038 return QStringList();
3050 QString code = u
"##%1="_s.arg(
mName );
3052 code +=
"optional "_L1;
3053 code +=
type() +
' ';
3055 return code.trimmed();
3063 switch ( outputType )
3069 code +=
", optional=True"_L1;
3085 map.insert( u
"parameter_type"_s,
type() );
3086 map.insert( u
"name"_s,
mName );
3088 map.insert( u
"help"_s,
mHelp );
3089 map.insert( u
"default"_s,
mDefault );
3091 map.insert( u
"flags"_s,
static_cast< int >(
mFlags ) );
3098 mName = map.value( u
"name"_s ).toString();
3099 mDescription = map.value( u
"description"_s ).toString();
3100 mHelp = map.value( u
"help"_s ).toString();
3101 mDefault = map.value( u
"default"_s );
3104 mMetadata = map.value( u
"metadata"_s ).toMap();
3120 QString text = u
"<p><b>%1</b></p>"_s.arg(
description() );
3121 if ( !
help().isEmpty() )
3123 text += u
"<p>%1</p>"_s.arg(
help() );
3125 text += u
"<p>%1</p>"_s.arg( QObject::tr(
"Python identifier: ‘%1’" ).arg( u
"<i>%1</i>"_s.arg(
name() ) ) );
3154 if ( value.userType() == qMetaTypeId<QgsPointXY>() )
3160 else if ( value.userType() == qMetaTypeId<QgsReferencedPointXY>() )
3166 else if ( value.userType() == qMetaTypeId<QgsRectangle>() )
3172 else if ( value.userType() == qMetaTypeId<QgsReferencedRectangle>() )
3182 else if ( value.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
3195 return value.toString();
3201 if ( !val.isValid() )
3204 if ( val.userType() == qMetaTypeId<QgsProperty>() )
3206 return val.toBool() ? u
"True"_s : u
"False"_s;
3211 QString code = u
"##%1="_s.arg(
mName );
3213 code +=
"optional "_L1;
3214 code +=
type() +
' ';
3215 code +=
mDefault.toBool() ? u
"true"_s : u
"false"_s;
3216 return code.trimmed();
3236 if ( !input.isValid() )
3244 if ( input.userType() == qMetaTypeId<QgsCoordinateReferenceSystem>() )
3248 else if ( input.userType() == qMetaTypeId<QgsProcessingFeatureSourceDefinition>() )
3252 else if ( input.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
3257 if ( input.userType() == qMetaTypeId<QgsProperty>() )
3262 if ( input.type() == QVariant::String )
3264 const QString
string = input.toString();
3265 if (
string.compare(
"ProjectCrs"_L1, Qt::CaseInsensitive ) == 0 )
3274 if ( qobject_cast< QgsMapLayer * >( qvariant_cast<QObject *>( input ) ) )
3277 if ( input.userType() != QMetaType::Type::QString || input.toString().isEmpty() )
3285 if ( !value.isValid() )
3288 if ( value.userType() == qMetaTypeId<QgsCoordinateReferenceSystem>() )
3291 return u
"QgsCoordinateReferenceSystem()"_s;
3296 if ( value.userType() == qMetaTypeId<QgsProperty>() )
3299 if ( value.type() == QVariant::String )
3301 const QString
string = value.toString();
3302 if (
string.compare(
"ProjectCrs"_L1, Qt::CaseInsensitive ) == 0 )
3311 p.insert(
name(), value );
3321 if ( value.type() == QVariant::String )
3323 const QString
string = value.toString();
3324 if (
string.compare(
"ProjectCrs"_L1, Qt::CaseInsensitive ) == 0 )
3337 if ( value.type() == QVariant::String )
3339 const QString
string = value.toString();
3340 if (
string.compare(
"ProjectCrs"_L1, Qt::CaseInsensitive ) == 0 )
3366 return QObject::tr(
"Invalid CRS" );
3384 if ( !input.isValid() )
3392 if ( input.userType() == qMetaTypeId<QgsProperty>() )
3397 if ( qobject_cast< QgsMapLayer * >( qvariant_cast<QObject *>( input ) ) )
3402 if ( input.userType() != QMetaType::Type::QString || input.toString().isEmpty() )
3420 if ( !val.isValid() )
3423 if ( val.userType() == qMetaTypeId<QgsProperty>() )
3427 p.insert(
name(), val );
3446 for (
const QString &raster : rasters )
3448 if ( !vectors.contains( raster ) )
3452 for (
const QString &mesh : meshFilters )
3454 if ( !vectors.contains( mesh ) )
3458 for (
const QString &pointCloud : pointCloudFilters )
3460 if ( !vectors.contains( pointCloud ) )
3461 vectors << pointCloud;
3463 vectors.removeAll( QObject::tr(
"All files (*.*)" ) );
3464 std::sort( vectors.begin(), vectors.end() );
3466 return QObject::tr(
"All files (*.*)" ) + u
";;"_s + vectors.join(
";;"_L1 );
3476 QString code = u
"##%1="_s.arg(
mName );
3478 code +=
"optional "_L1;
3479 code +=
"layer "_L1;
3486 code +=
"table "_L1;
3490 code +=
"hasgeometry "_L1;
3494 code +=
"point "_L1;
3502 code +=
"polygon "_L1;
3506 code +=
"raster "_L1;
3514 code +=
"plugin "_L1;
3518 code +=
"pointcloud "_L1;
3522 code +=
"annotation "_L1;
3526 code +=
"vectortile "_L1;
3530 code +=
"tiledscene "_L1;
3539 return code.trimmed();
3545 QString def = definition;
3548 if ( def.startsWith(
"table"_L1, Qt::CaseInsensitive ) )
3554 if ( def.startsWith(
"hasgeometry"_L1, Qt::CaseInsensitive ) )
3557 def = def.mid( 12 );
3560 else if ( def.startsWith(
"point"_L1, Qt::CaseInsensitive ) )
3566 else if ( def.startsWith(
"line"_L1, Qt::CaseInsensitive ) )
3572 else if ( def.startsWith(
"polygon"_L1, Qt::CaseInsensitive ) )
3578 else if ( def.startsWith(
"raster"_L1, Qt::CaseInsensitive ) )
3584 else if ( def.startsWith(
"mesh"_L1, Qt::CaseInsensitive ) )
3590 else if ( def.startsWith(
"plugin"_L1, Qt::CaseInsensitive ) )
3596 else if ( def.startsWith(
"pointcloud"_L1, Qt::CaseInsensitive ) )
3599 def = def.mid( 11 );
3602 else if ( def.startsWith(
"annotation"_L1, Qt::CaseInsensitive ) )
3605 def = def.mid( 11 );
3608 else if ( def.startsWith(
"vectortile"_L1, Qt::CaseInsensitive ) )
3611 def = def.mid( 11 );
3614 else if ( def.startsWith(
"tiledscene"_L1, Qt::CaseInsensitive ) )
3617 def = def.mid( 11 );
3628 switch ( outputType )
3634 code +=
", optional=True"_L1;
3641 QStringList options;
3645 code += u
", types=[%1])"_s.arg( options.join(
',' ) );
3666 map.insert( u
"data_types"_s, types );
3674 const QVariantList values = map.value( u
"data_types"_s ).toList();
3675 for (
const QVariant &val : values )
3694 if ( !input.isValid() )
3702 if ( input.userType() == qMetaTypeId<QgsProcessingFeatureSourceDefinition>() )
3706 else if ( input.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
3711 if ( input.userType() == qMetaTypeId<QgsProperty>() )
3716 if ( input.userType() == qMetaTypeId<QgsRectangle>() )
3721 if ( input.userType() == qMetaTypeId< QgsGeometry>() )
3725 if ( input.userType() == qMetaTypeId<QgsReferencedRectangle>() )
3732 if ( qobject_cast< QgsMapLayer * >( qvariant_cast<QObject *>( input ) ) )
3735 if ( input.userType() != QMetaType::Type::QString || input.toString().isEmpty() )
3738 if ( variantIsValidStringForExtent( input ) )
3751bool QgsProcessingParameterExtent::variantIsValidStringForExtent(
const QVariant &value )
3753 if ( value.userType() == QMetaType::Type::QString )
3755 const thread_local QRegularExpression rx( u
"^(.*?)\\s*,\\s*(.*?)\\s*,\\s*(.*?)\\s*,\\s*(.*?)\\s*(?:\\[(.*)\\])?\\s*$"_s );
3756 const QRegularExpressionMatch match = rx.match( value.toString() );
3757 if ( match.hasMatch() )
3759 bool xMinOk =
false;
3760 ( void ) match.captured( 1 ).toDouble( &xMinOk );
3761 bool xMaxOk =
false;
3762 ( void ) match.captured( 2 ).toDouble( &xMaxOk );
3763 bool yMinOk =
false;
3764 ( void ) match.captured( 3 ).toDouble( &yMinOk );
3765 bool yMaxOk =
false;
3766 ( void ) match.captured( 4 ).toDouble( &yMaxOk );
3767 if ( xMinOk && xMaxOk && yMinOk && yMaxOk )
3776 if ( !value.isValid() )
3779 if ( value.userType() == qMetaTypeId<QgsProperty>() )
3782 if ( value.userType() == qMetaTypeId<QgsRectangle>() )
3787 else if ( value.userType() == qMetaTypeId<QgsReferencedRectangle>() )
3792 else if ( value.userType() == qMetaTypeId< QgsGeometry>() )
3797 const QString wkt = g.
asWkt();
3798 return u
"QgsGeometry.fromWkt('%1')"_s.arg( wkt );
3801 else if ( variantIsValidStringForExtent( value ) )
3807 p.insert(
name(), value );
3817 if ( variantIsValidStringForExtent( value ) )
3819 return value.toString();
3827 if ( variantIsValidStringForExtent( value ) )
3852 if ( !input.isValid() )
3860 if ( input.userType() == qMetaTypeId<QgsProperty>() )
3865 if ( input.userType() == qMetaTypeId<QgsPointXY>() )
3869 if ( input.userType() == qMetaTypeId<QgsReferencedPointXY>() )
3873 if ( input.userType() == qMetaTypeId< QgsGeometry>() )
3878 if ( input.userType() == QMetaType::Type::QString )
3880 if ( input.toString().isEmpty() )
3884 const thread_local QRegularExpression rx( u
"^\\s*\\(?\\s*(.*?)\\s*,\\s*(.*?)\\s*(?:\\[(.*)\\])?\\s*\\)?\\s*$"_s );
3886 const QRegularExpressionMatch match = rx.match( input.toString() );
3887 if ( match.hasMatch() )
3890 ( void ) match.captured( 1 ).toDouble( &xOk );
3892 ( void ) match.captured( 2 ).toDouble( &yOk );
3901 if ( !value.isValid() )
3904 if ( value.userType() == qMetaTypeId<QgsProperty>() )
3907 if ( value.userType() == qMetaTypeId<QgsPointXY>() )
3912 else if ( value.userType() == qMetaTypeId<QgsReferencedPointXY>() )
3917 else if ( value.userType() == qMetaTypeId< QgsGeometry>() )
3922 const QString wkt = g.
asWkt();
3923 return u
"QgsGeometry.fromWkt('%1')"_s.arg( wkt );
3952 if ( !input.isValid() )
3960 if ( input.userType() == qMetaTypeId<QgsProperty>() )
3967 if ( input.userType() == qMetaTypeId< QgsGeometry>() )
3972 if ( input.userType() == qMetaTypeId<QgsReferencedGeometry>() )
3977 if ( input.userType() == qMetaTypeId<QgsPointXY>() )
3982 if ( input.userType() == qMetaTypeId<QgsRectangle>() )
3987 if ( input.userType() == qMetaTypeId<QgsReferencedPointXY>() )
3992 if ( input.userType() == qMetaTypeId<QgsReferencedRectangle>() )
3997 if ( input.userType() == QMetaType::Type::QString )
3999 if ( input.toString().isEmpty() )
4004 const thread_local QRegularExpression rx( u
"^\\s*(?:CRS=(.*);)?(.*?)$"_s );
4006 const QRegularExpressionMatch match = rx.match( input.toString() );
4007 if ( match.hasMatch() )
4012 return ( anyTypeAllowed || mGeomTypes.contains(
static_cast< int >( g.
type() ) ) ) && ( mAllowMultipart || !g.
isMultipart() );
4025 if ( !crs.isValid() )
4031 if ( !value.isValid() )
4034 if ( value.userType() == qMetaTypeId<QgsProperty>() )
4037 if ( value.userType() == qMetaTypeId< QgsGeometry>() )
4044 if ( value.userType() == qMetaTypeId<QgsReferencedGeometry>() )
4051 if ( value.userType() == qMetaTypeId<QgsPointXY>() )
4058 if ( value.userType() == qMetaTypeId<QgsReferencedPointXY>() )
4065 if ( value.userType() == qMetaTypeId<QgsRectangle>() )
4072 if ( value.userType() == qMetaTypeId<QgsReferencedRectangle>() )
4084 QString code = u
"##%1="_s.arg(
mName );
4086 code +=
"optional "_L1;
4087 code +=
type() +
' ';
4089 for (
const int type : mGeomTypes )
4094 code +=
"point "_L1;
4102 code +=
"polygon "_L1;
4106 code +=
"unknown "_L1;
4112 return code.trimmed();
4117 switch ( outputType )
4123 code +=
", optional=True"_L1;
4125 if ( !mGeomTypes.empty() )
4131 return u
"PointGeometry"_s;
4134 return u
"LineGeometry"_s;
4137 return u
"PolygonGeometry"_s;
4140 return u
"UnknownGeometry"_s;
4143 return u
"NullGeometry"_s;
4148 QStringList options;
4149 options.reserve( mGeomTypes.size() );
4150 for (
const int type : mGeomTypes )
4154 code += u
", geometryTypes=[%1 ]"_s.arg( options.join(
',' ) );
4157 if ( !mAllowMultipart )
4159 code +=
", allowMultipart=False"_L1;
4174 for (
const int type : mGeomTypes )
4178 map.insert( u
"geometrytypes"_s, types );
4179 map.insert( u
"multipart"_s, mAllowMultipart );
4187 const QVariantList values = map.value( u
"geometrytypes"_s ).toList();
4188 for (
const QVariant &val : values )
4190 mGeomTypes << val.toInt();
4192 mAllowMultipart = map.value( u
"multipart"_s ).toBool();
4206 if ( value.isValid() )
4208 if ( value.userType() == qMetaTypeId< QgsGeometry>() )
4214 else if ( value.userType() == qMetaTypeId<QgsReferencedGeometry>() )
4224 else if ( value.userType() == QMetaType::QString )
4236 return QObject::tr(
"Invalid geometry" );
4256 if ( !input.isValid() )
4264 if ( input.userType() == qMetaTypeId<QgsProperty>() )
4269 const QString
string = input.toString().trimmed();
4271 if ( input.userType() != QMetaType::Type::QString ||
string.isEmpty() )
4274 switch ( mBehavior )
4278 if ( !mExtension.isEmpty() )
4280 return string.endsWith( mExtension, Qt::CaseInsensitive );
4282 else if ( !mFileFilter.isEmpty() )
4300 QString code = u
"##%1="_s.arg(
mName );
4302 code +=
"optional "_L1;
4305 return code.trimmed();
4310 switch ( outputType )
4316 code +=
", optional=True"_L1;
4318 if ( !mExtension.isEmpty() )
4319 code += u
", extension='%1'"_s.arg( mExtension );
4320 if ( !mFileFilter.isEmpty() )
4321 code += u
", fileFilter='%1'"_s.arg( mFileFilter );
4332 switch ( mBehavior )
4336 if ( !mFileFilter.isEmpty() )
4337 return mFileFilter != QObject::tr(
"All files (*.*)" ) ? mFileFilter + u
";;"_s + QObject::tr(
"All files (*.*)" ) : mFileFilter;
4338 else if ( !mExtension.isEmpty() )
4339 return QObject::tr(
"%1 files" ).arg( mExtension.toUpper() ) + u
" (*."_s + mExtension.toLower() + u
");;"_s + QObject::tr(
"All files (*.*)" );
4341 return QObject::tr(
"All files (*.*)" );
4353 mFileFilter.clear();
4363 mFileFilter = filter;
4370 map.insert( u
"behavior"_s,
static_cast< int >( mBehavior ) );
4371 map.insert( u
"extension"_s, mExtension );
4372 map.insert( u
"filefilter"_s, mFileFilter );
4380 mExtension = map.value( u
"extension"_s ).toString();
4381 mFileFilter = map.value( u
"filefilter"_s ).toString();
4398 , mFixedNumberRows( fixedNumberRows )
4409 if ( !input.isValid() )
4417 if ( input.userType() == QMetaType::Type::QString )
4419 if ( input.toString().isEmpty() )
4423 else if ( input.userType() == QMetaType::Type::QVariantList )
4425 if ( input.toList().isEmpty() )
4429 else if ( input.userType() == QMetaType::Type::Double || input.userType() == QMetaType::Type::Int )
4439 if ( !value.isValid() )
4442 if ( value.userType() == qMetaTypeId<QgsProperty>() )
4446 p.insert(
name(), value );
4454 switch ( outputType )
4460 code +=
", optional=True"_L1;
4461 code += u
", numberRows=%1"_s.arg( mNumberRows );
4462 code += u
", hasFixedNumberRows=%1"_s.arg( mFixedNumberRows ? u
"True"_s : u
"False"_s );
4465 headers.reserve( mHeaders.size() );
4466 for (
const QString &h : mHeaders )
4468 code += u
", headers=[%1]"_s.arg(
headers.join(
',' ) );
4500 return mFixedNumberRows;
4505 mFixedNumberRows = fixedNumberRows;
4511 map.insert( u
"headers"_s, mHeaders );
4512 map.insert( u
"rows"_s, mNumberRows );
4513 map.insert( u
"fixed_number_rows"_s, mFixedNumberRows );
4520 mHeaders = map.value( u
"headers"_s ).toStringList();
4521 mNumberRows = map.value( u
"rows"_s ).toInt();
4522 mFixedNumberRows = map.value( u
"fixed_number_rows"_s ).toBool();
4544 if ( !input.isValid() )
4554 if ( qobject_cast< QgsMapLayer * >( qvariant_cast<QObject *>( input ) ) )
4560 if ( input.userType() == QMetaType::Type::QString )
4562 if ( input.toString().isEmpty() )
4565 if ( mMinimumNumberInputs > 1 )
4576 else if ( input.userType() == QMetaType::Type::QVariantList )
4578 if ( input.toList().count() < mMinimumNumberInputs )
4581 if ( mMinimumNumberInputs > input.toList().count() )
4589 const auto constToList = input.toList();
4590 for (
const QVariant &v : constToList )
4592 if ( qobject_cast< QgsMapLayer * >( qvariant_cast<QObject *>( v ) ) )
4601 else if ( input.userType() == QMetaType::Type::QStringList )
4603 if ( input.toStringList().count() < mMinimumNumberInputs )
4606 if ( mMinimumNumberInputs > input.toStringList().count() )
4614 const auto constToStringList = input.toStringList();
4615 for (
const QString &v : constToStringList )
4628 if ( !value.isValid() )
4631 if ( value.userType() == qMetaTypeId<QgsProperty>() )
4637 if ( value.userType() == QMetaType::Type::QStringList )
4639 const QStringList list = value.toStringList();
4640 parts.reserve( list.count() );
4641 for (
const QString &v : list )
4644 else if ( value.userType() == QMetaType::Type::QVariantList )
4646 const QVariantList list = value.toList();
4647 parts.reserve( list.count() );
4648 for (
const QVariant &v : list )
4651 if ( !parts.isEmpty() )
4652 return parts.join(
',' ).prepend(
'[' ).append(
']' );
4657 p.insert(
name(), value );
4659 if ( !list.isEmpty() )
4662 parts.reserve( list.count() );
4667 return parts.join(
',' ).prepend(
'[' ).append(
']' );
4686 QString code = u
"##%1="_s.arg(
mName );
4688 code +=
"optional "_L1;
4689 switch ( mLayerType )
4692 code +=
"multiple raster"_L1;
4696 code +=
"multiple file"_L1;
4700 code +=
"multiple vector"_L1;
4704 if (
mDefault.userType() == QMetaType::Type::QVariantList )
4707 const auto constToList =
mDefault.toList();
4708 for (
const QVariant &var : constToList )
4710 parts << var.toString();
4712 code += parts.join(
',' );
4714 else if (
mDefault.userType() == QMetaType::Type::QStringList )
4716 code +=
mDefault.toStringList().join(
',' );
4722 return code.trimmed();
4727 switch ( outputType )
4733 code +=
", optional=True"_L1;
4737 code += u
", layerType=%1"_s.arg(
layerType );
4748 switch ( mLayerType )
4751 return QObject::tr(
"All files (*.*)" );
4791 return mMinimumNumberInputs;
4803 map.insert( u
"layer_type"_s,
static_cast< int >( mLayerType ) );
4804 map.insert( u
"min_inputs"_s, mMinimumNumberInputs );
4812 mMinimumNumberInputs = map.value( u
"min_inputs"_s ).toInt();
4818 QString
type = definition;
4820 const thread_local QRegularExpression re( u
"(.*?)\\s+(.*)"_s );
4821 const QRegularExpressionMatch m = re.match( definition );
4824 type = m.captured( 1 ).toLower().trimmed();
4825 defaultVal = m.captured( 2 );
4828 if (
type ==
"vector"_L1 )
4830 else if (
type ==
"raster"_L1 )
4832 else if (
type ==
"file"_L1 )
4847 QgsMessageLog::logMessage( QObject::tr(
"Invalid number parameter \"%1\": min value %2 is >= max value %3!" ).arg(
name ).arg( mMin ).arg( mMax ), QObject::tr(
"Processing" ) );
4858 QVariant input = value;
4859 if ( !input.isValid() )
4867 if ( input.userType() == qMetaTypeId<QgsProperty>() )
4873 const double res = input.toDouble( &ok );
4877 return !( res < mMin || res > mMax );
4882 if ( !value.isValid() )
4885 if ( value.userType() == qMetaTypeId<QgsProperty>() )
4888 return value.toString();
4895 if ( mMin > std::numeric_limits<double>::lowest() + 1 )
4896 parts << QObject::tr(
"Minimum value: %1" ).arg( mMin );
4897 if ( mMax < std::numeric_limits<double>::max() )
4898 parts << QObject::tr(
"Maximum value: %1" ).arg( mMax );
4901 const QString extra = parts.join(
"<br />"_L1 );
4902 if ( !extra.isEmpty() )
4903 text += u
"<p>%1</p>"_s.arg( extra );
4909 switch ( outputType )
4915 code +=
", optional=True"_L1;
4919 if ( mMin != std::numeric_limits<double>::lowest() + 1 )
4920 code += u
", minValue=%1"_s.arg( mMin );
4921 if ( mMax != std::numeric_limits<double>::max() )
4922 code += u
", maxValue=%1"_s.arg( mMax );
4964 map.insert( u
"min"_s, mMin );
4965 map.insert( u
"max"_s, mMax );
4966 map.insert( u
"data_type"_s,
static_cast< int >( mDataType ) );
4973 mMin = map.value( u
"min"_s ).toDouble();
4974 mMax = map.value( u
"max"_s ).toDouble();
4997 if ( !input.isValid() )
5005 if ( input.userType() == qMetaTypeId<QgsProperty>() )
5010 if ( input.userType() == QMetaType::Type::QString )
5012 const QStringList list = input.toString().split(
',' );
5013 if ( list.count() != 2 )
5016 list.at( 0 ).toDouble( &ok );
5018 list.at( 1 ).toDouble( &ok2 );
5023 else if ( input.userType() == QMetaType::Type::QVariantList )
5025 if ( input.toList().count() != 2 )
5029 input.toList().at( 0 ).toDouble( &ok );
5031 input.toList().at( 1 ).toDouble( &ok2 );
5042 if ( !value.isValid() )
5045 if ( value.userType() == qMetaTypeId<QgsProperty>() )
5049 p.insert(
name(), value );
5052 QStringList stringParts;
5053 const auto constParts = parts;
5054 for (
const double v : constParts )
5056 stringParts << QString::number( v );
5058 return stringParts.join(
',' ).prepend(
'[' ).append(
']' );
5063 switch ( outputType )
5069 code +=
", optional=True"_L1;
5094 map.insert( u
"data_type"_s,
static_cast< int >( mDataType ) );
5122 if ( !input.isValid() )
5130 if ( input.userType() == qMetaTypeId<QgsProcessingRasterLayerDefinition>() )
5136 if ( input.userType() == qMetaTypeId<QgsProperty>() )
5149 if ( qobject_cast< QgsRasterLayer * >( qvariant_cast<QObject *>( input ) ) )
5152 if ( input.userType() != QMetaType::Type::QString || input.toString().isEmpty() )
5170 if ( !val.isValid() )
5173 if ( val.userType() == qMetaTypeId<QgsProperty>() )
5176 if ( val.userType() == qMetaTypeId<QgsProcessingRasterLayerDefinition>() )
5185 layerString = layer->source();
5189 return u
"QgsProcessingRasterLayerDefinition(%1, referenceScale=%2, dpi=%3)"_s
5201 return u
"QgsProcessingRasterLayerDefinition(QgsProperty.fromExpression(%1), referenceScale=%2, dpi=%3)"_s
5212 p.insert(
name(), val );
5239 mCapabilities = capabilities;
5244 return mCapabilities;
5263 QVariant input = value;
5264 if ( !input.isValid() )
5272 if ( input.userType() == qMetaTypeId<QgsProperty>() )
5277 if ( mUsesStaticStrings )
5279 if ( input.userType() == QMetaType::Type::QVariantList )
5281 if ( !mAllowMultiple )
5284 const QVariantList values = input.toList();
5288 for (
const QVariant &val : values )
5290 if ( !mOptions.contains( val.toString() ) )
5296 else if ( input.userType() == QMetaType::Type::QStringList )
5298 if ( !mAllowMultiple )
5301 const QStringList values = input.toStringList();
5306 if ( values.count() > 1 && !mAllowMultiple )
5309 for (
const QString &val : values )
5311 if ( !mOptions.contains( val ) )
5316 else if ( input.userType() == QMetaType::Type::QString )
5318 const QStringList parts = input.toString().split(
',' );
5319 if ( parts.count() > 1 && !mAllowMultiple )
5322 const auto constParts = parts;
5323 for (
const QString &part : constParts )
5325 if ( !mOptions.contains( part ) )
5333 if ( input.userType() == QMetaType::Type::QVariantList )
5335 if ( !mAllowMultiple )
5338 const QVariantList values = input.toList();
5342 for (
const QVariant &val : values )
5345 const int res = val.toInt( &ok );
5348 else if ( res < 0 || res >= mOptions.count() )
5354 else if ( input.userType() == QMetaType::Type::QString )
5356 const QStringList parts = input.toString().split(
',' );
5357 if ( parts.count() > 1 && !mAllowMultiple )
5360 const auto constParts = parts;
5361 for (
const QString &part : constParts )
5364 const int res = part.toInt( &ok );
5367 else if ( res < 0 || res >= mOptions.count() )
5372 else if ( input.userType() == QMetaType::Type::Int || input.userType() == QMetaType::Type::Double )
5375 const int res = input.toInt( &ok );
5378 else if ( res >= 0 && res < mOptions.count() )
5388 if ( !value.isValid() )
5391 if ( value.userType() == qMetaTypeId<QgsProperty>() )
5394 if ( mUsesStaticStrings )
5396 if ( value.userType() == QMetaType::Type::QVariantList || value.userType() == QMetaType::Type::QStringList )
5399 const QStringList constList = value.toStringList();
5400 for (
const QString &val : constList )
5404 return parts.join(
',' ).prepend(
'[' ).append(
']' );
5406 else if ( value.userType() == QMetaType::Type::QString )
5409 const QStringList constList = value.toString().split(
',' );
5410 if ( constList.count() > 1 )
5412 for (
const QString &val : constList )
5416 return parts.join(
',' ).prepend(
'[' ).append(
']' );
5424 if ( value.userType() == QMetaType::Type::QVariantList )
5427 const auto constToList = value.toList();
5428 for (
const QVariant &val : constToList )
5430 parts << QString::number( static_cast< int >( val.toDouble() ) );
5432 return parts.join(
',' ).prepend(
'[' ).append(
']' );
5434 else if ( value.userType() == QMetaType::Type::QString )
5436 const QStringList parts = value.toString().split(
',' );
5437 if ( parts.count() > 1 )
5439 return parts.join(
',' ).prepend(
'[' ).append(
']' );
5443 return QString::number(
static_cast< int >( value.toDouble() ) );
5449 if ( !value.isValid() )
5452 if ( value.userType() == qMetaTypeId<QgsProperty>() )
5455 if ( mUsesStaticStrings )
5461 if ( value.userType() == QMetaType::Type::QVariantList )
5464 const QVariantList toList = value.toList();
5465 parts.reserve( toList.size() );
5466 for (
const QVariant &val : toList )
5468 parts << mOptions.value(
static_cast< int >( val.toDouble() ) );
5470 return parts.join(
',' );
5472 else if ( value.userType() == QMetaType::Type::QString )
5474 const QStringList parts = value.toString().split(
',' );
5475 QStringList comments;
5476 if ( parts.count() > 1 )
5478 for (
const QString &part : parts )
5481 const int val = part.toInt( &ok );
5483 comments << mOptions.value( val );
5485 return comments.join(
',' );
5489 return mOptions.value(
static_cast< int >( value.toDouble() ) );
5495 QString code = u
"##%1="_s.arg(
mName );
5497 code +=
"optional "_L1;
5500 if ( mAllowMultiple )
5501 code +=
"multiple "_L1;
5503 if ( mUsesStaticStrings )
5504 code +=
"static "_L1;
5506 code += mOptions.join(
';' ) +
' ';
5509 return code.trimmed();
5514 switch ( outputType )
5520 code +=
", optional=True"_L1;
5523 options.reserve( mOptions.size() );
5524 for (
const QString &o : mOptions )
5526 code += u
", options=[%1]"_s.arg(
options.join(
',' ) );
5528 code += u
", allowMultiple=%1"_s.arg( mAllowMultiple ? u
"True"_s : u
"False"_s );
5530 code += u
", usesStaticStrings=%1"_s.arg( mUsesStaticStrings ? u
"True"_s : u
"False"_s );
5546 return options().value( value.toInt() );
5561 return mAllowMultiple;
5571 return mUsesStaticStrings;
5582 map.insert( u
"options"_s, mOptions );
5583 map.insert( u
"allow_multiple"_s, mAllowMultiple );
5584 map.insert( u
"uses_static_strings"_s, mUsesStaticStrings );
5591 mOptions = map.value( u
"options"_s ).toStringList();
5592 mAllowMultiple = map.value( u
"allow_multiple"_s ).toBool();
5593 mUsesStaticStrings = map.value( u
"uses_static_strings"_s ).toBool();
5600 QString def = definition;
5602 bool multiple =
false;
5603 if ( def.startsWith(
"multiple"_L1, Qt::CaseInsensitive ) )
5609 bool staticStrings =
false;
5610 if ( def.startsWith(
"static"_L1, Qt::CaseInsensitive ) )
5612 staticStrings =
true;
5616 const thread_local QRegularExpression re( u
"(.*)\\s+(.*?)$"_s );
5617 const QRegularExpressionMatch m = re.match( def );
5618 QString values = def;
5621 values = m.captured( 1 ).trimmed();
5622 defaultVal = m.captured( 2 );
5643 if ( value.userType() == qMetaTypeId<QgsProperty>() )
5646 const QString s = value.toString();
5652 QString code = u
"##%1="_s.arg(
mName );
5654 code +=
"optional "_L1;
5655 code +=
"string "_L1;
5661 return code.trimmed();
5666 switch ( outputType )
5672 code +=
", optional=True"_L1;
5673 code += u
", multiLine=%1"_s.arg( mMultiLine ? u
"True"_s : u
"False"_s );
5696 map.insert( u
"multiline"_s, mMultiLine );
5703 mMultiLine = map.value( u
"multiline"_s ).toBool();
5709 QString def = definition;
5711 if ( def.startsWith(
"long"_L1, Qt::CaseInsensitive ) )
5717 if ( def.startsWith(
'"' ) || def.startsWith(
'\'' ) )
5719 if ( def.endsWith(
'"' ) || def.endsWith(
'\'' ) )
5723 if ( def ==
"None"_L1 )
5744 if ( !value.isValid() )
5747 const QString s = value.toString();
5753 QString code = u
"##%1="_s.arg(
mName );
5755 code +=
"optional "_L1;
5756 code +=
"authcfg "_L1;
5759 return code.trimmed();
5764 QString def = definition;
5766 if ( def.startsWith(
'"' ) || def.startsWith(
'\'' ) )
5768 if ( def.endsWith(
'"' ) || def.endsWith(
'\'' ) )
5772 if ( def ==
"None"_L1 )
5788 , mExpressionType(
type )
5798 if ( !value.isValid() )
5801 if ( value.userType() == qMetaTypeId<QgsProperty>() )
5804 const QString s = value.toString();
5810 QStringList depends;
5811 if ( !mParentLayerParameterName.isEmpty() )
5812 depends << mParentLayerParameterName;
5818 switch ( outputType )
5824 code +=
", optional=True"_L1;
5826 code += u
", parentLayerParameterName='%1'"_s.arg( mParentLayerParameterName );
5832 switch ( mExpressionType )
5835 code +=
", type=Qgis.ExpressionType.PointCloud)"_L1;
5838 code +=
", type=Qgis.ExpressionType.RasterCalculator)"_L1;
5852 return mParentLayerParameterName;
5862 return mExpressionType;
5873 map.insert( u
"parent_layer"_s, mParentLayerParameterName );
5874 map.insert( u
"expression_type"_s,
static_cast< int >( mExpressionType ) );
5881 mParentLayerParameterName = map.value( u
"parent_layer"_s ).toString();
5882 mExpressionType =
static_cast< Qgis::ExpressionType >( map.value( u
"expression_type"_s ).toInt() );
5905 if ( !var.isValid() )
5913 if ( var.userType() == qMetaTypeId<QgsProperty>() )
5926 if ( qobject_cast< QgsVectorLayer * >( qvariant_cast<QObject *>( var ) ) )
5929 if ( var.userType() != QMetaType::Type::QString || var.toString().isEmpty() )
5947 if ( !val.isValid() )
5950 if ( val.userType() == qMetaTypeId<QgsProperty>() )
5954 p.insert(
name(), val );
5971 switch ( outputType )
5977 code +=
", optional=True"_L1;
5981 QStringList options;
5984 code += u
", types=[%1]"_s.arg( options.join(
',' ) );
6018 map.insert( u
"data_types"_s, types );
6026 const QVariantList values = map.value( u
"data_types"_s ).toList();
6027 for (
const QVariant &val : values )
6052 if ( !var.isValid() )
6060 if ( var.userType() == qMetaTypeId<QgsProperty>() )
6073 if ( qobject_cast< QgsMeshLayer * >( qvariant_cast<QObject *>( var ) ) )
6076 if ( var.userType() != QMetaType::Type::QString || var.toString().isEmpty() )
6094 if ( !val.isValid() )
6097 if ( val.userType() == qMetaTypeId<QgsProperty>() )
6101 p.insert(
name(), val );
6127 const QString &
name,
6152 if ( !input.isValid() )
6160 if ( input.userType() == qMetaTypeId<QgsProperty>() )
6165 if ( input.userType() == QMetaType::Type::QVariantList || input.userType() == QMetaType::Type::QStringList )
6167 if ( !mAllowMultiple )
6173 else if ( input.userType() == QMetaType::Type::QString )
6175 if ( input.toString().isEmpty() )
6178 const QStringList parts = input.toString().split(
';' );
6179 if ( parts.count() > 1 && !mAllowMultiple )
6184 if ( input.toString().isEmpty() )
6192 if ( !value.isValid() )
6195 if ( value.userType() == qMetaTypeId<QgsProperty>() )
6198 if ( value.userType() == QMetaType::Type::QVariantList )
6201 const auto constToList = value.toList();
6202 for (
const QVariant &val : constToList )
6206 return parts.join(
',' ).prepend(
'[' ).append(
']' );
6208 else if ( value.userType() == QMetaType::Type::QStringList )
6211 const auto constToStringList = value.toStringList();
6212 for (
const QString &s : constToStringList )
6216 return parts.join(
',' ).prepend(
'[' ).append(
']' );
6224 QString code = u
"##%1="_s.arg(
mName );
6226 code +=
"optional "_L1;
6227 code +=
"field "_L1;
6229 switch ( mDataType )
6232 code +=
"numeric "_L1;
6236 code +=
"string "_L1;
6240 code +=
"datetime "_L1;
6244 code +=
"binary "_L1;
6248 code +=
"boolean "_L1;
6255 if ( mAllowMultiple )
6256 code +=
"multiple "_L1;
6258 if ( mDefaultToAllFields )
6259 code +=
"default_to_all_fields "_L1;
6261 code += mParentLayerParameterName +
' ';
6264 return code.trimmed();
6269 switch ( outputType )
6275 code +=
", optional=True"_L1;
6278 switch ( mDataType )
6281 dataType = u
"QgsProcessingParameterField.Any"_s;
6285 dataType = u
"QgsProcessingParameterField.Numeric"_s;
6289 dataType = u
"QgsProcessingParameterField.String"_s;
6293 dataType = u
"QgsProcessingParameterField.DateTime"_s;
6297 dataType = u
"QgsProcessingParameterField.Binary"_s;
6301 dataType = u
"QgsProcessingParameterField.Boolean"_s;
6304 code += u
", type=%1"_s.arg(
dataType );
6306 code += u
", parentLayerParameterName='%1'"_s.arg( mParentLayerParameterName );
6307 code += u
", allowMultiple=%1"_s.arg( mAllowMultiple ? u
"True"_s : u
"False"_s );
6311 if ( mDefaultToAllFields )
6312 code +=
", defaultToAllFields=True"_L1;
6324 QStringList depends;
6325 if ( !mParentLayerParameterName.isEmpty() )
6326 depends << mParentLayerParameterName;
6332 return mParentLayerParameterName;
6352 return mAllowMultiple;
6362 return mDefaultToAllFields;
6367 mDefaultToAllFields = enabled;
6373 map.insert( u
"parent_layer"_s, mParentLayerParameterName );
6374 map.insert( u
"data_type"_s,
static_cast< int >( mDataType ) );
6375 map.insert( u
"allow_multiple"_s, mAllowMultiple );
6376 map.insert( u
"default_to_all_fields"_s, mDefaultToAllFields );
6383 mParentLayerParameterName = map.value( u
"parent_layer"_s ).toString();
6385 mAllowMultiple = map.value( u
"allow_multiple"_s ).toBool();
6386 mDefaultToAllFields = map.value( u
"default_to_all_fields"_s ).toBool();
6396 QString def = definition;
6398 if ( def.startsWith(
"numeric "_L1, Qt::CaseInsensitive ) )
6403 else if ( def.startsWith(
"string "_L1, Qt::CaseInsensitive ) )
6408 else if ( def.startsWith(
"datetime "_L1, Qt::CaseInsensitive ) )
6413 else if ( def.startsWith(
"binary "_L1, Qt::CaseInsensitive ) )
6418 else if ( def.startsWith(
"boolean "_L1, Qt::CaseInsensitive ) )
6424 if ( def.startsWith(
"multiple"_L1, Qt::CaseInsensitive ) )
6427 def = def.mid( 8 ).trimmed();
6430 if ( def.startsWith(
"default_to_all_fields"_L1, Qt::CaseInsensitive ) )
6433 def = def.mid( 21 ).trimmed();
6436 const thread_local QRegularExpression re( u
"(.*?)\\s+(.*)$"_s );
6437 const QRegularExpressionMatch m = re.match( def );
6440 parent = m.captured( 1 ).trimmed();
6441 def = m.captured( 2 );
6464 QVariant var = input;
6465 if ( !var.isValid() )
6473 if ( var.userType() == qMetaTypeId<QgsProcessingFeatureSourceDefinition>() )
6478 else if ( var.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
6485 if ( var.userType() == qMetaTypeId<QgsProperty>() )
6497 if ( qobject_cast< QgsVectorLayer * >( qvariant_cast<QObject *>( input ) ) )
6502 if ( var.userType() != QMetaType::Type::QString || var.toString().isEmpty() )
6520 if ( !value.isValid() )
6523 if ( value.userType() == qMetaTypeId<QgsProperty>() )
6526 if ( value.userType() == qMetaTypeId<QgsProcessingFeatureSourceDefinition>() )
6529 QString geometryCheckString;
6533 geometryCheckString = u
"QgsFeatureRequest.GeometryNoCheck"_s;
6537 geometryCheckString = u
"QgsFeatureRequest.GeometrySkipInvalid"_s;
6541 geometryCheckString = u
"QgsFeatureRequest.GeometryAbortOnInvalid"_s;
6548 flags << u
"QgsProcessingFeatureSourceDefinition.FlagOverrideDefaultGeometryCheck"_s;
6550 flags << u
"QgsProcessingFeatureSourceDefinition.FlagCreateIndividualOutputPerInputFeature"_s;
6551 if ( !
flags.empty() )
6552 flagString =
flags.join(
" | "_L1 );
6559 layerString = layer->source();
6563 return u
"QgsProcessingFeatureSourceDefinition(%1, selectedFeaturesOnly=%2, featureLimit=%3%4%6, geometryCheck=%5)"_s.arg(
6567 flagString.isEmpty() ? QString() : ( u
", flags=%1"_s.arg( flagString ) ),
6568 geometryCheckString,
6581 return u
"QgsProcessingFeatureSourceDefinition(QgsProperty.fromExpression(%1), selectedFeaturesOnly=%2, featureLimit=%3%4%6, geometryCheck=%5)"_s.arg(
6585 flagString.isEmpty() ? QString() : ( u
", flags=%1"_s.arg( flagString ) ),
6586 geometryCheckString,
6596 else if (
QgsVectorLayer *layer = qobject_cast< QgsVectorLayer * >( qvariant_cast<QObject *>( value ) ) )
6601 QString layerString = value.toString();
6605 layerString = layer->providerType() !=
"ogr"_L1 && layer->providerType() !=
"gdal"_L1 && layer->providerType() !=
"mdal"_L1
6624 QString code = u
"##%1="_s.arg(
mName );
6626 code +=
"optional "_L1;
6627 code +=
"source "_L1;
6634 code +=
"point "_L1;
6642 code +=
"polygon "_L1;
6651 return code.trimmed();
6656 switch ( outputType )
6662 code +=
", optional=True"_L1;
6666 QStringList options;
6670 code += u
", types=[%1]"_s.arg( options.join(
',' ) );
6698 map.insert( u
"data_types"_s, types );
6706 const QVariantList values = map.value( u
"data_types"_s ).toList();
6707 for (
const QVariant &val : values )
6717 QString def = definition;
6720 if ( def.startsWith(
"point"_L1, Qt::CaseInsensitive ) )
6726 else if ( def.startsWith(
"line"_L1, Qt::CaseInsensitive ) )
6732 else if ( def.startsWith(
"polygon"_L1, Qt::CaseInsensitive ) )
6759 QVariant var = input;
6760 if ( !var.isValid() )
6768 if ( var.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
6774 if ( var.userType() == qMetaTypeId<QgsProperty>() )
6787 if ( var.userType() != QMetaType::Type::QString )
6790 if ( var.toString().isEmpty() )
6798 if ( !value.isValid() )
6801 if ( value.userType() == qMetaTypeId<QgsProperty>() )
6804 if ( value.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
6813 return u
"QgsProperty.fromExpression('%1')"_s.arg( fromVar.
sink.
asExpression() );
6822 QString code = u
"##%1="_s.arg(
mName );
6824 code +=
"optional "_L1;
6827 switch ( mDataType )
6830 code +=
"point "_L1;
6838 code +=
"polygon "_L1;
6842 code +=
"table "_L1;
6850 return code.trimmed();
6862 return lOriginalProvider->defaultVectorFileExtension(
hasGeometry() );
6866 return p->defaultVectorFileExtension(
hasGeometry() );
6883 switch ( outputType )
6889 code +=
", optional=True"_L1;
6893 code += u
", createByDefault=%1"_s.arg(
createByDefault() ? u
"True"_s : u
"False"_s );
6894 if ( mSupportsAppend )
6895 code +=
", supportsAppend=True"_L1;
6908 QStringList filters;
6909 for (
const QString &ext : exts )
6911 filters << QObject::tr(
"%1 files (*.%2)" ).arg( ext.toUpper(), ext.toLower() );
6913 return filters.join(
";;"_L1 ) + u
";;"_s + QObject::tr(
"All files (*.*)" );
6921 return lOriginalProvider->supportedOutputVectorLayerExtensions();
6923 return lOriginalProvider->supportedOutputTableExtensions();
6928 return p->supportedOutputVectorLayerExtensions();
6930 return p->supportedOutputTableExtensions();
6945 switch ( mDataType )
6976 map.insert( u
"data_type"_s,
static_cast< int >( mDataType ) );
6977 map.insert( u
"supports_append"_s, mSupportsAppend );
6985 mSupportsAppend = map.value( u
"supports_append"_s,
false ).toBool();
7000 QString def = definition;
7001 if ( def.startsWith(
"point"_L1, Qt::CaseInsensitive ) )
7006 else if ( def.startsWith(
"line"_L1, Qt::CaseInsensitive ) )
7011 else if ( def.startsWith(
"polygon"_L1, Qt::CaseInsensitive ) )
7016 else if ( def.startsWith(
"table"_L1, Qt::CaseInsensitive ) )
7027 return mSupportsAppend;
7046 QVariant var = input;
7047 if ( !var.isValid() )
7055 if ( var.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
7061 if ( var.userType() == qMetaTypeId<QgsProperty>() )
7074 if ( var.userType() != QMetaType::Type::QString )
7077 if ( var.toString().isEmpty() )
7085 if ( !value.isValid() )
7088 if ( value.userType() == qMetaTypeId<QgsProperty>() )
7091 if ( value.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
7100 return u
"QgsProperty.fromExpression('%1')"_s.arg( fromVar.
sink.
asExpression() );
7116 return lOriginalProvider->defaultRasterFileFormat();
7120 return p->defaultRasterFileFormat();
7132 if ( !extensions.isEmpty() )
7133 return extensions[0];
7140 QStringList filters;
7145 for (
const QPair<QString, QString> &formatAndExt : std::as_const( formatAndExtensions ) )
7147 const QString &format = formatAndExt.first;
7148 const QString &extension = formatAndExt.second;
7149 if ( format.isEmpty() )
7151 filters << QObject::tr(
"%1 files (*.%2)" ).arg( extension.toUpper(), extension.toLower() );
7157 filters << QObject::tr(
"%1 - %2 files (*.%3)" ).arg( format.toUpper(), extension.toLower(), extension.toLower() );
7161 return filters.join(
";;"_L1 ) + u
";;"_s + QObject::tr(
"All files (*.*)" );
7167 QSet< QString > extensions;
7168 for (
const QPair<QString, QString> &formatAndExt : std::as_const( formatAndExtensions ) )
7170 extensions.insert( formatAndExt.second );
7172 return QStringList( extensions.constBegin(), extensions.constEnd() );
7179 return lOriginalProvider->supportedOutputRasterLayerFormatAndExtensions();
7183 return p->supportedOutputRasterLayerFormatAndExtensions();
7211 QVariant var = input;
7212 if ( !var.isValid() )
7220 if ( var.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
7226 if ( var.userType() == qMetaTypeId<QgsProperty>() )
7239 if ( var.userType() != QMetaType::Type::QString )
7242 if ( var.toString().isEmpty() )
7252 if ( !value.isValid() )
7255 if ( value.userType() == qMetaTypeId<QgsProperty>() )
7258 if ( value.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
7267 return u
"QgsProperty.fromExpression('%1')"_s.arg( fromVar.
sink.
asExpression() );
7276 if ( !mFileFilter.isEmpty() && mFileFilter.contains( u
"htm"_s, Qt::CaseInsensitive ) )
7288 if ( mFileFilter.isEmpty() || mFileFilter == QObject::tr(
"All files (*.*)" ) )
7292 const thread_local QRegularExpression rx( u
".*?\\(\\*\\.([a-zA-Z0-9._]+).*"_s );
7293 const QRegularExpressionMatch match = rx.match( mFileFilter );
7294 if ( !match.hasMatch() )
7297 return match.captured( 1 );
7302 switch ( outputType )
7308 code +=
", optional=True"_L1;
7312 code += u
", createByDefault=%1"_s.arg(
createByDefault() ? u
"True"_s : u
"False"_s );
7324 return (
fileFilter().isEmpty() ? QString() :
fileFilter() + u
";;"_s ) + QObject::tr(
"All files (*.*)" );
7340 map.insert( u
"file_filter"_s, mFileFilter );
7347 mFileFilter = map.value( u
"file_filter"_s ).toString();
7367 QVariant var = input;
7368 if ( !var.isValid() )
7376 if ( var.userType() == qMetaTypeId<QgsProperty>() )
7389 if ( var.userType() != QMetaType::Type::QString )
7392 if ( var.toString().isEmpty() )
7421 map.insert( u
"supports_non_file_outputs"_s, mSupportsNonFileBasedOutputs );
7422 map.insert( u
"create_by_default"_s, mCreateByDefault );
7429 mSupportsNonFileBasedOutputs = map.value( u
"supports_non_file_outputs"_s ).toBool();
7430 mCreateByDefault = map.value( u
"create_by_default"_s, u
"1"_s ).toBool();
7436 switch ( outputType )
7445 code +=
", optional=True"_L1;
7447 code += u
", createByDefault=%1"_s.arg( mCreateByDefault ? u
"True"_s : u
"False"_s );
7469 const thread_local QRegularExpression rx( u
"[.]"_s );
7470 QString sanitizedName =
name();
7471 sanitizedName.replace( rx, u
"_"_s );
7486 return lOriginalProvider->isSupportedOutputValue( value,
this, context, error );
7495 return mCreateByDefault;
7517 QVariant var = input;
7518 if ( !var.isValid() )
7526 if ( var.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
7532 if ( var.userType() == qMetaTypeId<QgsProperty>() )
7545 if ( var.userType() != QMetaType::Type::QString )
7548 if ( var.toString().isEmpty() )
7556 if ( !value.isValid() )
7559 if ( value.userType() == qMetaTypeId<QgsProperty>() )
7562 if ( value.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
7571 return u
"QgsProperty.fromExpression('%1')"_s.arg( fromVar.
sink.
asExpression() );
7580 QString code = u
"##%1="_s.arg(
mName );
7582 code +=
"optional "_L1;
7583 code +=
"vectorDestination "_L1;
7585 switch ( mDataType )
7588 code +=
"point "_L1;
7596 code +=
"polygon "_L1;
7604 return code.trimmed();
7616 return lOriginalProvider->defaultVectorFileExtension(
hasGeometry() );
7620 return p->defaultVectorFileExtension(
hasGeometry() );
7637 switch ( outputType )
7643 code +=
", optional=True"_L1;
7647 code += u
", createByDefault=%1"_s.arg(
createByDefault() ? u
"True"_s : u
"False"_s );
7660 QStringList filters;
7661 for (
const QString &ext : exts )
7663 filters << QObject::tr(
"%1 files (*.%2)" ).arg( ext.toUpper(), ext.toLower() );
7665 return filters.join(
";;"_L1 ) + u
";;"_s + QObject::tr(
"All files (*.*)" );
7673 return lOriginalProvider->supportedOutputVectorLayerExtensions();
7675 return lOriginalProvider->supportedOutputTableExtensions();
7680 return p->supportedOutputVectorLayerExtensions();
7682 return p->supportedOutputTableExtensions();
7697 switch ( mDataType )
7728 map.insert( u
"data_type"_s,
static_cast< int >( mDataType ) );
7742 QString def = definition;
7743 if ( def.startsWith(
"point"_L1, Qt::CaseInsensitive ) )
7748 else if ( def.startsWith(
"line"_L1, Qt::CaseInsensitive ) )
7753 else if ( def.startsWith(
"polygon"_L1, Qt::CaseInsensitive ) )
7777 QVariant input = value;
7778 if ( !input.isValid() )
7786 if ( input.userType() == qMetaTypeId<QgsProperty>() )
7791 if ( input.userType() == QMetaType::Type::QVariantList || input.userType() == QMetaType::Type::QStringList )
7793 if ( !mAllowMultiple )
7802 const double res = input.toInt( &ok );
7812 return mAllowMultiple;
7822 if ( !value.isValid() )
7825 if ( value.userType() == qMetaTypeId<QgsProperty>() )
7828 if ( value.userType() == QMetaType::Type::QVariantList )
7831 const QVariantList values = value.toList();
7832 for (
auto it = values.constBegin(); it != values.constEnd(); ++it )
7834 parts << QString::number( static_cast< int >( it->toDouble() ) );
7836 return parts.join(
',' ).prepend(
'[' ).append(
']' );
7838 else if ( value.userType() == QMetaType::Type::QStringList )
7841 const QStringList values = value.toStringList();
7842 for (
auto it = values.constBegin(); it != values.constEnd(); ++it )
7844 parts << QString::number( static_cast< int >( it->toDouble() ) );
7846 return parts.join(
',' ).prepend(
'[' ).append(
']' );
7849 return value.toString();
7854 QString code = u
"##%1="_s.arg(
mName );
7856 code +=
"optional "_L1;
7859 if ( mAllowMultiple )
7860 code +=
"multiple "_L1;
7862 code += mParentLayerParameterName +
' ';
7865 return code.trimmed();
7870 QStringList depends;
7871 if ( !mParentLayerParameterName.isEmpty() )
7872 depends << mParentLayerParameterName;
7878 switch ( outputType )
7884 code +=
", optional=True"_L1;
7886 code += u
", parentLayerParameterName='%1'"_s.arg( mParentLayerParameterName );
7887 code += u
", allowMultiple=%1"_s.arg( mAllowMultiple ? u
"True"_s : u
"False"_s );
7899 return mParentLayerParameterName;
7910 map.insert( u
"parent_layer"_s, mParentLayerParameterName );
7911 map.insert( u
"allow_multiple"_s, mAllowMultiple );
7918 mParentLayerParameterName = map.value( u
"parent_layer"_s ).toString();
7919 mAllowMultiple = map.value( u
"allow_multiple"_s ).toBool();
7926 QString def = definition;
7929 if ( def.startsWith(
"multiple"_L1, Qt::CaseInsensitive ) )
7932 def = def.mid( 8 ).trimmed();
7935 const thread_local QRegularExpression re( u
"(.*?)\\s+(.*)$"_s );
7936 const QRegularExpressionMatch m = re.match( def );
7939 parent = m.captured( 1 ).trimmed();
7940 def = m.captured( 2 );
7974 QStringList depends;
7975 if ( !mParentParameterName.isEmpty() )
7976 depends << mParentParameterName;
7982 switch ( outputType )
7988 code +=
", optional=True"_L1;
7990 code += u
", parentParameterName='%1'"_s.arg( mParentParameterName );
7992 if (
minimum() != std::numeric_limits<double>::lowest() + 1 )
7993 code += u
", minValue=%1"_s.arg(
minimum() );
7994 if (
maximum() != std::numeric_limits<double>::max() )
7995 code += u
", maxValue=%1"_s.arg(
maximum() );
8006 return mParentParameterName;
8017 map.insert( u
"parent"_s, mParentParameterName );
8018 map.insert( u
"default_unit"_s,
static_cast< int >( mDefaultUnit ) );
8025 mParentParameterName = map.value( u
"parent"_s ).toString();
8063 QStringList depends;
8064 if ( !mParentParameterName.isEmpty() )
8065 depends << mParentParameterName;
8071 switch ( outputType )
8077 code +=
", optional=True"_L1;
8079 code += u
", parentParameterName='%1'"_s.arg( mParentParameterName );
8082 code += u
", minValue=%1"_s.arg(
minimum() );
8083 if (
maximum() != std::numeric_limits<double>::max() )
8084 code += u
", maxValue=%1"_s.arg(
maximum() );
8095 return mParentParameterName;
8106 map.insert( u
"parent"_s, mParentParameterName );
8114 mParentParameterName = map.value( u
"parent"_s ).toString();
8152 QStringList depends;
8153 if ( !mParentParameterName.isEmpty() )
8154 depends << mParentParameterName;
8160 switch ( outputType )
8166 code +=
", optional=True"_L1;
8168 code += u
", parentParameterName='%1'"_s.arg( mParentParameterName );
8171 code += u
", minValue=%1"_s.arg(
minimum() );
8172 if (
maximum() != std::numeric_limits<double>::max() )
8173 code += u
", maxValue=%1"_s.arg(
maximum() );
8184 return mParentParameterName;
8195 map.insert( u
"parent"_s, mParentParameterName );
8203 mParentParameterName = map.value( u
"parent"_s ).toString();
8236 switch ( outputType )
8242 code +=
", optional=True"_L1;
8244 if (
minimum() != std::numeric_limits<double>::lowest() + 1 )
8245 code += u
", minValue=%1"_s.arg(
minimum() );
8246 if (
maximum() != std::numeric_limits<double>::max() )
8247 code += u
", maxValue=%1"_s.arg(
maximum() );
8259 map.insert( u
"default_unit"_s,
static_cast< int >( mDefaultUnit ) );
8299 switch ( outputType )
8305 code +=
", optional=True"_L1;
8338 if ( value.userType() == qMetaTypeId<QgsProperty>() )
8341 const QString s = value.toString();
8347 QString code = u
"##%1="_s.arg(
mName );
8349 code +=
"optional "_L1;
8350 code +=
"layout "_L1;
8353 return code.trimmed();
8358 switch ( outputType )
8364 code +=
", optional=True"_L1;
8375 QString def = definition;
8377 if ( def.startsWith(
'"' ) || def.startsWith(
'\'' ) )
8379 if ( def.endsWith(
'"' ) || def.endsWith(
'\'' ) )
8383 if ( def ==
"None"_L1 )
8412 if ( value.userType() == qMetaTypeId<QgsProperty>() )
8415 const QString s = value.toString();
8421 QString code = u
"##%1="_s.arg(
mName );
8423 code +=
"optional "_L1;
8424 code +=
"layoutitem "_L1;
8425 if ( mItemType >= 0 )
8426 code += QString::number( mItemType ) +
' ';
8428 code += mParentLayoutParameterName +
' ';
8431 return code.trimmed();
8436 switch ( outputType )
8442 code +=
", optional=True"_L1;
8444 if ( mItemType >= 0 )
8445 code += u
", itemType=%1"_s.arg( mItemType );
8447 code += u
", parentLayoutParameterName='%1'"_s.arg( mParentLayoutParameterName );
8460 map.insert( u
"parent_layout"_s, mParentLayoutParameterName );
8461 map.insert( u
"item_type"_s, mItemType );
8468 mParentLayoutParameterName = map.value( u
"parent_layout"_s ).toString();
8469 mItemType = map.value( u
"item_type"_s ).toInt();
8475 QStringList depends;
8476 if ( !mParentLayoutParameterName.isEmpty() )
8477 depends << mParentLayoutParameterName;
8484 QString def = definition;
8486 const thread_local QRegularExpression re( u
"(\\d+)?\\s*(.*?)\\s+(.*)$"_s );
8487 const QRegularExpressionMatch m = re.match( def );
8490 itemType = m.captured( 1 ).trimmed().isEmpty() ? -1 : m.captured( 1 ).trimmed().toInt();
8491 parent = m.captured( 2 ).trimmed().isEmpty() ? m.captured( 3 ).trimmed() : m.captured( 2 ).trimmed();
8492 def = !m.captured( 2 ).trimmed().isEmpty() ? m.captured( 3 ) : QString();
8505 return mParentLayoutParameterName;
8510 mParentLayoutParameterName =
name;
8542 if ( value.userType() == qMetaTypeId<QgsProperty>() )
8545 if ( value.canConvert< QColor >() && !value.value< QColor >().isValid() )
8546 return u
"QColor()"_s;
8548 if ( value.canConvert< QColor >() )
8550 const QColor
c = value.value< QColor >();
8551 if ( !mAllowOpacity ||
c.alpha() == 255 )
8552 return u
"QColor(%1, %2, %3)"_s.arg(
c.red() ).arg(
c.green() ).arg(
c.blue() );
8554 return u
"QColor(%1, %2, %3, %4)"_s.arg(
c.red() ).arg(
c.green() ).arg(
c.blue() ).arg(
c.alpha() );
8557 const QString s = value.toString();
8563 QString code = u
"##%1="_s.arg(
mName );
8565 code +=
"optional "_L1;
8566 code +=
"color "_L1;
8568 if ( mAllowOpacity )
8569 code +=
"withopacity "_L1;
8572 return code.trimmed();
8577 switch ( outputType )
8583 code +=
", optional=True"_L1;
8585 code += u
", opacityEnabled=%1"_s.arg( mAllowOpacity ? u
"True"_s : u
"False"_s );
8597 if ( !input.isValid() && (
mDefault.isValid() && ( !
mDefault.toString().isEmpty() ||
mDefault.value< QColor >().isValid() ) ) )
8600 if ( !input.isValid() )
8603 if ( input.userType() == QMetaType::Type::QColor )
8607 else if ( input.userType() == qMetaTypeId<QgsProperty>() )
8612 if ( input.userType() != QMetaType::Type::QString || input.toString().isEmpty() )
8615 bool containsAlpha =
false;
8622 map.insert( u
"opacityEnabled"_s, mAllowOpacity );
8629 mAllowOpacity = map.value( u
"opacityEnabled"_s ).toBool();
8635 return mAllowOpacity;
8640 mAllowOpacity = enabled;
8645 QString def = definition;
8647 bool allowOpacity =
false;
8648 if ( def.startsWith(
"withopacity"_L1, Qt::CaseInsensitive ) )
8650 allowOpacity =
true;
8651 def = def.mid( 12 );
8654 if ( def.startsWith(
'"' ) || def.startsWith(
'\'' ) )
8656 if ( def.endsWith(
'"' ) || def.endsWith(
'\'' ) )
8660 if ( def ==
"None"_L1 || def.isEmpty() )
8670 const QString &
name,
8675 const QVariant &staticSourceCrs,
8676 const QVariant &staticDestinationCrs,
8682 , mSourceCrs( staticSourceCrs )
8683 , mDestCrs( staticDestinationCrs )
8693 return valueAsPythonStringPrivate( value, context,
false );
8696QString QgsProcessingParameterCoordinateOperation::valueAsPythonStringPrivate(
const QVariant &value,
QgsProcessingContext &context,
bool allowNonStringValues )
const
8701 if ( allowNonStringValues && value.userType() == qMetaTypeId<QgsCoordinateReferenceSystem>() )
8704 return u
"QgsCoordinateReferenceSystem()"_s;
8709 if ( value.userType() == qMetaTypeId<QgsProperty>() )
8710 return u
"QgsProperty.fromExpression('%1')"_s.arg( value.value< QgsProperty >().asExpression() );
8712 if ( allowNonStringValues )
8715 p.insert(
name(), value );
8721 const QString s = value.toString();
8727 QString code = u
"##%1="_s.arg(
mName );
8729 code +=
"optional "_L1;
8730 code +=
"coordinateoperation "_L1;
8733 return code.trimmed();
8738 switch ( outputType )
8745 code +=
", optional=True"_L1;
8746 if ( !mSourceParameterName.isEmpty() )
8747 code += u
", sourceCrsParameterName=%1"_s.arg( valueAsPythonStringPrivate( mSourceParameterName,
c,
false ) );
8748 if ( !mDestParameterName.isEmpty() )
8749 code += u
", destinationCrsParameterName=%1"_s.arg( valueAsPythonStringPrivate( mDestParameterName,
c,
false ) );
8751 if ( mSourceCrs.isValid() )
8752 code += u
", staticSourceCrs=%1"_s.arg( valueAsPythonStringPrivate( mSourceCrs,
c,
true ) );
8753 if ( mDestCrs.isValid() )
8754 code += u
", staticDestinationCrs=%1"_s.arg( valueAsPythonStringPrivate( mDestCrs,
c,
true ) );
8756 code += u
", defaultValue=%1)"_s.arg( valueAsPythonStringPrivate(
mDefault,
c,
false ) );
8766 if ( !mSourceParameterName.isEmpty() )
8767 res << mSourceParameterName;
8768 if ( !mDestParameterName.isEmpty() )
8769 res << mDestParameterName;
8776 map.insert( u
"source_crs_parameter_name"_s, mSourceParameterName );
8777 map.insert( u
"dest_crs_parameter_name"_s, mDestParameterName );
8778 map.insert( u
"static_source_crs"_s, mSourceCrs );
8779 map.insert( u
"static_dest_crs"_s, mDestCrs );
8786 mSourceParameterName = map.value( u
"source_crs_parameter_name"_s ).toString();
8787 mDestParameterName = map.value( u
"dest_crs_parameter_name"_s ).toString();
8788 mSourceCrs = map.value( u
"static_source_crs"_s );
8789 mDestCrs = map.value( u
"static_dest_crs"_s );
8795 QString def = definition;
8797 if ( def.startsWith(
'"' ) )
8800 if ( def.endsWith(
'"' ) )
8803 else if ( def.startsWith(
'\'' ) )
8806 if ( def.endsWith(
'\'' ) )
8811 if ( def ==
"None"_L1 )
8834 if ( !input.isValid() && !
mDefault.isValid() )
8837 if ( ( input.userType() == QMetaType::Type::QString && input.toString().isEmpty() ) || ( !input.isValid() &&
mDefault.userType() == QMetaType::Type::QString &&
mDefault.toString().isEmpty() ) )
8845 if ( !value.isValid() )
8848 if ( value.userType() == qMetaTypeId<QgsProperty>() )
8856 QString code = u
"##%1="_s.arg(
mName );
8858 code +=
"optional "_L1;
8859 code +=
"maptheme "_L1;
8862 return code.trimmed();
8867 switch ( outputType )
8873 code +=
", optional=True"_L1;
8898 QString def = definition;
8899 if ( def.startsWith(
'"' ) || def.startsWith(
'\'' ) )
8901 if ( def.endsWith(
'"' ) || def.endsWith(
'\'' ) )
8925 if ( mMin.isValid() && mMax.isValid() && mMin >= mMax )
8927 QgsMessageLog::logMessage( QObject::tr(
"Invalid datetime parameter \"%1\": min value %2 is >= max value %3!" ).arg( name, mMin.toString(), mMax.toString() ), QObject::tr(
"Processing" ) );
8938 QVariant input = value;
8939 if ( !input.isValid() )
8947 if ( input.userType() == qMetaTypeId<QgsProperty>() )
8952 if ( input.userType() != QMetaType::Type::QDateTime && input.userType() != QMetaType::Type::QDate && input.userType() != QMetaType::Type::QTime && input.userType() != QMetaType::Type::QString )
8958 if ( input.userType() == QMetaType::Type::QString )
8960 const QString s = input.toString();
8964 input = QDateTime::fromString( s, Qt::ISODate );
8967 if ( !input.toDateTime().isValid() )
8968 input = QTime::fromString( s );
8970 input = input.toDateTime().time();
8976 const QDateTime res = input.toDateTime();
8977 return res.isValid() && ( res >= mMin || !mMin.isValid() ) && ( res <= mMax || !mMax.isValid() );
8981 const QTime res = input.toTime();
8982 return res.isValid() && ( res >= mMin.time() || !mMin.isValid() ) && ( res <= mMax.time() || !mMax.isValid() );
8988 if ( !value.isValid() )
8991 if ( value.userType() == qMetaTypeId<QgsProperty>() )
8994 if ( value.userType() == QMetaType::Type::QDateTime )
8996 const QDateTime dt = value.toDateTime();
8997 if ( !dt.isValid() )
8998 return u
"QDateTime()"_s;
9000 return u
"QDateTime(QDate(%1, %2, %3), QTime(%4, %5, %6))"_s.arg( dt.date().year() )
9001 .arg( dt.date().month() )
9002 .arg( dt.date().day() )
9003 .arg( dt.time().hour() )
9004 .arg( dt.time().minute() )
9005 .arg( dt.time().second() );
9007 else if ( value.userType() == QMetaType::Type::QDate )
9009 const QDate dt = value.toDate();
9010 if ( !dt.isValid() )
9011 return u
"QDate()"_s;
9013 return u
"QDate(%1, %2, %3)"_s.arg( dt.year() ).arg( dt.month() ).arg( dt.day() );
9015 else if ( value.userType() == QMetaType::Type::QTime )
9017 const QTime dt = value.toTime();
9018 if ( !dt.isValid() )
9019 return u
"QTime()"_s;
9021 return u
"QTime(%4, %5, %6)"_s.arg( dt.hour() ).arg( dt.minute() ).arg( dt.second() );
9023 return value.toString();
9030 if ( mMin.isValid() )
9031 parts << QObject::tr(
"Minimum value: %1" ).arg( mMin.toString( Qt::ISODate ) );
9032 if ( mMax.isValid() )
9033 parts << QObject::tr(
"Maximum value: %1" ).arg( mMax.toString( Qt::ISODate ) );
9035 parts << QObject::tr(
"Default value: %1" )
9038 ?
mDefault.toDateTime().toString( Qt::ISODate )
9041 const QString extra = parts.join(
"<br />"_L1 );
9042 if ( !extra.isEmpty() )
9043 text += u
"<p>%1</p>"_s.arg( extra );
9049 switch ( outputType )
9055 code +=
", optional=True"_L1;
9057 code += u
", type=%1"_s.arg(
9060 : u
"QgsProcessingParameterDateTime.Time"_s
9064 if ( mMin.isValid() )
9066 if ( mMax.isValid() )
9108 map.insert( u
"min"_s, mMin );
9109 map.insert( u
"max"_s, mMax );
9110 map.insert( u
"data_type"_s,
static_cast< int >( mDataType ) );
9117 mMin = map.value( u
"min"_s ).toDateTime();
9118 mMax = map.value( u
"max"_s ).toDateTime();
9134 if ( value.userType() == QMetaType::Type::QDateTime )
9136 const QDateTime dt = value.toDateTime();
9137 if ( !dt.isValid() )
9138 return QObject::tr(
"Invalid datetime" );
9140 return dt.toString( Qt::ISODate );
9143 else if ( value.userType() == QMetaType::Type::QDate )
9145 const QDate dt = value.toDate();
9146 if ( !dt.isValid() )
9147 return QObject::tr(
"Invalid date" );
9149 return dt.toString( Qt::ISODate );
9152 else if ( value.userType() == QMetaType::Type::QTime )
9154 const QTime dt = value.toTime();
9155 if ( !dt.isValid() )
9156 return QObject::tr(
"Invalid time" );
9158 return dt.toString( Qt::ISODate );
9161 return value.toString();
9181 if ( !input.isValid() && !
mDefault.isValid() )
9184 if ( ( input.userType() == QMetaType::Type::QString && input.toString().isEmpty() ) || ( !input.isValid() &&
mDefault.userType() == QMetaType::Type::QString &&
mDefault.toString().isEmpty() ) )
9192 if ( !value.isValid() )
9195 if ( value.userType() == qMetaTypeId<QgsProperty>() )
9203 QString code = u
"##%1="_s.arg(
mName );
9205 code +=
"optional "_L1;
9206 code +=
"providerconnection "_L1;
9207 code += mProviderId +
' ';
9210 return code.trimmed();
9215 switch ( outputType )
9221 code +=
", optional=True"_L1;
9235 map.insert( u
"provider"_s, mProviderId );
9242 mProviderId = map.value( u
"provider"_s ).toString();
9248 QString def = definition;
9250 if ( def.contains(
' ' ) )
9252 provider = def.left( def.indexOf(
' ' ) );
9253 def = def.mid( def.indexOf(
' ' ) + 1 );
9261 if ( def.startsWith(
'"' ) || def.startsWith(
'\'' ) )
9263 if ( def.endsWith(
'"' ) || def.endsWith(
'\'' ) )
9280 const QString &
name,
const QString &
description,
const QString &parentLayerParameterName,
const QVariant &
defaultValue,
bool optional
9283 , mParentConnectionParameterName( parentLayerParameterName )
9294 if ( !input.isValid() && !
mDefault.isValid() )
9297 if ( ( input.userType() == QMetaType::Type::QString && input.toString().isEmpty() ) || ( !input.isValid() &&
mDefault.userType() == QMetaType::Type::QString &&
mDefault.toString().isEmpty() ) )
9305 if ( !value.isValid() )
9308 if ( value.userType() == qMetaTypeId<QgsProperty>() )
9316 QString code = u
"##%1="_s.arg(
mName );
9318 code +=
"optional "_L1;
9319 code +=
"databaseschema "_L1;
9321 code += mParentConnectionParameterName +
' ';
9324 return code.trimmed();
9329 switch ( outputType )
9335 code +=
", optional=True"_L1;
9337 code += u
", connectionParameterName='%1'"_s.arg( mParentConnectionParameterName );
9351 QStringList depends;
9352 if ( !mParentConnectionParameterName.isEmpty() )
9353 depends << mParentConnectionParameterName;
9359 return mParentConnectionParameterName;
9364 mParentConnectionParameterName =
name;
9370 map.insert( u
"mParentConnectionParameterName"_s, mParentConnectionParameterName );
9377 mParentConnectionParameterName = map.value( u
"mParentConnectionParameterName"_s ).toString();
9384 QString def = definition;
9386 const thread_local QRegularExpression re( u
"(.*?)\\s+(.*)$"_s );
9387 const QRegularExpressionMatch m = re.match( def );
9390 parent = m.captured( 1 ).trimmed();
9391 def = m.captured( 2 );
9410 , mParentConnectionParameterName( connectionParameterName )
9411 , mParentSchemaParameterName( schemaParameterName )
9423 if ( !input.isValid() && !
mDefault.isValid() )
9426 if ( ( input.userType() == QMetaType::Type::QString && input.toString().isEmpty() ) || ( !input.isValid() &&
mDefault.userType() == QMetaType::Type::QString &&
mDefault.toString().isEmpty() ) )
9434 if ( !value.isValid() )
9437 if ( value.userType() == qMetaTypeId<QgsProperty>() )
9445 QString code = u
"##%1="_s.arg(
mName );
9447 code +=
"optional "_L1;
9448 code +=
"databasetable "_L1;
9450 code += ( mParentConnectionParameterName.isEmpty() ? u
"none"_s : mParentConnectionParameterName ) +
' ';
9451 code += ( mParentSchemaParameterName.isEmpty() ? u
"none"_s : mParentSchemaParameterName ) +
' ';
9454 return code.trimmed();
9459 switch ( outputType )
9465 code +=
", optional=True"_L1;
9467 if ( mAllowNewTableNames )
9468 code +=
", allowNewTableNames=True"_L1;
9470 code += u
", connectionParameterName='%1'"_s.arg( mParentConnectionParameterName );
9471 code += u
", schemaParameterName='%1'"_s.arg( mParentSchemaParameterName );
9485 QStringList depends;
9486 if ( !mParentConnectionParameterName.isEmpty() )
9487 depends << mParentConnectionParameterName;
9488 if ( !mParentSchemaParameterName.isEmpty() )
9489 depends << mParentSchemaParameterName;
9495 return mParentConnectionParameterName;
9500 mParentConnectionParameterName =
name;
9505 return mParentSchemaParameterName;
9510 mParentSchemaParameterName =
name;
9516 map.insert( u
"mParentConnectionParameterName"_s, mParentConnectionParameterName );
9517 map.insert( u
"mParentSchemaParameterName"_s, mParentSchemaParameterName );
9518 map.insert( u
"mAllowNewTableNames"_s, mAllowNewTableNames );
9525 mParentConnectionParameterName = map.value( u
"mParentConnectionParameterName"_s ).toString();
9526 mParentSchemaParameterName = map.value( u
"mParentSchemaParameterName"_s ).toString();
9527 mAllowNewTableNames = map.value( u
"mAllowNewTableNames"_s,
false ).toBool();
9535 QString def = definition;
9537 const thread_local QRegularExpression re( u
"(.*?)\\s+(.*+)\\b\\s*(.*)$"_s );
9538 const QRegularExpressionMatch m = re.match( def );
9541 connection = m.captured( 1 ).trimmed();
9542 if ( connection ==
"none"_L1 )
9544 schema = m.captured( 2 ).trimmed();
9545 if ( schema ==
"none"_L1 )
9547 def = m.captured( 3 );
9555 return mAllowNewTableNames;
9580 if ( !var.isValid() )
9588 if ( var.userType() == qMetaTypeId<QgsProperty>() )
9601 if ( qobject_cast< QgsPointCloudLayer * >( qvariant_cast<QObject *>( var ) ) )
9604 if ( var.userType() != QMetaType::Type::QString || var.toString().isEmpty() )
9622 if ( !val.isValid() )
9625 if ( val.userType() == qMetaTypeId<QgsProperty>() )
9629 p.insert(
name(), val );
9670 if ( !var.isValid() )
9678 if ( var.userType() == qMetaTypeId<QgsProperty>() )
9691 if ( qobject_cast< QgsAnnotationLayer * >( qvariant_cast<QObject *>( var ) ) )
9694 if ( var.userType() != QMetaType::Type::QString || var.toString().isEmpty() )
9712 if ( !val.isValid() )
9715 if ( val.userType() == qMetaTypeId<QgsProperty>() )
9719 p.insert(
name(), val );
9754 QVariant var = input;
9755 if ( !var.isValid() )
9763 if ( var.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
9769 if ( var.userType() == qMetaTypeId<QgsProperty>() )
9782 if ( var.userType() != QMetaType::Type::QString )
9785 if ( var.toString().isEmpty() )
9793 if ( !value.isValid() )
9796 if ( value.userType() == qMetaTypeId<QgsProperty>() )
9799 if ( value.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
9808 return u
"QgsProperty.fromExpression('%1')"_s.arg( fromVar.
sink.
asExpression() );
9817 switch ( outputType )
9823 code +=
", optional=True"_L1;
9825 code += u
", createByDefault=%1"_s.arg(
createByDefault() ? u
"True"_s : u
"False"_s );
9828 code += u
", allowedPointCloudOutputs=Qgis.PointCloudOutputsTypes.%1"_s.arg(
qgsEnumValueToKey( mAllowedPointCloudOutputs ) );
9847 return QgsVirtualPointCloudProvider::defaultVpcExtension();
9851 return lOriginalProvider->defaultPointCloudFileExtension();
9855 return p->defaultPointCloudFileExtension();
9866 QStringList filters;
9867 for (
const QString &ext : exts )
9869 filters << QObject::tr(
"%1 files (*.%2)" ).arg( ext.toUpper(), ext.toLower() );
9871 return filters.join(
";;"_L1 ) + u
";;"_s + QObject::tr(
"All files (*.*)" );
9878 return QgsVirtualPointCloudProvider::supportedVpcExtensions();
9882 return lOriginalProvider->supportedOutputPointCloudLayerExtensions();
9886 return p->supportedOutputPointCloudLayerExtensions();
9891 return QStringList() << ext;
9898 map.insert( u
"allowed_point_cloud_outputs"_s,
qgsEnumValueToKey( mAllowedPointCloudOutputs ) );
9943 if ( input.userType() == qMetaTypeId<QgsProperty>() )
9948 if ( input.userType() == QMetaType::Type::QVariantList || input.userType() == QMetaType::Type::QStringList )
9950 if ( !mAllowMultiple )
9956 else if ( input.userType() == QMetaType::Type::QString )
9958 if ( input.toString().isEmpty() )
9961 const QStringList parts = input.toString().split(
';' );
9962 if ( parts.count() > 1 && !mAllowMultiple )
9967 if ( input.toString().isEmpty() )
9975 if ( !value.isValid() )
9978 if ( value.userType() == qMetaTypeId<QgsProperty>() )
9981 if ( value.userType() == QMetaType::Type::QVariantList )
9984 const auto constToList = value.toList();
9985 for (
const QVariant &val : constToList )
9989 return parts.join(
',' ).prepend(
'[' ).append(
']' );
9991 else if ( value.userType() == QMetaType::Type::QStringList )
9994 const auto constToStringList = value.toStringList();
9995 for (
const QString &s : constToStringList )
9999 return parts.join(
',' ).prepend(
'[' ).append(
']' );
10007 QString code = u
"##%1="_s.arg(
mName );
10009 code +=
"optional "_L1;
10010 code +=
"attribute "_L1;
10012 if ( mAllowMultiple )
10013 code +=
"multiple "_L1;
10015 if ( mDefaultToAllAttributes )
10016 code +=
"default_to_all_attributes "_L1;
10018 code += mParentLayerParameterName +
' ';
10021 return code.trimmed();
10026 switch ( outputType )
10032 code +=
", optional=True"_L1;
10034 code += u
", parentLayerParameterName='%1'"_s.arg( mParentLayerParameterName );
10035 code += u
", allowMultiple=%1"_s.arg( mAllowMultiple ? u
"True"_s : u
"False"_s );
10039 if ( mDefaultToAllAttributes )
10040 code +=
", defaultToAllAttributes=True"_L1;
10052 QStringList depends;
10053 if ( !mParentLayerParameterName.isEmpty() )
10054 depends << mParentLayerParameterName;
10060 return mParentLayerParameterName;
10070 return mAllowMultiple;
10080 return mDefaultToAllAttributes;
10085 mDefaultToAllAttributes = enabled;
10091 map.insert( u
"parent_layer"_s, mParentLayerParameterName );
10092 map.insert( u
"allow_multiple"_s, mAllowMultiple );
10093 map.insert( u
"default_to_all_attributes"_s, mDefaultToAllAttributes );
10100 mParentLayerParameterName = map.value( u
"parent_layer"_s ).toString();
10101 mAllowMultiple = map.value( u
"allow_multiple"_s ).toBool();
10102 mDefaultToAllAttributes = map.value( u
"default_to_all_attributes"_s ).toBool();
10111 QString def = definition;
10113 if ( def.startsWith(
"multiple"_L1, Qt::CaseInsensitive ) )
10116 def = def.mid( 8 ).trimmed();
10119 if ( def.startsWith(
"default_to_all_attributes"_L1, Qt::CaseInsensitive ) )
10122 def = def.mid( 25 ).trimmed();
10125 const thread_local QRegularExpression re( u
"(.*?)\\s+(.*)$"_s );
10126 const QRegularExpressionMatch m = re.match( def );
10127 if ( m.hasMatch() )
10129 parent = m.captured( 1 ).trimmed();
10130 def = m.captured( 2 );
10156 QVariant var = input;
10157 if ( !var.isValid() )
10165 if ( var.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
10168 var = fromVar.
sink;
10171 if ( var.userType() == qMetaTypeId<QgsProperty>() )
10184 if ( var.userType() != QMetaType::Type::QString )
10187 if ( var.toString().isEmpty() )
10195 if ( !value.isValid() )
10198 if ( value.userType() == qMetaTypeId<QgsProperty>() )
10201 if ( value.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
10210 return u
"QgsProperty.fromExpression('%1')"_s.arg( fromVar.
sink.
asExpression() );
10230 QStringList filters;
10231 for (
const QString &ext : exts )
10233 filters << QObject::tr(
"%1 files (*.%2)" ).arg( ext.toUpper(), ext.toLower() );
10235 return filters.join(
";;"_L1 ) + u
";;"_s + QObject::tr(
"All files (*.*)" );
10241 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.
PointCloudOutputsTypes
Point cloud output formats allowed for a point cloud destination.
@ OnlyVPC
Only virtual point cloud formats (VPC and VPZ).
@ All
All point cloud formats supported by the processing provider.
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 Q_INVOKABLE 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(), Qgis::StringFormat format=Qgis::StringFormat::PlainText)
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.
QgsProcessingFeedback * feedback()
Returns the associated feedback object.
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,...
long long featureCount() const override
Returns the number of features contained in the source, or -1 if the feature count is unknown.
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.
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
QString createFileFilter() const override
This method needs to be reimplemented in all classes which implement this interface and return a file...
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonOutputType::PythonQgsProcessingAlgorithmSubclass) const override
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
QgsProcessingParameterPointCloudDestination(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), bool optional=false, bool createByDefault=true, Qgis::PointCloudOutputsTypes allowedPointCloudOutputs=Qgis::PointCloudOutputsTypes::All)
Constructor for QgsProcessingParameterPointCloudDestination.
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.
QVariantMap toVariantMap() const override
Saves this parameter to a QVariantMap.
virtual QStringList supportedOutputPointCloudLayerExtensions() const
Returns a list of the point cloud format file extensions supported for this parameter.
Qgis::PointCloudOutputsTypes allowedPointCloudOutputs() const
Returns the point cloud output formats allowed 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.
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.
static const QgsSettingsEntryVariant * settingsDefaultGuiParam
Settings entry default GUI parameter value (per algorithm id and parameter name).
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.
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()