48#include <QRegularExpression>
51using namespace Qt::StringLiterals;
56 map.insert( u
"source"_s,
source.toVariant() );
60 map.insert( u
"flags"_s,
static_cast< int >(
flags ) );
61 map.insert( u
"geometry_check"_s,
static_cast< int >(
geometryCheck ) );
67 source.loadVariant( map.value( u
"source"_s ) );
69 featureLimit = map.value( u
"feature_limit"_s, -1 ).toLongLong();
83 map.insert( u
"source"_s,
source.toVariant() );
85 map.insert( u
"dpi"_s,
dpi );
91 source.loadVariant( map.value( u
"source"_s ) );
93 dpi = map.value( u
"dpi"_s, 0 ).toInt();
104 mUseRemapping =
true;
105 mRemappingDefinition = definition;
111 map.insert( u
"sink"_s,
sink.toVariant() );
114 map.insert( u
"remapping"_s, QVariant::fromValue( mRemappingDefinition ) );
120 sink.loadVariant( map.value( u
"sink"_s ) );
122 if ( map.contains( u
"remapping"_s ) )
124 mUseRemapping =
true;
129 mUseRemapping =
false;
140 && mUseRemapping == other.mUseRemapping
141 && mRemappingDefinition == other.mRemappingDefinition;
146 return !( *
this == other );
151 const QVariant val = parameters.value( name );
152 if ( val.userType() == qMetaTypeId<QgsProperty>() )
171 QVariant val = value;
172 if ( val.userType() == qMetaTypeId<QgsProperty>() )
175 if ( !val.isValid() )
184 return destParam->generateTemporaryDestination( &context );
187 return val.toString();
203 const QVariant val = value;
204 if ( val.userType() == qMetaTypeId<QgsProperty>() )
207 if ( val.isValid() && !val.toString().isEmpty() )
211 return val.toString();
231 QVariant val = value;
232 if ( val.userType() == qMetaTypeId<QgsProperty>() )
236 const double res = val.toDouble( &ok );
242 return val.toDouble();
258 QVariant val = value;
259 if ( val.userType() == qMetaTypeId<QgsProperty>() )
263 double dbl = val.toDouble( &ok );
268 dbl = val.toDouble( &ok );
275 const double round = std::round( dbl );
276 if ( round > std::numeric_limits<int>::max() || round < -std::numeric_limits<int>::max() )
281 return static_cast< int >( std::round( dbl ) );
290 return QList< int >();
298 return QList< int >();
300 QList< int > resultList;
301 const QVariant val = value;
304 if ( val.userType() == qMetaTypeId<QgsProperty>() )
306 else if ( val.userType() == QMetaType::Type::QVariantList )
308 const QVariantList list = val.toList();
309 for (
auto it = list.constBegin(); it != list.constEnd(); ++it )
310 resultList << it->toInt();
314 const QStringList parts = val.toString().split(
';' );
315 for (
auto it = parts.constBegin(); it != parts.constEnd(); ++it )
316 resultList << it->toInt();
320 if ( resultList.isEmpty() )
325 if ( definition->
defaultValue().userType() == QMetaType::Type::QVariantList )
327 const QVariantList list = definition->
defaultValue().toList();
328 for (
auto it = list.constBegin(); it != list.constEnd(); ++it )
329 resultList << it->toInt();
333 const QStringList parts = definition->
defaultValue().toString().split(
';' );
334 for (
auto it = parts.constBegin(); it != parts.constEnd(); ++it )
335 resultList << it->toInt();
356 QVariant val = value;
357 if ( val.userType() == qMetaTypeId<QgsProperty>() )
360 QDateTime d = val.toDateTime();
361 if ( !d.isValid() && val.userType() == QMetaType::Type::QString )
363 d = QDateTime::fromString( val.toString() );
370 d = val.toDateTime();
372 if ( !d.isValid() && val.userType() == QMetaType::Type::QString )
374 d = QDateTime::fromString( val.toString() );
393 QVariant val = value;
394 if ( val.userType() == qMetaTypeId<QgsProperty>() )
397 QDate d = val.toDate();
398 if ( !d.isValid() && val.userType() == QMetaType::Type::QString )
400 d = QDate::fromString( val.toString() );
409 if ( !d.isValid() && val.userType() == QMetaType::Type::QString )
411 d = QDate::fromString( val.toString() );
430 QVariant val = value;
431 if ( val.userType() == qMetaTypeId<QgsProperty>() )
436 if ( val.userType() == QMetaType::Type::QDateTime )
437 d = val.toDateTime().time();
441 if ( !d.isValid() && val.userType() == QMetaType::Type::QString )
443 d = QTime::fromString( val.toString() );
452 if ( !d.isValid() && val.userType() == QMetaType::Type::QString )
454 d = QTime::fromString( val.toString() );
475 if ( enumDef && val >= enumDef->
options().size() )
495 QVariantList resultList;
496 const QVariant val = value;
497 if ( val.userType() == qMetaTypeId<QgsProperty>() )
499 else if ( val.userType() == QMetaType::Type::QVariantList )
501 const auto constToList = val.toList();
502 for (
const QVariant &var : constToList )
505 else if ( val.userType() == QMetaType::Type::QString )
507 const auto constSplit = val.toString().split(
',' );
508 for (
const QString &var : constSplit )
514 if ( resultList.isEmpty() )
515 return QList< int >();
517 if ( ( !val.isValid() || !resultList.at( 0 ).isValid() ) && definition )
521 if ( definition->
defaultValue().userType() == QMetaType::Type::QVariantList )
523 const auto constToList = definition->
defaultValue().toList();
524 for (
const QVariant &var : constToList )
527 else if ( definition->
defaultValue().userType() == QMetaType::Type::QString )
529 const auto constSplit = definition->
defaultValue().toString().split(
',' );
530 for (
const QString &var : constSplit )
539 const auto constResultList = resultList;
540 for (
const QVariant &var : constResultList )
542 const int resInt = var.toInt();
543 if ( !enumDef || resInt < enumDef->options().size() )
576 return QStringList();
584 return QStringList();
586 const QVariant val = value;
588 QStringList enumValues;
590 std::function< void(
const QVariant &var ) > processVariant;
591 processVariant = [&enumValues, &context, &definition, &processVariant](
const QVariant &var ) {
592 if ( var.userType() == QMetaType::Type::QVariantList )
594 const auto constToList = var.toList();
595 for (
const QVariant &listVar : constToList )
597 processVariant( listVar );
600 else if ( var.userType() == QMetaType::Type::QStringList )
602 const auto constToStringList = var.toStringList();
603 for (
const QString &s : constToStringList )
608 else if ( var.userType() == qMetaTypeId<QgsProperty>() )
612 const QStringList parts = var.toString().split(
',' );
613 for (
const QString &s : parts )
620 processVariant( val );
627 const QStringList options = enumDef->options();
628 const QSet<QString> subtraction = QSet<QString>( enumValues.begin(), enumValues.end() ).subtract( QSet<QString>( options.begin(), options.end() ) );
630 if ( enumValues.isEmpty() || !subtraction.isEmpty() )
664 const QVariant val = value;
665 if ( val.userType() == qMetaTypeId<QgsProperty>() )
667 else if ( val.isValid() )
680 const QVariant val = value;
681 if ( val.userType() == qMetaTypeId<QgsProperty>() )
683 else if ( val.isValid() )
691 const QVariantMap ¶meters,
696 QString &destinationIdentifier,
698 const QVariantMap &createOptions,
699 const QStringList &datasourceOptions,
700 const QStringList &layerOptions
706 val = parameters.value( definition->
name() );
709 return parameterAsSink( definition, val, fields, geometryType, crs, context, destinationIdentifier, sinkFlags, createOptions, datasourceOptions, layerOptions );
714 const QVariant &value,
719 QString &destinationIdentifier,
721 const QVariantMap &createOptions,
722 const QStringList &datasourceOptions,
723 const QStringList &layerOptions
726 QVariantMap options = createOptions;
727 QVariant val = value;
732 bool useRemapDefinition =
false;
733 if ( val.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
744 useRemapDefinition =
true;
750 if ( definition && val.userType() == qMetaTypeId<QgsProperty>() )
754 else if ( !val.isValid() || val.toString().isEmpty() )
770 dest = val.toString();
775 dest = destParam->generateTemporaryDestination( &context );
778 if ( dest.isEmpty() )
781 std::unique_ptr< QgsFeatureSink > sink(
782 QgsProcessingUtils::createFeatureSink( dest, context, fields, geometryType, crs, options, datasourceOptions, layerOptions, sinkFlags, useRemapDefinition ? &remapDefinition :
nullptr )
784 destinationIdentifier = dest;
786 if ( destinationProject )
788 if ( destName.isEmpty() && definition )
794 outputName = definition->
name();
798 return sink.release();
819 const QVariantMap ¶meters,
821 const QStringList &compatibleFormats,
822 const QString &preferredFormat,
830 QVariant val = parameters.value( definition->
name() );
832 bool selectedFeaturesOnly =
false;
833 long long featureLimit = -1;
834 QString filterExpression;
835 if ( val.userType() == qMetaTypeId<QgsProcessingFeatureSourceDefinition>() )
844 else if ( val.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
851 if ( val.userType() == qMetaTypeId<QgsProperty>() )
857 vl = qobject_cast< QgsVectorLayer * >( qvariant_cast<QObject *>( val ) );
862 if ( val.userType() == qMetaTypeId<QgsProperty>() )
866 else if ( !val.isValid() || val.toString().isEmpty() )
872 vl = qobject_cast< QgsVectorLayer * >( qvariant_cast<QObject *>( val ) );
878 layerRef = val.toString();
883 if ( layerRef.isEmpty() )
901 const QVariantMap ¶meters,
903 const QStringList &compatibleFormats,
904 const QString &preferredFormat,
913 const QVariantMap ¶meters,
915 const QStringList &compatibleFormats,
916 const QString &preferredFormat,
921 QString *destLayer = layerName;
938 return parameterAsLayer( definition, parameters.value( definition->
name() ), context, layerHint, flags );
948 QVariant val = value;
949 if ( val.userType() == qMetaTypeId<QgsProperty>() )
954 if (
QgsMapLayer *layer = qobject_cast< QgsMapLayer * >( qvariant_cast<QObject *>( val ) ) )
959 if ( val.userType() == qMetaTypeId<QgsProcessingRasterLayerDefinition>() )
965 if ( val.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
977 if ( !val.isValid() || val.toString().isEmpty() )
983 if (
QgsMapLayer *layer = qobject_cast< QgsMapLayer * >( qvariant_cast<QObject *>( val ) ) )
988 QString layerRef = val.toString();
989 if ( layerRef.isEmpty() )
992 if ( layerRef.isEmpty() )
1023 val = parameters.value( definition->
name() );
1034 val = parameters.value( definition->
name() );
1035 if ( val.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
1039 format = fromVar.
format();
1047 QVariant val = value;
1051 if ( val.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
1061 if ( definition && val.userType() == qMetaTypeId<QgsProperty>() )
1065 else if ( definition && ( !val.isValid() || val.toString().isEmpty() ) )
1072 dest = val.toString();
1077 dest = destParam->generateTemporaryDestination( &context );
1080 if ( destinationProject )
1083 if ( destName.isEmpty() && definition )
1088 outputName = definition->
name();
1112 val = parameters.value( definition->
name() );
1119 QVariant val = value;
1121 if ( val.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
1129 if ( definition && val.userType() == qMetaTypeId<QgsProperty>() )
1133 else if ( definition && ( !val.isValid() || val.toString().isEmpty() ) )
1140 dest = val.toString();
1145 dest = destParam->generateTemporaryDestination( &context );
1165 return parameterAsCrs( definition, parameters.value( definition->
name() ), context );
1191 QVariant val = value;
1193 if ( val.userType() == qMetaTypeId<QgsRectangle>() )
1197 if ( val.userType() == qMetaTypeId< QgsGeometry>() )
1203 if ( val.userType() == qMetaTypeId<QgsReferencedRectangle>() )
1222 if ( val.userType() == qMetaTypeId<QgsProcessingFeatureSourceDefinition>() )
1228 else if ( val.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
1241 QgsMapLayer *layer = qobject_cast< QgsMapLayer * >( qvariant_cast<QObject *>( val ) );
1244 if ( val.userType() == qMetaTypeId<QgsProperty>() )
1247 rectText = val.toString();
1249 if ( rectText.isEmpty() && !layer )
1252 const thread_local QRegularExpression rx( u
"^(.*?)\\s*,\\s*(.*?),\\s*(.*?),\\s*(.*?)\\s*(?:\\[(.*)\\])?\\s*$"_s );
1253 const QRegularExpressionMatch match = rx.match( rectText );
1254 if ( match.hasMatch() )
1256 bool xMinOk =
false;
1257 const double xMin = match.captured( 1 ).toDouble( &xMinOk );
1258 bool xMaxOk =
false;
1259 const double xMax = match.captured( 2 ).toDouble( &xMaxOk );
1260 bool yMinOk =
false;
1261 const double yMin = match.captured( 3 ).toDouble( &yMinOk );
1262 bool yMaxOk =
false;
1263 const double yMax = match.captured( 4 ).toDouble( &yMaxOk );
1264 if ( xMinOk && xMaxOk && yMinOk && yMaxOk )
1317 QVariant val = parameters.value( definition->
name() );
1319 if ( val.userType() == qMetaTypeId<QgsReferencedRectangle>() )
1325 g = g.densifyByCount( 20 );
1339 if ( val.userType() == qMetaTypeId<QgsProcessingFeatureSourceDefinition>() )
1345 else if ( val.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
1358 if ( val.userType() == qMetaTypeId<QgsProperty>() )
1361 rectText = val.toString();
1363 if ( !rectText.isEmpty() )
1365 const thread_local QRegularExpression rx( u
"^(.*?)\\s*,\\s*(.*?),\\s*(.*?),\\s*(.*?)\\s*(?:\\[(.*)\\])?\\s*$"_s );
1366 const QRegularExpressionMatch match = rx.match( rectText );
1367 if ( match.hasMatch() )
1369 bool xMinOk =
false;
1370 const double xMin = match.captured( 1 ).toDouble( &xMinOk );
1371 bool xMaxOk =
false;
1372 const double xMax = match.captured( 2 ).toDouble( &xMaxOk );
1373 bool yMinOk =
false;
1374 const double yMin = match.captured( 3 ).toDouble( &yMinOk );
1375 bool yMaxOk =
false;
1376 const double yMax = match.captured( 4 ).toDouble( &yMaxOk );
1377 if ( xMinOk && xMaxOk && yMinOk && yMaxOk )
1407 QgsMapLayer *layer = qobject_cast< QgsMapLayer * >( qvariant_cast<QObject *>( val ) );
1436 const QVariant val = parameters.value( definition->
name() );
1442 QVariant val = value;
1443 if ( val.userType() == qMetaTypeId<QgsReferencedRectangle>() )
1452 if ( val.userType() == qMetaTypeId<QgsProcessingFeatureSourceDefinition>() )
1458 else if ( val.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
1470 QString valueAsString;
1471 if ( val.userType() == qMetaTypeId<QgsProperty>() )
1474 valueAsString = val.toString();
1476 const thread_local QRegularExpression rx( u
"^(.*?)\\s*,\\s*(.*?),\\s*(.*?),\\s*(.*?)\\s*(?:\\[(.*)\\])?\\s*$"_s );
1478 const QRegularExpressionMatch match = rx.match( valueAsString );
1479 if ( match.hasMatch() )
1486 if ( val.userType() == qMetaTypeId<QgsProcessingFeatureSourceDefinition>() )
1492 else if ( val.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
1505 if (
QgsMapLayer *layer = qobject_cast< QgsMapLayer * >( qvariant_cast<QObject *>( val ) ) )
1506 return layer->crs();
1508 return layer->crs();
1510 if (
auto *lProject = context.
project() )
1511 return lProject->crs();
1531 const QVariant val = value;
1532 if ( val.userType() == qMetaTypeId<QgsPointXY>() )
1536 if ( val.userType() == qMetaTypeId< QgsGeometry>() )
1542 if ( val.userType() == qMetaTypeId<QgsReferencedPointXY>() )
1561 if ( pointText.isEmpty() )
1564 if ( pointText.isEmpty() )
1567 const thread_local QRegularExpression rx( u
"^\\s*\\(?\\s*(.*?)\\s*,\\s*(.*?)\\s*(?:\\[(.*)\\])?\\s*\\)?\\s*$"_s );
1570 const QRegularExpressionMatch match = rx.match( valueAsString );
1571 if ( match.hasMatch() )
1574 const double x = match.captured( 1 ).toDouble( &xOk );
1576 const double y = match.captured( 2 ).toDouble( &yOk );
1604 const QVariant val = parameters.value( definition->
name() );
1610 if ( value.userType() == qMetaTypeId<QgsReferencedPointXY>() )
1619 const thread_local QRegularExpression rx( u
"^\\s*\\(?\\s*(.*?)\\s*,\\s*(.*?)\\s*(?:\\[(.*)\\])?\\s*\\)?\\s*$"_s );
1622 const QRegularExpressionMatch match = rx.match( valueAsString );
1623 if ( match.hasMatch() )
1630 if (
auto *lProject = context.
project() )
1631 return lProject->crs();
1651 const QVariant val = value;
1652 if ( val.userType() == qMetaTypeId< QgsGeometry>() )
1657 if ( val.userType() == qMetaTypeId<QgsPointXY>() )
1662 if ( val.userType() == qMetaTypeId<QgsRectangle>() )
1667 if ( val.userType() == qMetaTypeId<QgsReferencedPointXY>() )
1685 if ( val.userType() == qMetaTypeId<QgsReferencedRectangle>() )
1691 g = g.densifyByCount( 20 );
1705 if ( val.userType() == qMetaTypeId<QgsReferencedGeometry>() )
1724 if ( valueAsString.isEmpty() )
1727 if ( valueAsString.isEmpty() )
1730 const thread_local QRegularExpression rx( u
"^\\s*(?:CRS=(.*);)?(.*?)$"_s );
1732 const QRegularExpressionMatch match = rx.match( valueAsString );
1733 if ( match.hasMatch() )
1760 const QVariant val = parameters.value( definition->
name() );
1766 if ( value.userType() == qMetaTypeId<QgsReferencedGeometry>() )
1775 if ( value.userType() == qMetaTypeId<QgsReferencedPointXY>() )
1784 if ( value.userType() == qMetaTypeId<QgsReferencedRectangle>() )
1794 const QRegularExpression rx( u
"^\\s*(?:CRS=(.*);)?(.*?)$"_s );
1797 const QRegularExpressionMatch match = rx.match( valueAsString );
1798 if ( match.hasMatch() )
1805 if (
auto *lProject = context.
project() )
1806 return lProject->crs();
1817 if ( fileText.isEmpty() )
1828 if ( fileText.isEmpty() )
1836 return QVariantList();
1844 return QVariantList();
1846 QString resultString;
1847 const QVariant val = value;
1848 if ( val.userType() == qMetaTypeId<QgsProperty>() )
1850 else if ( val.userType() == QMetaType::Type::QVariantList )
1851 return val.toList();
1853 resultString = val.toString();
1855 if ( resultString.isEmpty() )
1858 if ( definition->
defaultValue().userType() == QMetaType::Type::QVariantList )
1864 QVariantList result;
1865 const auto constSplit = resultString.split(
',' );
1868 for (
const QString &s : constSplit )
1870 number = s.toDouble( &ok );
1871 result << ( ok ? QVariant( number ) : s );
1882 return QList<QgsMapLayer *>();
1892 return QList<QgsMapLayer *>();
1894 const QVariant val = value;
1895 if (
QgsMapLayer *layer = qobject_cast< QgsMapLayer * >( qvariant_cast<QObject *>( val ) ) )
1897 return QList<QgsMapLayer *>() << layer;
1900 QList<QgsMapLayer *> layers;
1902 std::function< void(
const QVariant &var ) > processVariant;
1903 processVariant = [&layers, &context, &definition, flags, &processVariant](
const QVariant &var ) {
1904 if ( var.userType() == QMetaType::Type::QVariantList )
1906 const auto constToList = var.toList();
1907 for (
const QVariant &listVar : constToList )
1909 processVariant( listVar );
1912 else if ( var.userType() == QMetaType::Type::QStringList )
1914 const auto constToStringList = var.toStringList();
1915 for (
const QString &s : constToStringList )
1917 processVariant( s );
1920 else if ( var.userType() == qMetaTypeId<QgsProperty>() )
1922 else if ( var.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
1926 const QVariant sink = fromVar.
sink;
1927 if ( sink.userType() == qMetaTypeId<QgsProperty>() )
1932 else if (
QgsMapLayer *layer = qobject_cast< QgsMapLayer * >( qvariant_cast<QObject *>( var ) ) )
1944 processVariant( val );
1946 if ( layers.isEmpty() )
1949 if (
QgsMapLayer *layer = qobject_cast< QgsMapLayer * >( qvariant_cast<QObject *>( definition->
defaultValue() ) ) )
1953 else if ( definition->
defaultValue().userType() == QMetaType::Type::QVariantList )
1955 const auto constToList = definition->
defaultValue().toList();
1956 for (
const QVariant &var : constToList )
1958 if (
QgsMapLayer *layer = qobject_cast< QgsMapLayer * >( qvariant_cast<QObject *>( var ) ) )
1964 processVariant( var );
1978 return QStringList();
1980 const QVariant val = value;
1984 std::function< void(
const QVariant &var ) > processVariant;
1985 processVariant = [&files, &context, &definition, &processVariant](
const QVariant &var ) {
1986 if ( var.userType() == QMetaType::Type::QVariantList )
1988 const auto constToList = var.toList();
1989 for (
const QVariant &listVar : constToList )
1991 processVariant( listVar );
1994 else if ( var.userType() == QMetaType::Type::QStringList )
1996 const auto constToStringList = var.toStringList();
1997 for (
const QString &s : constToStringList )
1999 processVariant( s );
2002 else if ( var.userType() == qMetaTypeId<QgsProperty>() )
2006 files << var.toString();
2010 processVariant( val );
2012 if ( files.isEmpty() )
2023 return QStringList();
2031 return QList<double>();
2039 return QList<double>();
2041 QStringList resultStringList;
2042 const QVariant val = value;
2044 if ( val.userType() == qMetaTypeId<QgsProperty>() )
2046 else if ( val.userType() == QMetaType::Type::QVariantList )
2048 const auto constToList = val.toList();
2049 for (
const QVariant &var : constToList )
2050 resultStringList << var.toString();
2053 resultStringList << val.toString();
2055 if ( ( resultStringList.isEmpty() || ( resultStringList.size() == 1 && resultStringList.at( 0 ).isEmpty() ) ) )
2057 resultStringList.clear();
2059 if ( definition->
defaultValue().userType() == QMetaType::Type::QVariantList )
2061 const auto constToList = definition->
defaultValue().toList();
2062 for (
const QVariant &var : constToList )
2063 resultStringList << var.toString();
2066 resultStringList << definition->
defaultValue().toString();
2069 if ( resultStringList.size() == 1 )
2071 resultStringList = resultStringList.at( 0 ).split(
',' );
2074 if ( resultStringList.size() < 2 )
2075 return QList< double >() << std::numeric_limits<double>::quiet_NaN() << std::numeric_limits<double>::quiet_NaN();
2077 QList< double > result;
2079 double n = resultStringList.at( 0 ).toDouble( &ok );
2083 result << std::numeric_limits<double>::quiet_NaN();
2085 n = resultStringList.at( 1 ).toDouble( &ok );
2089 result << std::numeric_limits<double>::quiet_NaN();
2097 return QStringList();
2110 return QStringList();
2118 return QStringList();
2120 QStringList resultStringList;
2121 const QVariant val = value;
2122 if ( val.isValid() )
2124 if ( val.userType() == qMetaTypeId<QgsProperty>() )
2126 else if ( val.userType() == QMetaType::Type::QVariantList )
2128 const auto constToList = val.toList();
2129 for (
const QVariant &var : constToList )
2130 resultStringList << var.toString();
2132 else if ( val.userType() == QMetaType::Type::QStringList )
2134 resultStringList = val.toStringList();
2137 resultStringList.append( val.toString().split(
';' ) );
2140 if ( ( resultStringList.isEmpty() || resultStringList.at( 0 ).isEmpty() ) )
2142 resultStringList.clear();
2146 if ( definition->
defaultValue().userType() == QMetaType::Type::QVariantList )
2148 const auto constToList = definition->
defaultValue().toList();
2149 for (
const QVariant &var : constToList )
2150 resultStringList << var.toString();
2152 else if ( definition->
defaultValue().userType() == QMetaType::Type::QStringList )
2154 resultStringList = definition->
defaultValue().toStringList();
2157 resultStringList.append( definition->
defaultValue().toString().split(
';' ) );
2161 return resultStringList;
2175 if ( layoutName.isEmpty() )
2227 QVariant val = value;
2228 if ( val.userType() == qMetaTypeId<QgsProperty>() )
2232 if ( val.userType() == QMetaType::Type::QColor )
2234 QColor
c = val.value< QColor >();
2236 if ( !colorParam->opacityEnabled() )
2244 if ( definition->
defaultValue().userType() == QMetaType::Type::QColor )
2250 if ( colorText.isEmpty() )
2253 bool containsAlpha =
false;
2256 if (
c.isValid() && !colorParam->opacityEnabled() )
2332 const QString type = map.value( u
"parameter_type"_s ).toString();
2333 const QString name = map.value( u
"name"_s ).toString();
2334 std::unique_ptr< QgsProcessingParameterDefinition > def;
2340 def = std::make_unique<QgsProcessingParameterBoolean>( name );
2342 def = std::make_unique<QgsProcessingParameterCrs>( name );
2344 def = std::make_unique<QgsProcessingParameterMapLayer>( name );
2346 def = std::make_unique<QgsProcessingParameterExtent>( name );
2348 def = std::make_unique<QgsProcessingParameterPoint>( name );
2350 def = std::make_unique<QgsProcessingParameterFile>( name );
2352 def = std::make_unique<QgsProcessingParameterMatrix>( name );
2354 def = std::make_unique<QgsProcessingParameterMultipleLayers>( name );
2356 def = std::make_unique<QgsProcessingParameterNumber>( name );
2358 def = std::make_unique<QgsProcessingParameterRange>( name );
2360 def = std::make_unique<QgsProcessingParameterRasterLayer>( name );
2362 def = std::make_unique<QgsProcessingParameterEnum>( name );
2364 def = std::make_unique<QgsProcessingParameterString>( name );
2366 def = std::make_unique<QgsProcessingParameterAuthConfig>( name );
2368 def = std::make_unique<QgsProcessingParameterExpression>( name );
2370 def = std::make_unique<QgsProcessingParameterVectorLayer>( name );
2372 def = std::make_unique<QgsProcessingParameterField>( name );
2374 def = std::make_unique<QgsProcessingParameterFeatureSource>( name );
2376 def = std::make_unique<QgsProcessingParameterFeatureSink>( name );
2378 def = std::make_unique<QgsProcessingParameterVectorDestination>( name );
2380 def = std::make_unique<QgsProcessingParameterRasterDestination>( name );
2382 def = std::make_unique<QgsProcessingParameterPointCloudDestination>( name );
2384 def = std::make_unique<QgsProcessingParameterFileDestination>( name );
2386 def = std::make_unique<QgsProcessingParameterFolderDestination>( name );
2388 def = std::make_unique<QgsProcessingParameterBand>( name );
2390 def = std::make_unique<QgsProcessingParameterMeshLayer>( name );
2392 def = std::make_unique<QgsProcessingParameterLayout>( name );
2394 def = std::make_unique<QgsProcessingParameterLayoutItem>( name );
2396 def = std::make_unique<QgsProcessingParameterColor>( name );
2398 def = std::make_unique<QgsProcessingParameterCoordinateOperation>( name );
2400 def = std::make_unique<QgsProcessingParameterPointCloudLayer>( name );
2402 def = std::make_unique<QgsProcessingParameterAnnotationLayer>( name );
2404 def = std::make_unique<QgsProcessingParameterPointCloudAttribute>( name );
2406 def = std::make_unique<QgsProcessingParameterVectorTileDestination>( name );
2411 def.reset( paramType->
create( name ) );
2417 def->fromVariantMap( map );
2418 return def.release();
2423 QString desc = name;
2424 desc.replace(
'_',
' ' );
2430 bool isOptional =
false;
2434 if ( !parseScriptCodeParameterOptions( code, isOptional, name, type, definition ) )
2439 if ( type ==
"boolean"_L1 )
2441 else if ( type ==
"crs"_L1 )
2443 else if ( type ==
"layer"_L1 )
2445 else if ( type ==
"extent"_L1 )
2447 else if ( type ==
"point"_L1 )
2449 else if ( type ==
"geometry"_L1 )
2451 else if ( type ==
"file"_L1 )
2453 else if ( type ==
"folder"_L1 )
2455 else if ( type ==
"matrix"_L1 )
2457 else if ( type ==
"multiple"_L1 )
2459 else if ( type ==
"number"_L1 )
2461 else if ( type ==
"distance"_L1 )
2463 else if ( type ==
"area"_L1 )
2465 else if ( type ==
"volume"_L1 )
2467 else if ( type ==
"duration"_L1 )
2469 else if ( type ==
"scale"_L1 )
2471 else if ( type ==
"range"_L1 )
2473 else if ( type ==
"raster"_L1 )
2475 else if ( type ==
"enum"_L1 )
2477 else if ( type ==
"string"_L1 )
2479 else if ( type ==
"authcfg"_L1 )
2481 else if ( type ==
"expression"_L1 )
2483 else if ( type ==
"field"_L1 )
2485 else if ( type ==
"vector"_L1 )
2487 else if ( type ==
"source"_L1 )
2489 else if ( type ==
"sink"_L1 )
2491 else if ( type ==
"vectordestination"_L1 )
2493 else if ( type ==
"rasterdestination"_L1 )
2495 else if ( type ==
"pointclouddestination"_L1 )
2497 else if ( type ==
"filedestination"_L1 )
2499 else if ( type ==
"folderdestination"_L1 )
2501 else if ( type ==
"band"_L1 )
2503 else if ( type ==
"mesh"_L1 )
2505 else if ( type ==
"layout"_L1 )
2507 else if ( type ==
"layoutitem"_L1 )
2509 else if ( type ==
"color"_L1 )
2511 else if ( type ==
"coordinateoperation"_L1 )
2513 else if ( type ==
"maptheme"_L1 )
2515 else if ( type ==
"datetime"_L1 )
2517 else if ( type ==
"providerconnection"_L1 )
2519 else if ( type ==
"databaseschema"_L1 )
2521 else if ( type ==
"databasetable"_L1 )
2523 else if ( type ==
"pointcloud"_L1 )
2525 else if ( type ==
"annotation"_L1 )
2527 else if ( type ==
"attribute"_L1 )
2529 else if ( type ==
"vectortiledestination"_L1 )
2535bool QgsProcessingParameters::parseScriptCodeParameterOptions(
const QString &code,
bool &isOptional, QString &name, QString &type, QString &definition )
2537 const thread_local QRegularExpression re( u
"(?:#*)(.*?)=\\s*(.*)"_s );
2538 QRegularExpressionMatch m = re.match( code );
2539 if ( !m.hasMatch() )
2542 name = m.captured( 1 );
2543 QString tokens = m.captured( 2 );
2544 if ( tokens.startsWith(
"optional"_L1, Qt::CaseInsensitive ) )
2547 tokens.remove( 0, 8 );
2554 tokens = tokens.trimmed();
2556 const thread_local QRegularExpression re2( u
"(.*?)\\s+(.*)"_s );
2557 m = re2.match( tokens );
2558 if ( !m.hasMatch() )
2560 type = tokens.toLower().trimmed();
2565 type = m.captured( 1 ).toLower().trimmed();
2566 definition = m.captured( 2 );
2580 ,
mFlags( optional ?
Qgis::ProcessingParameterFlag::Optional :
Qgis::ProcessingParameterFlag() )
2586 if ( defaultSettingsValue.isValid() )
2588 return defaultSettingsValue;
2596 if ( defaultSettingsValue.isValid() )
2598 return defaultSettingsValue;
2608 if ( settingValue.isValid() )
2610 return settingValue;
2618 if ( !input.isValid() && !
mDefault.isValid() )
2621 if ( ( input.userType() == QMetaType::Type::QString && input.toString().isEmpty() ) || ( !input.isValid() &&
mDefault.userType() == QMetaType::Type::QString &&
mDefault.toString().isEmpty() ) )
2629 if ( !value.isValid() )
2632 if ( value.userType() == qMetaTypeId<QgsProperty>() )
2645 if ( !value.isValid() )
2649 if ( value.userType() == QMetaType::Type::QVariantMap )
2651 const QVariantMap sourceMap = value.toMap();
2652 QVariantMap resultMap;
2653 for (
auto it = sourceMap.constBegin(); it != sourceMap.constEnd(); it++ )
2659 else if ( value.userType() == QMetaType::Type::QVariantList || value.userType() == QMetaType::Type::QStringList )
2661 const QVariantList sourceList = value.toList();
2662 QVariantList resultList;
2663 resultList.reserve( sourceList.size() );
2664 for (
const QVariant &v : sourceList )
2672 switch ( value.userType() )
2675 case QMetaType::Bool:
2676 case QMetaType::Char:
2677 case QMetaType::Int:
2678 case QMetaType::Double:
2679 case QMetaType::Float:
2680 case QMetaType::LongLong:
2681 case QMetaType::ULongLong:
2682 case QMetaType::UInt:
2683 case QMetaType::ULong:
2684 case QMetaType::UShort:
2691 if ( value.userType() == qMetaTypeId<QgsProperty>() )
2701 return QVariantMap( { { u
"type"_s, u
"data_defined"_s }, { u
"field"_s, prop.
field() } } );
2703 return QVariantMap( { { u
"type"_s, u
"data_defined"_s }, { u
"expression"_s, prop.
expressionString() } } );
2708 if ( value.userType() == qMetaTypeId<QgsCoordinateReferenceSystem>() )
2713 else if ( !crs.
authid().isEmpty() )
2718 else if ( value.userType() == qMetaTypeId<QgsRectangle>() )
2723 else if ( value.userType() == qMetaTypeId<QgsReferencedRectangle>() )
2728 else if ( value.userType() == qMetaTypeId< QgsGeometry>() )
2740 else if ( value.userType() == qMetaTypeId<QgsReferencedGeometry>() )
2755 else if ( value.userType() == qMetaTypeId<QgsPointXY>() )
2760 else if ( value.userType() == qMetaTypeId<QgsReferencedPointXY>() )
2765 else if ( value.userType() == qMetaTypeId<QgsProcessingFeatureSourceDefinition>() )
2772 else if ( value.userType() == qMetaTypeId<QgsProcessingRasterLayerDefinition>() )
2779 else if ( value.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
2784 else if ( value.userType() == qMetaTypeId<QColor>() )
2786 const QColor fromVar = value.value< QColor >();
2787 if ( !fromVar.isValid() )
2790 return u
"rgba( %1, %2, %3, %4 )"_s.arg( fromVar.red() ).arg( fromVar.green() ).arg( fromVar.blue() ).arg( QString::number( fromVar.alphaF(),
'f', 2 ) );
2792 else if ( value.userType() == qMetaTypeId<QDateTime>() )
2794 const QDateTime fromVar = value.toDateTime();
2795 if ( !fromVar.isValid() )
2798 return fromVar.toString( Qt::ISODate );
2800 else if ( value.userType() == qMetaTypeId<QDate>() )
2802 const QDate fromVar = value.toDate();
2803 if ( !fromVar.isValid() )
2806 return fromVar.toString( Qt::ISODate );
2808 else if ( value.userType() == qMetaTypeId<QTime>() )
2810 const QTime fromVar = value.toTime();
2811 if ( !fromVar.isValid() )
2814 return fromVar.toString( Qt::ISODate );
2821 p.insert(
name(), value );
2829 if ( value.userType() == QMetaType::QString )
2834 Q_ASSERT_X(
false,
"QgsProcessingParameterDefinition::valueAsJsonObject", u
"unsupported variant type %1"_s.arg( QMetaType::typeName( value.userType() ) ).toLocal8Bit() );
2847 if ( !value.isValid() )
2850 switch ( value.userType() )
2853 case QMetaType::Bool:
2854 case QMetaType::Char:
2855 case QMetaType::Int:
2856 case QMetaType::Double:
2857 case QMetaType::Float:
2858 case QMetaType::LongLong:
2859 case QMetaType::ULongLong:
2860 case QMetaType::UInt:
2861 case QMetaType::ULong:
2862 case QMetaType::UShort:
2863 return value.toString();
2869 if ( value.userType() == qMetaTypeId<QgsProperty>() )
2879 return u
"field:%1"_s.arg( prop.
field() );
2886 if ( value.userType() == qMetaTypeId<QgsCoordinateReferenceSystem>() )
2891 else if ( !crs.
authid().isEmpty() )
2896 else if ( value.userType() == qMetaTypeId<QgsRectangle>() )
2901 else if ( value.userType() == qMetaTypeId<QgsReferencedRectangle>() )
2906 else if ( value.userType() == qMetaTypeId< QgsGeometry>() )
2918 else if ( value.userType() == qMetaTypeId<QgsReferencedGeometry>() )
2933 else if ( value.userType() == qMetaTypeId<QgsPointXY>() )
2938 else if ( value.userType() == qMetaTypeId<QgsReferencedPointXY>() )
2943 else if ( value.userType() == qMetaTypeId<QgsProcessingFeatureSourceDefinition>() )
2948 else if ( value.userType() == qMetaTypeId<QgsProcessingRasterLayerDefinition>() )
2953 else if ( value.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
2958 else if ( value.userType() == qMetaTypeId<QColor>() )
2960 const QColor fromVar = value.value< QColor >();
2961 if ( !fromVar.isValid() )
2964 return u
"rgba( %1, %2, %3, %4 )"_s.arg( fromVar.red() ).arg( fromVar.green() ).arg( fromVar.blue() ).arg( QString::number( fromVar.alphaF(),
'f', 2 ) );
2966 else if ( value.userType() == qMetaTypeId<QDateTime>() )
2968 const QDateTime fromVar = value.toDateTime();
2969 if ( !fromVar.isValid() )
2972 return fromVar.toString( Qt::ISODate );
2974 else if ( value.userType() == qMetaTypeId<QDate>() )
2976 const QDate fromVar = value.toDate();
2977 if ( !fromVar.isValid() )
2980 return fromVar.toString( Qt::ISODate );
2982 else if ( value.userType() == qMetaTypeId<QTime>() )
2984 const QTime fromVar = value.toTime();
2985 if ( !fromVar.isValid() )
2988 return fromVar.toString( Qt::ISODate );
2995 p.insert(
name(), value );
3003 if ( value.userType() == QMetaType::QString )
3004 return value.toString();
3007 QgsDebugError( u
"unsupported variant type %1"_s.arg( QMetaType::typeName( value.userType() ) ) );
3009 return value.toString();
3015 if ( !value.isValid() )
3016 return QStringList();
3018 if ( value.userType() == QMetaType::Type::QVariantList || value.userType() == QMetaType::Type::QStringList )
3020 const QVariantList sourceList = value.toList();
3021 QStringList resultList;
3022 resultList.reserve( sourceList.size() );
3023 for (
const QVariant &v : sourceList )
3032 return QStringList();
3044 QString code = u
"##%1="_s.arg(
mName );
3046 code +=
"optional "_L1;
3047 code +=
type() +
' ';
3049 return code.trimmed();
3057 switch ( outputType )
3063 code +=
", optional=True"_L1;
3079 map.insert( u
"parameter_type"_s,
type() );
3080 map.insert( u
"name"_s,
mName );
3082 map.insert( u
"help"_s,
mHelp );
3083 map.insert( u
"default"_s,
mDefault );
3085 map.insert( u
"flags"_s,
static_cast< int >(
mFlags ) );
3092 mName = map.value( u
"name"_s ).toString();
3093 mDescription = map.value( u
"description"_s ).toString();
3094 mHelp = map.value( u
"help"_s ).toString();
3095 mDefault = map.value( u
"default"_s );
3098 mMetadata = map.value( u
"metadata"_s ).toMap();
3114 QString text = u
"<p><b>%1</b></p>"_s.arg(
description() );
3115 if ( !
help().isEmpty() )
3117 text += u
"<p>%1</p>"_s.arg(
help() );
3119 text += u
"<p>%1</p>"_s.arg( QObject::tr(
"Python identifier: ‘%1’" ).arg( u
"<i>%1</i>"_s.arg(
name() ) ) );
3148 if ( value.userType() == qMetaTypeId<QgsPointXY>() )
3154 else if ( value.userType() == qMetaTypeId<QgsReferencedPointXY>() )
3160 else if ( value.userType() == qMetaTypeId<QgsRectangle>() )
3166 else if ( value.userType() == qMetaTypeId<QgsReferencedRectangle>() )
3176 else if ( value.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
3189 return value.toString();
3195 if ( !val.isValid() )
3198 if ( val.userType() == qMetaTypeId<QgsProperty>() )
3200 return val.toBool() ? u
"True"_s : u
"False"_s;
3205 QString code = u
"##%1="_s.arg(
mName );
3207 code +=
"optional "_L1;
3208 code +=
type() +
' ';
3209 code +=
mDefault.toBool() ? u
"true"_s : u
"false"_s;
3210 return code.trimmed();
3230 if ( !input.isValid() )
3238 if ( input.userType() == qMetaTypeId<QgsCoordinateReferenceSystem>() )
3242 else if ( input.userType() == qMetaTypeId<QgsProcessingFeatureSourceDefinition>() )
3246 else if ( input.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
3251 if ( input.userType() == qMetaTypeId<QgsProperty>() )
3256 if ( input.type() == QVariant::String )
3258 const QString
string = input.toString();
3259 if (
string.compare(
"ProjectCrs"_L1, Qt::CaseInsensitive ) == 0 )
3268 if ( qobject_cast< QgsMapLayer * >( qvariant_cast<QObject *>( input ) ) )
3271 if ( input.userType() != QMetaType::Type::QString || input.toString().isEmpty() )
3279 if ( !value.isValid() )
3282 if ( value.userType() == qMetaTypeId<QgsCoordinateReferenceSystem>() )
3285 return u
"QgsCoordinateReferenceSystem()"_s;
3290 if ( value.userType() == qMetaTypeId<QgsProperty>() )
3293 if ( value.type() == QVariant::String )
3295 const QString
string = value.toString();
3296 if (
string.compare(
"ProjectCrs"_L1, Qt::CaseInsensitive ) == 0 )
3305 p.insert(
name(), value );
3315 if ( value.type() == QVariant::String )
3317 const QString
string = value.toString();
3318 if (
string.compare(
"ProjectCrs"_L1, Qt::CaseInsensitive ) == 0 )
3331 if ( value.type() == QVariant::String )
3333 const QString
string = value.toString();
3334 if (
string.compare(
"ProjectCrs"_L1, Qt::CaseInsensitive ) == 0 )
3360 return QObject::tr(
"Invalid CRS" );
3378 if ( !input.isValid() )
3386 if ( input.userType() == qMetaTypeId<QgsProperty>() )
3391 if ( qobject_cast< QgsMapLayer * >( qvariant_cast<QObject *>( input ) ) )
3396 if ( input.userType() != QMetaType::Type::QString || input.toString().isEmpty() )
3414 if ( !val.isValid() )
3417 if ( val.userType() == qMetaTypeId<QgsProperty>() )
3421 p.insert(
name(), val );
3440 for (
const QString &raster : rasters )
3442 if ( !vectors.contains( raster ) )
3446 for (
const QString &mesh : meshFilters )
3448 if ( !vectors.contains( mesh ) )
3452 for (
const QString &pointCloud : pointCloudFilters )
3454 if ( !vectors.contains( pointCloud ) )
3455 vectors << pointCloud;
3457 vectors.removeAll( QObject::tr(
"All files (*.*)" ) );
3458 std::sort( vectors.begin(), vectors.end() );
3460 return QObject::tr(
"All files (*.*)" ) + u
";;"_s + vectors.join(
";;"_L1 );
3470 QString code = u
"##%1="_s.arg(
mName );
3472 code +=
"optional "_L1;
3473 code +=
"layer "_L1;
3480 code +=
"table "_L1;
3484 code +=
"hasgeometry "_L1;
3488 code +=
"point "_L1;
3496 code +=
"polygon "_L1;
3500 code +=
"raster "_L1;
3508 code +=
"plugin "_L1;
3512 code +=
"pointcloud "_L1;
3516 code +=
"annotation "_L1;
3520 code +=
"vectortile "_L1;
3524 code +=
"tiledscene "_L1;
3533 return code.trimmed();
3539 QString def = definition;
3542 if ( def.startsWith(
"table"_L1, Qt::CaseInsensitive ) )
3548 if ( def.startsWith(
"hasgeometry"_L1, Qt::CaseInsensitive ) )
3551 def = def.mid( 12 );
3554 else if ( def.startsWith(
"point"_L1, Qt::CaseInsensitive ) )
3560 else if ( def.startsWith(
"line"_L1, Qt::CaseInsensitive ) )
3566 else if ( def.startsWith(
"polygon"_L1, Qt::CaseInsensitive ) )
3572 else if ( def.startsWith(
"raster"_L1, Qt::CaseInsensitive ) )
3578 else if ( def.startsWith(
"mesh"_L1, Qt::CaseInsensitive ) )
3584 else if ( def.startsWith(
"plugin"_L1, Qt::CaseInsensitive ) )
3590 else if ( def.startsWith(
"pointcloud"_L1, Qt::CaseInsensitive ) )
3593 def = def.mid( 11 );
3596 else if ( def.startsWith(
"annotation"_L1, Qt::CaseInsensitive ) )
3599 def = def.mid( 11 );
3602 else if ( def.startsWith(
"vectortile"_L1, Qt::CaseInsensitive ) )
3605 def = def.mid( 11 );
3608 else if ( def.startsWith(
"tiledscene"_L1, Qt::CaseInsensitive ) )
3611 def = def.mid( 11 );
3622 switch ( outputType )
3628 code +=
", optional=True"_L1;
3635 QStringList options;
3639 code += u
", types=[%1])"_s.arg( options.join(
',' ) );
3660 map.insert( u
"data_types"_s, types );
3668 const QVariantList values = map.value( u
"data_types"_s ).toList();
3669 for (
const QVariant &val : values )
3688 if ( !input.isValid() )
3696 if ( input.userType() == qMetaTypeId<QgsProcessingFeatureSourceDefinition>() )
3700 else if ( input.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
3705 if ( input.userType() == qMetaTypeId<QgsProperty>() )
3710 if ( input.userType() == qMetaTypeId<QgsRectangle>() )
3715 if ( input.userType() == qMetaTypeId< QgsGeometry>() )
3719 if ( input.userType() == qMetaTypeId<QgsReferencedRectangle>() )
3726 if ( qobject_cast< QgsMapLayer * >( qvariant_cast<QObject *>( input ) ) )
3729 if ( input.userType() != QMetaType::Type::QString || input.toString().isEmpty() )
3732 if ( variantIsValidStringForExtent( input ) )
3745bool QgsProcessingParameterExtent::variantIsValidStringForExtent(
const QVariant &value )
3747 if ( value.userType() == QMetaType::Type::QString )
3749 const thread_local QRegularExpression rx( u
"^(.*?)\\s*,\\s*(.*?)\\s*,\\s*(.*?)\\s*,\\s*(.*?)\\s*(?:\\[(.*)\\])?\\s*$"_s );
3750 const QRegularExpressionMatch match = rx.match( value.toString() );
3751 if ( match.hasMatch() )
3753 bool xMinOk =
false;
3754 ( void ) match.captured( 1 ).toDouble( &xMinOk );
3755 bool xMaxOk =
false;
3756 ( void ) match.captured( 2 ).toDouble( &xMaxOk );
3757 bool yMinOk =
false;
3758 ( void ) match.captured( 3 ).toDouble( &yMinOk );
3759 bool yMaxOk =
false;
3760 ( void ) match.captured( 4 ).toDouble( &yMaxOk );
3761 if ( xMinOk && xMaxOk && yMinOk && yMaxOk )
3770 if ( !value.isValid() )
3773 if ( value.userType() == qMetaTypeId<QgsProperty>() )
3776 if ( value.userType() == qMetaTypeId<QgsRectangle>() )
3781 else if ( value.userType() == qMetaTypeId<QgsReferencedRectangle>() )
3786 else if ( value.userType() == qMetaTypeId< QgsGeometry>() )
3791 const QString wkt = g.
asWkt();
3792 return u
"QgsGeometry.fromWkt('%1')"_s.arg( wkt );
3795 else if ( variantIsValidStringForExtent( value ) )
3801 p.insert(
name(), value );
3811 if ( variantIsValidStringForExtent( value ) )
3813 return value.toString();
3821 if ( variantIsValidStringForExtent( value ) )
3846 if ( !input.isValid() )
3854 if ( input.userType() == qMetaTypeId<QgsProperty>() )
3859 if ( input.userType() == qMetaTypeId<QgsPointXY>() )
3863 if ( input.userType() == qMetaTypeId<QgsReferencedPointXY>() )
3867 if ( input.userType() == qMetaTypeId< QgsGeometry>() )
3872 if ( input.userType() == QMetaType::Type::QString )
3874 if ( input.toString().isEmpty() )
3878 const thread_local QRegularExpression rx( u
"^\\s*\\(?\\s*(.*?)\\s*,\\s*(.*?)\\s*(?:\\[(.*)\\])?\\s*\\)?\\s*$"_s );
3880 const QRegularExpressionMatch match = rx.match( input.toString() );
3881 if ( match.hasMatch() )
3884 ( void ) match.captured( 1 ).toDouble( &xOk );
3886 ( void ) match.captured( 2 ).toDouble( &yOk );
3895 if ( !value.isValid() )
3898 if ( value.userType() == qMetaTypeId<QgsProperty>() )
3901 if ( value.userType() == qMetaTypeId<QgsPointXY>() )
3906 else if ( value.userType() == qMetaTypeId<QgsReferencedPointXY>() )
3911 else if ( value.userType() == qMetaTypeId< QgsGeometry>() )
3916 const QString wkt = g.
asWkt();
3917 return u
"QgsGeometry.fromWkt('%1')"_s.arg( wkt );
3946 if ( !input.isValid() )
3954 if ( input.userType() == qMetaTypeId<QgsProperty>() )
3961 if ( input.userType() == qMetaTypeId< QgsGeometry>() )
3966 if ( input.userType() == qMetaTypeId<QgsReferencedGeometry>() )
3971 if ( input.userType() == qMetaTypeId<QgsPointXY>() )
3976 if ( input.userType() == qMetaTypeId<QgsRectangle>() )
3981 if ( input.userType() == qMetaTypeId<QgsReferencedPointXY>() )
3986 if ( input.userType() == qMetaTypeId<QgsReferencedRectangle>() )
3991 if ( input.userType() == QMetaType::Type::QString )
3993 if ( input.toString().isEmpty() )
3998 const thread_local QRegularExpression rx( u
"^\\s*(?:CRS=(.*);)?(.*?)$"_s );
4000 const QRegularExpressionMatch match = rx.match( input.toString() );
4001 if ( match.hasMatch() )
4006 return ( anyTypeAllowed || mGeomTypes.contains(
static_cast< int >( g.
type() ) ) ) && ( mAllowMultipart || !g.
isMultipart() );
4019 if ( !crs.isValid() )
4025 if ( !value.isValid() )
4028 if ( value.userType() == qMetaTypeId<QgsProperty>() )
4031 if ( value.userType() == qMetaTypeId< QgsGeometry>() )
4038 if ( value.userType() == qMetaTypeId<QgsReferencedGeometry>() )
4045 if ( value.userType() == qMetaTypeId<QgsPointXY>() )
4052 if ( value.userType() == qMetaTypeId<QgsReferencedPointXY>() )
4059 if ( value.userType() == qMetaTypeId<QgsRectangle>() )
4066 if ( value.userType() == qMetaTypeId<QgsReferencedRectangle>() )
4078 QString code = u
"##%1="_s.arg(
mName );
4080 code +=
"optional "_L1;
4081 code +=
type() +
' ';
4083 for (
const int type : mGeomTypes )
4088 code +=
"point "_L1;
4096 code +=
"polygon "_L1;
4100 code +=
"unknown "_L1;
4106 return code.trimmed();
4111 switch ( outputType )
4117 code +=
", optional=True"_L1;
4119 if ( !mGeomTypes.empty() )
4125 return u
"PointGeometry"_s;
4128 return u
"LineGeometry"_s;
4131 return u
"PolygonGeometry"_s;
4134 return u
"UnknownGeometry"_s;
4137 return u
"NullGeometry"_s;
4142 QStringList options;
4143 options.reserve( mGeomTypes.size() );
4144 for (
const int type : mGeomTypes )
4148 code += u
", geometryTypes=[%1 ]"_s.arg( options.join(
',' ) );
4151 if ( !mAllowMultipart )
4153 code +=
", allowMultipart=False"_L1;
4168 for (
const int type : mGeomTypes )
4172 map.insert( u
"geometrytypes"_s, types );
4173 map.insert( u
"multipart"_s, mAllowMultipart );
4181 const QVariantList values = map.value( u
"geometrytypes"_s ).toList();
4182 for (
const QVariant &val : values )
4184 mGeomTypes << val.toInt();
4186 mAllowMultipart = map.value( u
"multipart"_s ).toBool();
4200 if ( value.isValid() )
4202 if ( value.userType() == qMetaTypeId< QgsGeometry>() )
4208 else if ( value.userType() == qMetaTypeId<QgsReferencedGeometry>() )
4218 else if ( value.userType() == QMetaType::QString )
4230 return QObject::tr(
"Invalid geometry" );
4250 if ( !input.isValid() )
4258 if ( input.userType() == qMetaTypeId<QgsProperty>() )
4263 const QString
string = input.toString().trimmed();
4265 if ( input.userType() != QMetaType::Type::QString ||
string.isEmpty() )
4268 switch ( mBehavior )
4272 if ( !mExtension.isEmpty() )
4274 return string.endsWith( mExtension, Qt::CaseInsensitive );
4276 else if ( !mFileFilter.isEmpty() )
4294 QString code = u
"##%1="_s.arg(
mName );
4296 code +=
"optional "_L1;
4299 return code.trimmed();
4304 switch ( outputType )
4310 code +=
", optional=True"_L1;
4312 if ( !mExtension.isEmpty() )
4313 code += u
", extension='%1'"_s.arg( mExtension );
4314 if ( !mFileFilter.isEmpty() )
4315 code += u
", fileFilter='%1'"_s.arg( mFileFilter );
4326 switch ( mBehavior )
4330 if ( !mFileFilter.isEmpty() )
4331 return mFileFilter != QObject::tr(
"All files (*.*)" ) ? mFileFilter + u
";;"_s + QObject::tr(
"All files (*.*)" ) : mFileFilter;
4332 else if ( !mExtension.isEmpty() )
4333 return QObject::tr(
"%1 files" ).arg( mExtension.toUpper() ) + u
" (*."_s + mExtension.toLower() + u
");;"_s + QObject::tr(
"All files (*.*)" );
4335 return QObject::tr(
"All files (*.*)" );
4347 mFileFilter.clear();
4357 mFileFilter = filter;
4364 map.insert( u
"behavior"_s,
static_cast< int >( mBehavior ) );
4365 map.insert( u
"extension"_s, mExtension );
4366 map.insert( u
"filefilter"_s, mFileFilter );
4374 mExtension = map.value( u
"extension"_s ).toString();
4375 mFileFilter = map.value( u
"filefilter"_s ).toString();
4392 , mFixedNumberRows( fixedNumberRows )
4403 if ( !input.isValid() )
4411 if ( input.userType() == QMetaType::Type::QString )
4413 if ( input.toString().isEmpty() )
4417 else if ( input.userType() == QMetaType::Type::QVariantList )
4419 if ( input.toList().isEmpty() )
4423 else if ( input.userType() == QMetaType::Type::Double || input.userType() == QMetaType::Type::Int )
4433 if ( !value.isValid() )
4436 if ( value.userType() == qMetaTypeId<QgsProperty>() )
4440 p.insert(
name(), value );
4448 switch ( outputType )
4454 code +=
", optional=True"_L1;
4455 code += u
", numberRows=%1"_s.arg( mNumberRows );
4456 code += u
", hasFixedNumberRows=%1"_s.arg( mFixedNumberRows ? u
"True"_s : u
"False"_s );
4459 headers.reserve( mHeaders.size() );
4460 for (
const QString &h : mHeaders )
4462 code += u
", headers=[%1]"_s.arg(
headers.join(
',' ) );
4494 return mFixedNumberRows;
4499 mFixedNumberRows = fixedNumberRows;
4505 map.insert( u
"headers"_s, mHeaders );
4506 map.insert( u
"rows"_s, mNumberRows );
4507 map.insert( u
"fixed_number_rows"_s, mFixedNumberRows );
4514 mHeaders = map.value( u
"headers"_s ).toStringList();
4515 mNumberRows = map.value( u
"rows"_s ).toInt();
4516 mFixedNumberRows = map.value( u
"fixed_number_rows"_s ).toBool();
4538 if ( !input.isValid() )
4548 if ( qobject_cast< QgsMapLayer * >( qvariant_cast<QObject *>( input ) ) )
4554 if ( input.userType() == QMetaType::Type::QString )
4556 if ( input.toString().isEmpty() )
4559 if ( mMinimumNumberInputs > 1 )
4570 else if ( input.userType() == QMetaType::Type::QVariantList )
4572 if ( input.toList().count() < mMinimumNumberInputs )
4575 if ( mMinimumNumberInputs > input.toList().count() )
4583 const auto constToList = input.toList();
4584 for (
const QVariant &v : constToList )
4586 if ( qobject_cast< QgsMapLayer * >( qvariant_cast<QObject *>( v ) ) )
4595 else if ( input.userType() == QMetaType::Type::QStringList )
4597 if ( input.toStringList().count() < mMinimumNumberInputs )
4600 if ( mMinimumNumberInputs > input.toStringList().count() )
4608 const auto constToStringList = input.toStringList();
4609 for (
const QString &v : constToStringList )
4622 if ( !value.isValid() )
4625 if ( value.userType() == qMetaTypeId<QgsProperty>() )
4631 if ( value.userType() == QMetaType::Type::QStringList )
4633 const QStringList list = value.toStringList();
4634 parts.reserve( list.count() );
4635 for (
const QString &v : list )
4638 else if ( value.userType() == QMetaType::Type::QVariantList )
4640 const QVariantList list = value.toList();
4641 parts.reserve( list.count() );
4642 for (
const QVariant &v : list )
4645 if ( !parts.isEmpty() )
4646 return parts.join(
',' ).prepend(
'[' ).append(
']' );
4651 p.insert(
name(), value );
4653 if ( !list.isEmpty() )
4656 parts.reserve( list.count() );
4661 return parts.join(
',' ).prepend(
'[' ).append(
']' );
4680 QString code = u
"##%1="_s.arg(
mName );
4682 code +=
"optional "_L1;
4683 switch ( mLayerType )
4686 code +=
"multiple raster"_L1;
4690 code +=
"multiple file"_L1;
4694 code +=
"multiple vector"_L1;
4698 if (
mDefault.userType() == QMetaType::Type::QVariantList )
4701 const auto constToList =
mDefault.toList();
4702 for (
const QVariant &var : constToList )
4704 parts << var.toString();
4706 code += parts.join(
',' );
4708 else if (
mDefault.userType() == QMetaType::Type::QStringList )
4710 code +=
mDefault.toStringList().join(
',' );
4716 return code.trimmed();
4721 switch ( outputType )
4727 code +=
", optional=True"_L1;
4731 code += u
", layerType=%1"_s.arg(
layerType );
4742 switch ( mLayerType )
4745 return QObject::tr(
"All files (*.*)" );
4785 return mMinimumNumberInputs;
4797 map.insert( u
"layer_type"_s,
static_cast< int >( mLayerType ) );
4798 map.insert( u
"min_inputs"_s, mMinimumNumberInputs );
4806 mMinimumNumberInputs = map.value( u
"min_inputs"_s ).toInt();
4812 QString
type = definition;
4814 const thread_local QRegularExpression re( u
"(.*?)\\s+(.*)"_s );
4815 const QRegularExpressionMatch m = re.match( definition );
4818 type = m.captured( 1 ).toLower().trimmed();
4819 defaultVal = m.captured( 2 );
4822 if (
type ==
"vector"_L1 )
4824 else if (
type ==
"raster"_L1 )
4826 else if (
type ==
"file"_L1 )
4841 QgsMessageLog::logMessage( QObject::tr(
"Invalid number parameter \"%1\": min value %2 is >= max value %3!" ).arg(
name ).arg( mMin ).arg( mMax ), QObject::tr(
"Processing" ) );
4852 QVariant input = value;
4853 if ( !input.isValid() )
4861 if ( input.userType() == qMetaTypeId<QgsProperty>() )
4867 const double res = input.toDouble( &ok );
4871 return !( res < mMin || res > mMax );
4876 if ( !value.isValid() )
4879 if ( value.userType() == qMetaTypeId<QgsProperty>() )
4882 return value.toString();
4889 if ( mMin > std::numeric_limits<double>::lowest() + 1 )
4890 parts << QObject::tr(
"Minimum value: %1" ).arg( mMin );
4891 if ( mMax < std::numeric_limits<double>::max() )
4892 parts << QObject::tr(
"Maximum value: %1" ).arg( mMax );
4895 const QString extra = parts.join(
"<br />"_L1 );
4896 if ( !extra.isEmpty() )
4897 text += u
"<p>%1</p>"_s.arg( extra );
4903 switch ( outputType )
4909 code +=
", optional=True"_L1;
4913 if ( mMin != std::numeric_limits<double>::lowest() + 1 )
4914 code += u
", minValue=%1"_s.arg( mMin );
4915 if ( mMax != std::numeric_limits<double>::max() )
4916 code += u
", maxValue=%1"_s.arg( mMax );
4958 map.insert( u
"min"_s, mMin );
4959 map.insert( u
"max"_s, mMax );
4960 map.insert( u
"data_type"_s,
static_cast< int >( mDataType ) );
4967 mMin = map.value( u
"min"_s ).toDouble();
4968 mMax = map.value( u
"max"_s ).toDouble();
4991 if ( !input.isValid() )
4999 if ( input.userType() == qMetaTypeId<QgsProperty>() )
5004 if ( input.userType() == QMetaType::Type::QString )
5006 const QStringList list = input.toString().split(
',' );
5007 if ( list.count() != 2 )
5010 list.at( 0 ).toDouble( &ok );
5012 list.at( 1 ).toDouble( &ok2 );
5017 else if ( input.userType() == QMetaType::Type::QVariantList )
5019 if ( input.toList().count() != 2 )
5023 input.toList().at( 0 ).toDouble( &ok );
5025 input.toList().at( 1 ).toDouble( &ok2 );
5036 if ( !value.isValid() )
5039 if ( value.userType() == qMetaTypeId<QgsProperty>() )
5043 p.insert(
name(), value );
5046 QStringList stringParts;
5047 const auto constParts = parts;
5048 for (
const double v : constParts )
5050 stringParts << QString::number( v );
5052 return stringParts.join(
',' ).prepend(
'[' ).append(
']' );
5057 switch ( outputType )
5063 code +=
", optional=True"_L1;
5088 map.insert( u
"data_type"_s,
static_cast< int >( mDataType ) );
5116 if ( !input.isValid() )
5124 if ( input.userType() == qMetaTypeId<QgsProcessingRasterLayerDefinition>() )
5130 if ( input.userType() == qMetaTypeId<QgsProperty>() )
5143 if ( qobject_cast< QgsRasterLayer * >( qvariant_cast<QObject *>( input ) ) )
5146 if ( input.userType() != QMetaType::Type::QString || input.toString().isEmpty() )
5164 if ( !val.isValid() )
5167 if ( val.userType() == qMetaTypeId<QgsProperty>() )
5170 if ( val.userType() == qMetaTypeId<QgsProcessingRasterLayerDefinition>() )
5179 layerString = layer->source();
5183 return u
"QgsProcessingRasterLayerDefinition(%1, referenceScale=%2, dpi=%3)"_s
5195 return u
"QgsProcessingRasterLayerDefinition(QgsProperty.fromExpression(%1), referenceScale=%2, dpi=%3)"_s
5206 p.insert(
name(), val );
5233 mCapabilities = capabilities;
5238 return mCapabilities;
5257 QVariant input = value;
5258 if ( !input.isValid() )
5266 if ( input.userType() == qMetaTypeId<QgsProperty>() )
5271 if ( mUsesStaticStrings )
5273 if ( input.userType() == QMetaType::Type::QVariantList )
5275 if ( !mAllowMultiple )
5278 const QVariantList values = input.toList();
5282 for (
const QVariant &val : values )
5284 if ( !mOptions.contains( val.toString() ) )
5290 else if ( input.userType() == QMetaType::Type::QStringList )
5292 if ( !mAllowMultiple )
5295 const QStringList values = input.toStringList();
5300 if ( values.count() > 1 && !mAllowMultiple )
5303 for (
const QString &val : values )
5305 if ( !mOptions.contains( val ) )
5310 else if ( input.userType() == QMetaType::Type::QString )
5312 const QStringList parts = input.toString().split(
',' );
5313 if ( parts.count() > 1 && !mAllowMultiple )
5316 const auto constParts = parts;
5317 for (
const QString &part : constParts )
5319 if ( !mOptions.contains( part ) )
5327 if ( input.userType() == QMetaType::Type::QVariantList )
5329 if ( !mAllowMultiple )
5332 const QVariantList values = input.toList();
5336 for (
const QVariant &val : values )
5339 const int res = val.toInt( &ok );
5342 else if ( res < 0 || res >= mOptions.count() )
5348 else if ( input.userType() == QMetaType::Type::QString )
5350 const QStringList parts = input.toString().split(
',' );
5351 if ( parts.count() > 1 && !mAllowMultiple )
5354 const auto constParts = parts;
5355 for (
const QString &part : constParts )
5358 const int res = part.toInt( &ok );
5361 else if ( res < 0 || res >= mOptions.count() )
5366 else if ( input.userType() == QMetaType::Type::Int || input.userType() == QMetaType::Type::Double )
5369 const int res = input.toInt( &ok );
5372 else if ( res >= 0 && res < mOptions.count() )
5382 if ( !value.isValid() )
5385 if ( value.userType() == qMetaTypeId<QgsProperty>() )
5388 if ( mUsesStaticStrings )
5390 if ( value.userType() == QMetaType::Type::QVariantList || value.userType() == QMetaType::Type::QStringList )
5393 const QStringList constList = value.toStringList();
5394 for (
const QString &val : constList )
5398 return parts.join(
',' ).prepend(
'[' ).append(
']' );
5400 else if ( value.userType() == QMetaType::Type::QString )
5403 const QStringList constList = value.toString().split(
',' );
5404 if ( constList.count() > 1 )
5406 for (
const QString &val : constList )
5410 return parts.join(
',' ).prepend(
'[' ).append(
']' );
5418 if ( value.userType() == QMetaType::Type::QVariantList )
5421 const auto constToList = value.toList();
5422 for (
const QVariant &val : constToList )
5424 parts << QString::number( static_cast< int >( val.toDouble() ) );
5426 return parts.join(
',' ).prepend(
'[' ).append(
']' );
5428 else if ( value.userType() == QMetaType::Type::QString )
5430 const QStringList parts = value.toString().split(
',' );
5431 if ( parts.count() > 1 )
5433 return parts.join(
',' ).prepend(
'[' ).append(
']' );
5437 return QString::number(
static_cast< int >( value.toDouble() ) );
5443 if ( !value.isValid() )
5446 if ( value.userType() == qMetaTypeId<QgsProperty>() )
5449 if ( mUsesStaticStrings )
5455 if ( value.userType() == QMetaType::Type::QVariantList )
5458 const QVariantList toList = value.toList();
5459 parts.reserve( toList.size() );
5460 for (
const QVariant &val : toList )
5462 parts << mOptions.value(
static_cast< int >( val.toDouble() ) );
5464 return parts.join(
',' );
5466 else if ( value.userType() == QMetaType::Type::QString )
5468 const QStringList parts = value.toString().split(
',' );
5469 QStringList comments;
5470 if ( parts.count() > 1 )
5472 for (
const QString &part : parts )
5475 const int val = part.toInt( &ok );
5477 comments << mOptions.value( val );
5479 return comments.join(
',' );
5483 return mOptions.value(
static_cast< int >( value.toDouble() ) );
5489 QString code = u
"##%1="_s.arg(
mName );
5491 code +=
"optional "_L1;
5494 if ( mAllowMultiple )
5495 code +=
"multiple "_L1;
5497 if ( mUsesStaticStrings )
5498 code +=
"static "_L1;
5500 code += mOptions.join(
';' ) +
' ';
5503 return code.trimmed();
5508 switch ( outputType )
5514 code +=
", optional=True"_L1;
5517 options.reserve( mOptions.size() );
5518 for (
const QString &o : mOptions )
5520 code += u
", options=[%1]"_s.arg(
options.join(
',' ) );
5522 code += u
", allowMultiple=%1"_s.arg( mAllowMultiple ? u
"True"_s : u
"False"_s );
5524 code += u
", usesStaticStrings=%1"_s.arg( mUsesStaticStrings ? u
"True"_s : u
"False"_s );
5540 return options().value( value.toInt() );
5555 return mAllowMultiple;
5565 return mUsesStaticStrings;
5576 map.insert( u
"options"_s, mOptions );
5577 map.insert( u
"allow_multiple"_s, mAllowMultiple );
5578 map.insert( u
"uses_static_strings"_s, mUsesStaticStrings );
5585 mOptions = map.value( u
"options"_s ).toStringList();
5586 mAllowMultiple = map.value( u
"allow_multiple"_s ).toBool();
5587 mUsesStaticStrings = map.value( u
"uses_static_strings"_s ).toBool();
5594 QString def = definition;
5596 bool multiple =
false;
5597 if ( def.startsWith(
"multiple"_L1, Qt::CaseInsensitive ) )
5603 bool staticStrings =
false;
5604 if ( def.startsWith(
"static"_L1, Qt::CaseInsensitive ) )
5606 staticStrings =
true;
5610 const thread_local QRegularExpression re( u
"(.*)\\s+(.*?)$"_s );
5611 const QRegularExpressionMatch m = re.match( def );
5612 QString values = def;
5615 values = m.captured( 1 ).trimmed();
5616 defaultVal = m.captured( 2 );
5637 if ( value.userType() == qMetaTypeId<QgsProperty>() )
5640 const QString s = value.toString();
5646 QString code = u
"##%1="_s.arg(
mName );
5648 code +=
"optional "_L1;
5649 code +=
"string "_L1;
5655 return code.trimmed();
5660 switch ( outputType )
5666 code +=
", optional=True"_L1;
5667 code += u
", multiLine=%1"_s.arg( mMultiLine ? u
"True"_s : u
"False"_s );
5690 map.insert( u
"multiline"_s, mMultiLine );
5697 mMultiLine = map.value( u
"multiline"_s ).toBool();
5703 QString def = definition;
5705 if ( def.startsWith(
"long"_L1, Qt::CaseInsensitive ) )
5711 if ( def.startsWith(
'"' ) || def.startsWith(
'\'' ) )
5713 if ( def.endsWith(
'"' ) || def.endsWith(
'\'' ) )
5717 if ( def ==
"None"_L1 )
5738 if ( !value.isValid() )
5741 const QString s = value.toString();
5747 QString code = u
"##%1="_s.arg(
mName );
5749 code +=
"optional "_L1;
5750 code +=
"authcfg "_L1;
5753 return code.trimmed();
5758 QString def = definition;
5760 if ( def.startsWith(
'"' ) || def.startsWith(
'\'' ) )
5762 if ( def.endsWith(
'"' ) || def.endsWith(
'\'' ) )
5766 if ( def ==
"None"_L1 )
5782 , mExpressionType(
type )
5792 if ( !value.isValid() )
5795 if ( value.userType() == qMetaTypeId<QgsProperty>() )
5798 const QString s = value.toString();
5804 QStringList depends;
5805 if ( !mParentLayerParameterName.isEmpty() )
5806 depends << mParentLayerParameterName;
5812 switch ( outputType )
5818 code +=
", optional=True"_L1;
5820 code += u
", parentLayerParameterName='%1'"_s.arg( mParentLayerParameterName );
5826 switch ( mExpressionType )
5829 code +=
", type=Qgis.ExpressionType.PointCloud)"_L1;
5832 code +=
", type=Qgis.ExpressionType.RasterCalculator)"_L1;
5846 return mParentLayerParameterName;
5856 return mExpressionType;
5867 map.insert( u
"parent_layer"_s, mParentLayerParameterName );
5868 map.insert( u
"expression_type"_s,
static_cast< int >( mExpressionType ) );
5875 mParentLayerParameterName = map.value( u
"parent_layer"_s ).toString();
5876 mExpressionType =
static_cast< Qgis::ExpressionType >( map.value( u
"expression_type"_s ).toInt() );
5899 if ( !var.isValid() )
5907 if ( var.userType() == qMetaTypeId<QgsProperty>() )
5920 if ( qobject_cast< QgsVectorLayer * >( qvariant_cast<QObject *>( var ) ) )
5923 if ( var.userType() != QMetaType::Type::QString || var.toString().isEmpty() )
5941 if ( !val.isValid() )
5944 if ( val.userType() == qMetaTypeId<QgsProperty>() )
5948 p.insert(
name(), val );
5965 switch ( outputType )
5971 code +=
", optional=True"_L1;
5975 QStringList options;
5978 code += u
", types=[%1]"_s.arg( options.join(
',' ) );
6012 map.insert( u
"data_types"_s, types );
6020 const QVariantList values = map.value( u
"data_types"_s ).toList();
6021 for (
const QVariant &val : values )
6046 if ( !var.isValid() )
6054 if ( var.userType() == qMetaTypeId<QgsProperty>() )
6067 if ( qobject_cast< QgsMeshLayer * >( qvariant_cast<QObject *>( var ) ) )
6070 if ( var.userType() != QMetaType::Type::QString || var.toString().isEmpty() )
6088 if ( !val.isValid() )
6091 if ( val.userType() == qMetaTypeId<QgsProperty>() )
6095 p.insert(
name(), val );
6121 const QString &
name,
6146 if ( !input.isValid() )
6154 if ( input.userType() == qMetaTypeId<QgsProperty>() )
6159 if ( input.userType() == QMetaType::Type::QVariantList || input.userType() == QMetaType::Type::QStringList )
6161 if ( !mAllowMultiple )
6167 else if ( input.userType() == QMetaType::Type::QString )
6169 if ( input.toString().isEmpty() )
6172 const QStringList parts = input.toString().split(
';' );
6173 if ( parts.count() > 1 && !mAllowMultiple )
6178 if ( input.toString().isEmpty() )
6186 if ( !value.isValid() )
6189 if ( value.userType() == qMetaTypeId<QgsProperty>() )
6192 if ( value.userType() == QMetaType::Type::QVariantList )
6195 const auto constToList = value.toList();
6196 for (
const QVariant &val : constToList )
6200 return parts.join(
',' ).prepend(
'[' ).append(
']' );
6202 else if ( value.userType() == QMetaType::Type::QStringList )
6205 const auto constToStringList = value.toStringList();
6206 for (
const QString &s : constToStringList )
6210 return parts.join(
',' ).prepend(
'[' ).append(
']' );
6218 QString code = u
"##%1="_s.arg(
mName );
6220 code +=
"optional "_L1;
6221 code +=
"field "_L1;
6223 switch ( mDataType )
6226 code +=
"numeric "_L1;
6230 code +=
"string "_L1;
6234 code +=
"datetime "_L1;
6238 code +=
"binary "_L1;
6242 code +=
"boolean "_L1;
6249 if ( mAllowMultiple )
6250 code +=
"multiple "_L1;
6252 if ( mDefaultToAllFields )
6253 code +=
"default_to_all_fields "_L1;
6255 code += mParentLayerParameterName +
' ';
6258 return code.trimmed();
6263 switch ( outputType )
6269 code +=
", optional=True"_L1;
6272 switch ( mDataType )
6275 dataType = u
"QgsProcessingParameterField.Any"_s;
6279 dataType = u
"QgsProcessingParameterField.Numeric"_s;
6283 dataType = u
"QgsProcessingParameterField.String"_s;
6287 dataType = u
"QgsProcessingParameterField.DateTime"_s;
6291 dataType = u
"QgsProcessingParameterField.Binary"_s;
6295 dataType = u
"QgsProcessingParameterField.Boolean"_s;
6298 code += u
", type=%1"_s.arg(
dataType );
6300 code += u
", parentLayerParameterName='%1'"_s.arg( mParentLayerParameterName );
6301 code += u
", allowMultiple=%1"_s.arg( mAllowMultiple ? u
"True"_s : u
"False"_s );
6305 if ( mDefaultToAllFields )
6306 code +=
", defaultToAllFields=True"_L1;
6318 QStringList depends;
6319 if ( !mParentLayerParameterName.isEmpty() )
6320 depends << mParentLayerParameterName;
6326 return mParentLayerParameterName;
6346 return mAllowMultiple;
6356 return mDefaultToAllFields;
6361 mDefaultToAllFields = enabled;
6367 map.insert( u
"parent_layer"_s, mParentLayerParameterName );
6368 map.insert( u
"data_type"_s,
static_cast< int >( mDataType ) );
6369 map.insert( u
"allow_multiple"_s, mAllowMultiple );
6370 map.insert( u
"default_to_all_fields"_s, mDefaultToAllFields );
6377 mParentLayerParameterName = map.value( u
"parent_layer"_s ).toString();
6379 mAllowMultiple = map.value( u
"allow_multiple"_s ).toBool();
6380 mDefaultToAllFields = map.value( u
"default_to_all_fields"_s ).toBool();
6390 QString def = definition;
6392 if ( def.startsWith(
"numeric "_L1, Qt::CaseInsensitive ) )
6397 else if ( def.startsWith(
"string "_L1, Qt::CaseInsensitive ) )
6402 else if ( def.startsWith(
"datetime "_L1, Qt::CaseInsensitive ) )
6407 else if ( def.startsWith(
"binary "_L1, Qt::CaseInsensitive ) )
6412 else if ( def.startsWith(
"boolean "_L1, Qt::CaseInsensitive ) )
6418 if ( def.startsWith(
"multiple"_L1, Qt::CaseInsensitive ) )
6421 def = def.mid( 8 ).trimmed();
6424 if ( def.startsWith(
"default_to_all_fields"_L1, Qt::CaseInsensitive ) )
6427 def = def.mid( 21 ).trimmed();
6430 const thread_local QRegularExpression re( u
"(.*?)\\s+(.*)$"_s );
6431 const QRegularExpressionMatch m = re.match( def );
6434 parent = m.captured( 1 ).trimmed();
6435 def = m.captured( 2 );
6458 QVariant var = input;
6459 if ( !var.isValid() )
6467 if ( var.userType() == qMetaTypeId<QgsProcessingFeatureSourceDefinition>() )
6472 else if ( var.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
6479 if ( var.userType() == qMetaTypeId<QgsProperty>() )
6491 if ( qobject_cast< QgsVectorLayer * >( qvariant_cast<QObject *>( input ) ) )
6496 if ( var.userType() != QMetaType::Type::QString || var.toString().isEmpty() )
6514 if ( !value.isValid() )
6517 if ( value.userType() == qMetaTypeId<QgsProperty>() )
6520 if ( value.userType() == qMetaTypeId<QgsProcessingFeatureSourceDefinition>() )
6523 QString geometryCheckString;
6527 geometryCheckString = u
"QgsFeatureRequest.GeometryNoCheck"_s;
6531 geometryCheckString = u
"QgsFeatureRequest.GeometrySkipInvalid"_s;
6535 geometryCheckString = u
"QgsFeatureRequest.GeometryAbortOnInvalid"_s;
6542 flags << u
"QgsProcessingFeatureSourceDefinition.FlagOverrideDefaultGeometryCheck"_s;
6544 flags << u
"QgsProcessingFeatureSourceDefinition.FlagCreateIndividualOutputPerInputFeature"_s;
6545 if ( !
flags.empty() )
6546 flagString =
flags.join(
" | "_L1 );
6553 layerString = layer->source();
6557 return u
"QgsProcessingFeatureSourceDefinition(%1, selectedFeaturesOnly=%2, featureLimit=%3%4%6, geometryCheck=%5)"_s.arg(
6561 flagString.isEmpty() ? QString() : ( u
", flags=%1"_s.arg( flagString ) ),
6562 geometryCheckString,
6575 return u
"QgsProcessingFeatureSourceDefinition(QgsProperty.fromExpression(%1), selectedFeaturesOnly=%2, featureLimit=%3%4%6, geometryCheck=%5)"_s.arg(
6579 flagString.isEmpty() ? QString() : ( u
", flags=%1"_s.arg( flagString ) ),
6580 geometryCheckString,
6590 else if (
QgsVectorLayer *layer = qobject_cast< QgsVectorLayer * >( qvariant_cast<QObject *>( value ) ) )
6595 QString layerString = value.toString();
6599 layerString = layer->providerType() !=
"ogr"_L1 && layer->providerType() !=
"gdal"_L1 && layer->providerType() !=
"mdal"_L1
6618 QString code = u
"##%1="_s.arg(
mName );
6620 code +=
"optional "_L1;
6621 code +=
"source "_L1;
6628 code +=
"point "_L1;
6636 code +=
"polygon "_L1;
6645 return code.trimmed();
6650 switch ( outputType )
6656 code +=
", optional=True"_L1;
6660 QStringList options;
6664 code += u
", types=[%1]"_s.arg( options.join(
',' ) );
6692 map.insert( u
"data_types"_s, types );
6700 const QVariantList values = map.value( u
"data_types"_s ).toList();
6701 for (
const QVariant &val : values )
6711 QString def = definition;
6714 if ( def.startsWith(
"point"_L1, Qt::CaseInsensitive ) )
6720 else if ( def.startsWith(
"line"_L1, Qt::CaseInsensitive ) )
6726 else if ( def.startsWith(
"polygon"_L1, Qt::CaseInsensitive ) )
6753 QVariant var = input;
6754 if ( !var.isValid() )
6762 if ( var.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
6768 if ( var.userType() == qMetaTypeId<QgsProperty>() )
6781 if ( var.userType() != QMetaType::Type::QString )
6784 if ( var.toString().isEmpty() )
6792 if ( !value.isValid() )
6795 if ( value.userType() == qMetaTypeId<QgsProperty>() )
6798 if ( value.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
6807 return u
"QgsProperty.fromExpression('%1')"_s.arg( fromVar.
sink.
asExpression() );
6816 QString code = u
"##%1="_s.arg(
mName );
6818 code +=
"optional "_L1;
6821 switch ( mDataType )
6824 code +=
"point "_L1;
6832 code +=
"polygon "_L1;
6836 code +=
"table "_L1;
6844 return code.trimmed();
6856 return lOriginalProvider->defaultVectorFileExtension(
hasGeometry() );
6860 return p->defaultVectorFileExtension(
hasGeometry() );
6877 switch ( outputType )
6883 code +=
", optional=True"_L1;
6887 code += u
", createByDefault=%1"_s.arg(
createByDefault() ? u
"True"_s : u
"False"_s );
6888 if ( mSupportsAppend )
6889 code +=
", supportsAppend=True"_L1;
6902 QStringList filters;
6903 for (
const QString &ext : exts )
6905 filters << QObject::tr(
"%1 files (*.%2)" ).arg( ext.toUpper(), ext.toLower() );
6907 return filters.join(
";;"_L1 ) + u
";;"_s + QObject::tr(
"All files (*.*)" );
6915 return lOriginalProvider->supportedOutputVectorLayerExtensions();
6917 return lOriginalProvider->supportedOutputTableExtensions();
6922 return p->supportedOutputVectorLayerExtensions();
6924 return p->supportedOutputTableExtensions();
6939 switch ( mDataType )
6970 map.insert( u
"data_type"_s,
static_cast< int >( mDataType ) );
6971 map.insert( u
"supports_append"_s, mSupportsAppend );
6979 mSupportsAppend = map.value( u
"supports_append"_s,
false ).toBool();
6994 QString def = definition;
6995 if ( def.startsWith(
"point"_L1, Qt::CaseInsensitive ) )
7000 else if ( def.startsWith(
"line"_L1, Qt::CaseInsensitive ) )
7005 else if ( def.startsWith(
"polygon"_L1, Qt::CaseInsensitive ) )
7010 else if ( def.startsWith(
"table"_L1, Qt::CaseInsensitive ) )
7021 return mSupportsAppend;
7040 QVariant var = input;
7041 if ( !var.isValid() )
7049 if ( var.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
7055 if ( var.userType() == qMetaTypeId<QgsProperty>() )
7068 if ( var.userType() != QMetaType::Type::QString )
7071 if ( var.toString().isEmpty() )
7079 if ( !value.isValid() )
7082 if ( value.userType() == qMetaTypeId<QgsProperty>() )
7085 if ( value.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
7094 return u
"QgsProperty.fromExpression('%1')"_s.arg( fromVar.
sink.
asExpression() );
7110 return lOriginalProvider->defaultRasterFileFormat();
7114 return p->defaultRasterFileFormat();
7126 if ( !extensions.isEmpty() )
7127 return extensions[0];
7134 QStringList filters;
7139 for (
const QPair<QString, QString> &formatAndExt : std::as_const( formatAndExtensions ) )
7141 QString format = formatAndExt.first;
7142 const QString &extension = formatAndExt.second;
7143 if ( format.isEmpty() )
7145 filters << QObject::tr(
"%1 files (*.%2)" ).arg( format.toUpper(), extension.toLower() );
7148 return filters.join(
";;"_L1 ) + u
";;"_s + QObject::tr(
"All files (*.*)" );
7154 QSet< QString > extensions;
7155 for (
const QPair<QString, QString> &formatAndExt : std::as_const( formatAndExtensions ) )
7157 extensions.insert( formatAndExt.second );
7159 return QStringList( extensions.constBegin(), extensions.constEnd() );
7166 return lOriginalProvider->supportedOutputRasterLayerFormatAndExtensions();
7170 return p->supportedOutputRasterLayerFormatAndExtensions();
7198 QVariant var = input;
7199 if ( !var.isValid() )
7207 if ( var.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
7213 if ( var.userType() == qMetaTypeId<QgsProperty>() )
7226 if ( var.userType() != QMetaType::Type::QString )
7229 if ( var.toString().isEmpty() )
7239 if ( !value.isValid() )
7242 if ( value.userType() == qMetaTypeId<QgsProperty>() )
7245 if ( value.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
7254 return u
"QgsProperty.fromExpression('%1')"_s.arg( fromVar.
sink.
asExpression() );
7263 if ( !mFileFilter.isEmpty() && mFileFilter.contains( u
"htm"_s, Qt::CaseInsensitive ) )
7275 if ( mFileFilter.isEmpty() || mFileFilter == QObject::tr(
"All files (*.*)" ) )
7279 const thread_local QRegularExpression rx( u
".*?\\(\\*\\.([a-zA-Z0-9._]+).*"_s );
7280 const QRegularExpressionMatch match = rx.match( mFileFilter );
7281 if ( !match.hasMatch() )
7284 return match.captured( 1 );
7289 switch ( outputType )
7295 code +=
", optional=True"_L1;
7299 code += u
", createByDefault=%1"_s.arg(
createByDefault() ? u
"True"_s : u
"False"_s );
7311 return (
fileFilter().isEmpty() ? QString() :
fileFilter() + u
";;"_s ) + QObject::tr(
"All files (*.*)" );
7327 map.insert( u
"file_filter"_s, mFileFilter );
7334 mFileFilter = map.value( u
"file_filter"_s ).toString();
7354 QVariant var = input;
7355 if ( !var.isValid() )
7363 if ( var.userType() == qMetaTypeId<QgsProperty>() )
7376 if ( var.userType() != QMetaType::Type::QString )
7379 if ( var.toString().isEmpty() )
7408 map.insert( u
"supports_non_file_outputs"_s, mSupportsNonFileBasedOutputs );
7409 map.insert( u
"create_by_default"_s, mCreateByDefault );
7416 mSupportsNonFileBasedOutputs = map.value( u
"supports_non_file_outputs"_s ).toBool();
7417 mCreateByDefault = map.value( u
"create_by_default"_s, u
"1"_s ).toBool();
7423 switch ( outputType )
7432 code +=
", optional=True"_L1;
7434 code += u
", createByDefault=%1"_s.arg( mCreateByDefault ? u
"True"_s : u
"False"_s );
7456 const thread_local QRegularExpression rx( u
"[.]"_s );
7457 QString sanitizedName =
name();
7458 sanitizedName.replace( rx, u
"_"_s );
7473 return lOriginalProvider->isSupportedOutputValue( value,
this, context, error );
7482 return mCreateByDefault;
7504 QVariant var = input;
7505 if ( !var.isValid() )
7513 if ( var.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
7519 if ( var.userType() == qMetaTypeId<QgsProperty>() )
7532 if ( var.userType() != QMetaType::Type::QString )
7535 if ( var.toString().isEmpty() )
7543 if ( !value.isValid() )
7546 if ( value.userType() == qMetaTypeId<QgsProperty>() )
7549 if ( value.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
7558 return u
"QgsProperty.fromExpression('%1')"_s.arg( fromVar.
sink.
asExpression() );
7567 QString code = u
"##%1="_s.arg(
mName );
7569 code +=
"optional "_L1;
7570 code +=
"vectorDestination "_L1;
7572 switch ( mDataType )
7575 code +=
"point "_L1;
7583 code +=
"polygon "_L1;
7591 return code.trimmed();
7603 return lOriginalProvider->defaultVectorFileExtension(
hasGeometry() );
7607 return p->defaultVectorFileExtension(
hasGeometry() );
7624 switch ( outputType )
7630 code +=
", optional=True"_L1;
7634 code += u
", createByDefault=%1"_s.arg(
createByDefault() ? u
"True"_s : u
"False"_s );
7647 QStringList filters;
7648 for (
const QString &ext : exts )
7650 filters << QObject::tr(
"%1 files (*.%2)" ).arg( ext.toUpper(), ext.toLower() );
7652 return filters.join(
";;"_L1 ) + u
";;"_s + QObject::tr(
"All files (*.*)" );
7660 return lOriginalProvider->supportedOutputVectorLayerExtensions();
7662 return lOriginalProvider->supportedOutputTableExtensions();
7667 return p->supportedOutputVectorLayerExtensions();
7669 return p->supportedOutputTableExtensions();
7684 switch ( mDataType )
7715 map.insert( u
"data_type"_s,
static_cast< int >( mDataType ) );
7729 QString def = definition;
7730 if ( def.startsWith(
"point"_L1, Qt::CaseInsensitive ) )
7735 else if ( def.startsWith(
"line"_L1, Qt::CaseInsensitive ) )
7740 else if ( def.startsWith(
"polygon"_L1, Qt::CaseInsensitive ) )
7764 QVariant input = value;
7765 if ( !input.isValid() )
7773 if ( input.userType() == qMetaTypeId<QgsProperty>() )
7778 if ( input.userType() == QMetaType::Type::QVariantList || input.userType() == QMetaType::Type::QStringList )
7780 if ( !mAllowMultiple )
7789 const double res = input.toInt( &ok );
7799 return mAllowMultiple;
7809 if ( !value.isValid() )
7812 if ( value.userType() == qMetaTypeId<QgsProperty>() )
7815 if ( value.userType() == QMetaType::Type::QVariantList )
7818 const QVariantList values = value.toList();
7819 for (
auto it = values.constBegin(); it != values.constEnd(); ++it )
7821 parts << QString::number( static_cast< int >( it->toDouble() ) );
7823 return parts.join(
',' ).prepend(
'[' ).append(
']' );
7825 else if ( value.userType() == QMetaType::Type::QStringList )
7828 const QStringList values = value.toStringList();
7829 for (
auto it = values.constBegin(); it != values.constEnd(); ++it )
7831 parts << QString::number( static_cast< int >( it->toDouble() ) );
7833 return parts.join(
',' ).prepend(
'[' ).append(
']' );
7836 return value.toString();
7841 QString code = u
"##%1="_s.arg(
mName );
7843 code +=
"optional "_L1;
7846 if ( mAllowMultiple )
7847 code +=
"multiple "_L1;
7849 code += mParentLayerParameterName +
' ';
7852 return code.trimmed();
7857 QStringList depends;
7858 if ( !mParentLayerParameterName.isEmpty() )
7859 depends << mParentLayerParameterName;
7865 switch ( outputType )
7871 code +=
", optional=True"_L1;
7873 code += u
", parentLayerParameterName='%1'"_s.arg( mParentLayerParameterName );
7874 code += u
", allowMultiple=%1"_s.arg( mAllowMultiple ? u
"True"_s : u
"False"_s );
7886 return mParentLayerParameterName;
7897 map.insert( u
"parent_layer"_s, mParentLayerParameterName );
7898 map.insert( u
"allow_multiple"_s, mAllowMultiple );
7905 mParentLayerParameterName = map.value( u
"parent_layer"_s ).toString();
7906 mAllowMultiple = map.value( u
"allow_multiple"_s ).toBool();
7913 QString def = definition;
7916 if ( def.startsWith(
"multiple"_L1, Qt::CaseInsensitive ) )
7919 def = def.mid( 8 ).trimmed();
7922 const thread_local QRegularExpression re( u
"(.*?)\\s+(.*)$"_s );
7923 const QRegularExpressionMatch m = re.match( def );
7926 parent = m.captured( 1 ).trimmed();
7927 def = m.captured( 2 );
7961 QStringList depends;
7962 if ( !mParentParameterName.isEmpty() )
7963 depends << mParentParameterName;
7969 switch ( outputType )
7975 code +=
", optional=True"_L1;
7977 code += u
", parentParameterName='%1'"_s.arg( mParentParameterName );
7979 if (
minimum() != std::numeric_limits<double>::lowest() + 1 )
7980 code += u
", minValue=%1"_s.arg(
minimum() );
7981 if (
maximum() != std::numeric_limits<double>::max() )
7982 code += u
", maxValue=%1"_s.arg(
maximum() );
7993 return mParentParameterName;
8004 map.insert( u
"parent"_s, mParentParameterName );
8005 map.insert( u
"default_unit"_s,
static_cast< int >( mDefaultUnit ) );
8012 mParentParameterName = map.value( u
"parent"_s ).toString();
8050 QStringList depends;
8051 if ( !mParentParameterName.isEmpty() )
8052 depends << mParentParameterName;
8058 switch ( outputType )
8064 code +=
", optional=True"_L1;
8066 code += u
", parentParameterName='%1'"_s.arg( mParentParameterName );
8069 code += u
", minValue=%1"_s.arg(
minimum() );
8070 if (
maximum() != std::numeric_limits<double>::max() )
8071 code += u
", maxValue=%1"_s.arg(
maximum() );
8082 return mParentParameterName;
8093 map.insert( u
"parent"_s, mParentParameterName );
8101 mParentParameterName = map.value( u
"parent"_s ).toString();
8139 QStringList depends;
8140 if ( !mParentParameterName.isEmpty() )
8141 depends << mParentParameterName;
8147 switch ( outputType )
8153 code +=
", optional=True"_L1;
8155 code += u
", parentParameterName='%1'"_s.arg( mParentParameterName );
8158 code += u
", minValue=%1"_s.arg(
minimum() );
8159 if (
maximum() != std::numeric_limits<double>::max() )
8160 code += u
", maxValue=%1"_s.arg(
maximum() );
8171 return mParentParameterName;
8182 map.insert( u
"parent"_s, mParentParameterName );
8190 mParentParameterName = map.value( u
"parent"_s ).toString();
8223 switch ( outputType )
8229 code +=
", optional=True"_L1;
8231 if (
minimum() != std::numeric_limits<double>::lowest() + 1 )
8232 code += u
", minValue=%1"_s.arg(
minimum() );
8233 if (
maximum() != std::numeric_limits<double>::max() )
8234 code += u
", maxValue=%1"_s.arg(
maximum() );
8246 map.insert( u
"default_unit"_s,
static_cast< int >( mDefaultUnit ) );
8286 switch ( outputType )
8292 code +=
", optional=True"_L1;
8325 if ( value.userType() == qMetaTypeId<QgsProperty>() )
8328 const QString s = value.toString();
8334 QString code = u
"##%1="_s.arg(
mName );
8336 code +=
"optional "_L1;
8337 code +=
"layout "_L1;
8340 return code.trimmed();
8345 switch ( outputType )
8351 code +=
", optional=True"_L1;
8362 QString def = definition;
8364 if ( def.startsWith(
'"' ) || def.startsWith(
'\'' ) )
8366 if ( def.endsWith(
'"' ) || def.endsWith(
'\'' ) )
8370 if ( def ==
"None"_L1 )
8399 if ( value.userType() == qMetaTypeId<QgsProperty>() )
8402 const QString s = value.toString();
8408 QString code = u
"##%1="_s.arg(
mName );
8410 code +=
"optional "_L1;
8411 code +=
"layoutitem "_L1;
8412 if ( mItemType >= 0 )
8413 code += QString::number( mItemType ) +
' ';
8415 code += mParentLayoutParameterName +
' ';
8418 return code.trimmed();
8423 switch ( outputType )
8429 code +=
", optional=True"_L1;
8431 if ( mItemType >= 0 )
8432 code += u
", itemType=%1"_s.arg( mItemType );
8434 code += u
", parentLayoutParameterName='%1'"_s.arg( mParentLayoutParameterName );
8447 map.insert( u
"parent_layout"_s, mParentLayoutParameterName );
8448 map.insert( u
"item_type"_s, mItemType );
8455 mParentLayoutParameterName = map.value( u
"parent_layout"_s ).toString();
8456 mItemType = map.value( u
"item_type"_s ).toInt();
8462 QStringList depends;
8463 if ( !mParentLayoutParameterName.isEmpty() )
8464 depends << mParentLayoutParameterName;
8471 QString def = definition;
8473 const thread_local QRegularExpression re( u
"(\\d+)?\\s*(.*?)\\s+(.*)$"_s );
8474 const QRegularExpressionMatch m = re.match( def );
8477 itemType = m.captured( 1 ).trimmed().isEmpty() ? -1 : m.captured( 1 ).trimmed().toInt();
8478 parent = m.captured( 2 ).trimmed().isEmpty() ? m.captured( 3 ).trimmed() : m.captured( 2 ).trimmed();
8479 def = !m.captured( 2 ).trimmed().isEmpty() ? m.captured( 3 ) : QString();
8492 return mParentLayoutParameterName;
8497 mParentLayoutParameterName =
name;
8529 if ( value.userType() == qMetaTypeId<QgsProperty>() )
8532 if ( value.canConvert< QColor >() && !value.value< QColor >().isValid() )
8533 return u
"QColor()"_s;
8535 if ( value.canConvert< QColor >() )
8537 const QColor
c = value.value< QColor >();
8538 if ( !mAllowOpacity ||
c.alpha() == 255 )
8539 return u
"QColor(%1, %2, %3)"_s.arg(
c.red() ).arg(
c.green() ).arg(
c.blue() );
8541 return u
"QColor(%1, %2, %3, %4)"_s.arg(
c.red() ).arg(
c.green() ).arg(
c.blue() ).arg(
c.alpha() );
8544 const QString s = value.toString();
8550 QString code = u
"##%1="_s.arg(
mName );
8552 code +=
"optional "_L1;
8553 code +=
"color "_L1;
8555 if ( mAllowOpacity )
8556 code +=
"withopacity "_L1;
8559 return code.trimmed();
8564 switch ( outputType )
8570 code +=
", optional=True"_L1;
8572 code += u
", opacityEnabled=%1"_s.arg( mAllowOpacity ? u
"True"_s : u
"False"_s );
8584 if ( !input.isValid() && (
mDefault.isValid() && ( !
mDefault.toString().isEmpty() ||
mDefault.value< QColor >().isValid() ) ) )
8587 if ( !input.isValid() )
8590 if ( input.userType() == QMetaType::Type::QColor )
8594 else if ( input.userType() == qMetaTypeId<QgsProperty>() )
8599 if ( input.userType() != QMetaType::Type::QString || input.toString().isEmpty() )
8602 bool containsAlpha =
false;
8609 map.insert( u
"opacityEnabled"_s, mAllowOpacity );
8616 mAllowOpacity = map.value( u
"opacityEnabled"_s ).toBool();
8622 return mAllowOpacity;
8627 mAllowOpacity = enabled;
8632 QString def = definition;
8634 bool allowOpacity =
false;
8635 if ( def.startsWith(
"withopacity"_L1, Qt::CaseInsensitive ) )
8637 allowOpacity =
true;
8638 def = def.mid( 12 );
8641 if ( def.startsWith(
'"' ) || def.startsWith(
'\'' ) )
8643 if ( def.endsWith(
'"' ) || def.endsWith(
'\'' ) )
8647 if ( def ==
"None"_L1 || def.isEmpty() )
8657 const QString &
name,
8662 const QVariant &staticSourceCrs,
8663 const QVariant &staticDestinationCrs,
8669 , mSourceCrs( staticSourceCrs )
8670 , mDestCrs( staticDestinationCrs )
8680 return valueAsPythonStringPrivate( value, context,
false );
8683QString QgsProcessingParameterCoordinateOperation::valueAsPythonStringPrivate(
const QVariant &value,
QgsProcessingContext &context,
bool allowNonStringValues )
const
8688 if ( allowNonStringValues && value.userType() == qMetaTypeId<QgsCoordinateReferenceSystem>() )
8691 return u
"QgsCoordinateReferenceSystem()"_s;
8696 if ( value.userType() == qMetaTypeId<QgsProperty>() )
8697 return u
"QgsProperty.fromExpression('%1')"_s.arg( value.value< QgsProperty >().asExpression() );
8699 if ( allowNonStringValues )
8702 p.insert(
name(), value );
8708 const QString s = value.toString();
8714 QString code = u
"##%1="_s.arg(
mName );
8716 code +=
"optional "_L1;
8717 code +=
"coordinateoperation "_L1;
8720 return code.trimmed();
8725 switch ( outputType )
8732 code +=
", optional=True"_L1;
8733 if ( !mSourceParameterName.isEmpty() )
8734 code += u
", sourceCrsParameterName=%1"_s.arg( valueAsPythonStringPrivate( mSourceParameterName,
c,
false ) );
8735 if ( !mDestParameterName.isEmpty() )
8736 code += u
", destinationCrsParameterName=%1"_s.arg( valueAsPythonStringPrivate( mDestParameterName,
c,
false ) );
8738 if ( mSourceCrs.isValid() )
8739 code += u
", staticSourceCrs=%1"_s.arg( valueAsPythonStringPrivate( mSourceCrs,
c,
true ) );
8740 if ( mDestCrs.isValid() )
8741 code += u
", staticDestinationCrs=%1"_s.arg( valueAsPythonStringPrivate( mDestCrs,
c,
true ) );
8743 code += u
", defaultValue=%1)"_s.arg( valueAsPythonStringPrivate(
mDefault,
c,
false ) );
8753 if ( !mSourceParameterName.isEmpty() )
8754 res << mSourceParameterName;
8755 if ( !mDestParameterName.isEmpty() )
8756 res << mDestParameterName;
8763 map.insert( u
"source_crs_parameter_name"_s, mSourceParameterName );
8764 map.insert( u
"dest_crs_parameter_name"_s, mDestParameterName );
8765 map.insert( u
"static_source_crs"_s, mSourceCrs );
8766 map.insert( u
"static_dest_crs"_s, mDestCrs );
8773 mSourceParameterName = map.value( u
"source_crs_parameter_name"_s ).toString();
8774 mDestParameterName = map.value( u
"dest_crs_parameter_name"_s ).toString();
8775 mSourceCrs = map.value( u
"static_source_crs"_s );
8776 mDestCrs = map.value( u
"static_dest_crs"_s );
8782 QString def = definition;
8784 if ( def.startsWith(
'"' ) )
8787 if ( def.endsWith(
'"' ) )
8790 else if ( def.startsWith(
'\'' ) )
8793 if ( def.endsWith(
'\'' ) )
8798 if ( def ==
"None"_L1 )
8821 if ( !input.isValid() && !
mDefault.isValid() )
8824 if ( ( input.userType() == QMetaType::Type::QString && input.toString().isEmpty() ) || ( !input.isValid() &&
mDefault.userType() == QMetaType::Type::QString &&
mDefault.toString().isEmpty() ) )
8832 if ( !value.isValid() )
8835 if ( value.userType() == qMetaTypeId<QgsProperty>() )
8843 QString code = u
"##%1="_s.arg(
mName );
8845 code +=
"optional "_L1;
8846 code +=
"maptheme "_L1;
8849 return code.trimmed();
8854 switch ( outputType )
8860 code +=
", optional=True"_L1;
8885 QString def = definition;
8886 if ( def.startsWith(
'"' ) || def.startsWith(
'\'' ) )
8888 if ( def.endsWith(
'"' ) || def.endsWith(
'\'' ) )
8912 if ( mMin.isValid() && mMax.isValid() && mMin >= mMax )
8914 QgsMessageLog::logMessage( QObject::tr(
"Invalid datetime parameter \"%1\": min value %2 is >= max value %3!" ).arg( name, mMin.toString(), mMax.toString() ), QObject::tr(
"Processing" ) );
8925 QVariant input = value;
8926 if ( !input.isValid() )
8934 if ( input.userType() == qMetaTypeId<QgsProperty>() )
8939 if ( input.userType() != QMetaType::Type::QDateTime && input.userType() != QMetaType::Type::QDate && input.userType() != QMetaType::Type::QTime && input.userType() != QMetaType::Type::QString )
8945 if ( input.userType() == QMetaType::Type::QString )
8947 const QString s = input.toString();
8951 input = QDateTime::fromString( s, Qt::ISODate );
8954 if ( !input.toDateTime().isValid() )
8955 input = QTime::fromString( s );
8957 input = input.toDateTime().time();
8963 const QDateTime res = input.toDateTime();
8964 return res.isValid() && ( res >= mMin || !mMin.isValid() ) && ( res <= mMax || !mMax.isValid() );
8968 const QTime res = input.toTime();
8969 return res.isValid() && ( res >= mMin.time() || !mMin.isValid() ) && ( res <= mMax.time() || !mMax.isValid() );
8975 if ( !value.isValid() )
8978 if ( value.userType() == qMetaTypeId<QgsProperty>() )
8981 if ( value.userType() == QMetaType::Type::QDateTime )
8983 const QDateTime dt = value.toDateTime();
8984 if ( !dt.isValid() )
8985 return u
"QDateTime()"_s;
8987 return u
"QDateTime(QDate(%1, %2, %3), QTime(%4, %5, %6))"_s.arg( dt.date().year() )
8988 .arg( dt.date().month() )
8989 .arg( dt.date().day() )
8990 .arg( dt.time().hour() )
8991 .arg( dt.time().minute() )
8992 .arg( dt.time().second() );
8994 else if ( value.userType() == QMetaType::Type::QDate )
8996 const QDate dt = value.toDate();
8997 if ( !dt.isValid() )
8998 return u
"QDate()"_s;
9000 return u
"QDate(%1, %2, %3)"_s.arg( dt.year() ).arg( dt.month() ).arg( dt.day() );
9002 else if ( value.userType() == QMetaType::Type::QTime )
9004 const QTime dt = value.toTime();
9005 if ( !dt.isValid() )
9006 return u
"QTime()"_s;
9008 return u
"QTime(%4, %5, %6)"_s.arg( dt.hour() ).arg( dt.minute() ).arg( dt.second() );
9010 return value.toString();
9017 if ( mMin.isValid() )
9018 parts << QObject::tr(
"Minimum value: %1" ).arg( mMin.toString( Qt::ISODate ) );
9019 if ( mMax.isValid() )
9020 parts << QObject::tr(
"Maximum value: %1" ).arg( mMax.toString( Qt::ISODate ) );
9022 parts << QObject::tr(
"Default value: %1" )
9025 ?
mDefault.toDateTime().toString( Qt::ISODate )
9028 const QString extra = parts.join(
"<br />"_L1 );
9029 if ( !extra.isEmpty() )
9030 text += u
"<p>%1</p>"_s.arg( extra );
9036 switch ( outputType )
9042 code +=
", optional=True"_L1;
9044 code += u
", type=%1"_s.arg(
9047 : u
"QgsProcessingParameterDateTime.Time"_s
9051 if ( mMin.isValid() )
9053 if ( mMax.isValid() )
9095 map.insert( u
"min"_s, mMin );
9096 map.insert( u
"max"_s, mMax );
9097 map.insert( u
"data_type"_s,
static_cast< int >( mDataType ) );
9104 mMin = map.value( u
"min"_s ).toDateTime();
9105 mMax = map.value( u
"max"_s ).toDateTime();
9121 if ( value.userType() == QMetaType::Type::QDateTime )
9123 const QDateTime dt = value.toDateTime();
9124 if ( !dt.isValid() )
9125 return QObject::tr(
"Invalid datetime" );
9127 return dt.toString( Qt::ISODate );
9130 else if ( value.userType() == QMetaType::Type::QDate )
9132 const QDate dt = value.toDate();
9133 if ( !dt.isValid() )
9134 return QObject::tr(
"Invalid date" );
9136 return dt.toString( Qt::ISODate );
9139 else if ( value.userType() == QMetaType::Type::QTime )
9141 const QTime dt = value.toTime();
9142 if ( !dt.isValid() )
9143 return QObject::tr(
"Invalid time" );
9145 return dt.toString( Qt::ISODate );
9148 return value.toString();
9168 if ( !input.isValid() && !
mDefault.isValid() )
9171 if ( ( input.userType() == QMetaType::Type::QString && input.toString().isEmpty() ) || ( !input.isValid() &&
mDefault.userType() == QMetaType::Type::QString &&
mDefault.toString().isEmpty() ) )
9179 if ( !value.isValid() )
9182 if ( value.userType() == qMetaTypeId<QgsProperty>() )
9190 QString code = u
"##%1="_s.arg(
mName );
9192 code +=
"optional "_L1;
9193 code +=
"providerconnection "_L1;
9194 code += mProviderId +
' ';
9197 return code.trimmed();
9202 switch ( outputType )
9208 code +=
", optional=True"_L1;
9222 map.insert( u
"provider"_s, mProviderId );
9229 mProviderId = map.value( u
"provider"_s ).toString();
9235 QString def = definition;
9237 if ( def.contains(
' ' ) )
9239 provider = def.left( def.indexOf(
' ' ) );
9240 def = def.mid( def.indexOf(
' ' ) + 1 );
9248 if ( def.startsWith(
'"' ) || def.startsWith(
'\'' ) )
9250 if ( def.endsWith(
'"' ) || def.endsWith(
'\'' ) )
9267 const QString &
name,
const QString &
description,
const QString &parentLayerParameterName,
const QVariant &
defaultValue,
bool optional
9270 , mParentConnectionParameterName( parentLayerParameterName )
9281 if ( !input.isValid() && !
mDefault.isValid() )
9284 if ( ( input.userType() == QMetaType::Type::QString && input.toString().isEmpty() ) || ( !input.isValid() &&
mDefault.userType() == QMetaType::Type::QString &&
mDefault.toString().isEmpty() ) )
9292 if ( !value.isValid() )
9295 if ( value.userType() == qMetaTypeId<QgsProperty>() )
9303 QString code = u
"##%1="_s.arg(
mName );
9305 code +=
"optional "_L1;
9306 code +=
"databaseschema "_L1;
9308 code += mParentConnectionParameterName +
' ';
9311 return code.trimmed();
9316 switch ( outputType )
9322 code +=
", optional=True"_L1;
9324 code += u
", connectionParameterName='%1'"_s.arg( mParentConnectionParameterName );
9338 QStringList depends;
9339 if ( !mParentConnectionParameterName.isEmpty() )
9340 depends << mParentConnectionParameterName;
9346 return mParentConnectionParameterName;
9351 mParentConnectionParameterName =
name;
9357 map.insert( u
"mParentConnectionParameterName"_s, mParentConnectionParameterName );
9364 mParentConnectionParameterName = map.value( u
"mParentConnectionParameterName"_s ).toString();
9371 QString def = definition;
9373 const thread_local QRegularExpression re( u
"(.*?)\\s+(.*)$"_s );
9374 const QRegularExpressionMatch m = re.match( def );
9377 parent = m.captured( 1 ).trimmed();
9378 def = m.captured( 2 );
9397 , mParentConnectionParameterName( connectionParameterName )
9398 , mParentSchemaParameterName( schemaParameterName )
9410 if ( !input.isValid() && !
mDefault.isValid() )
9413 if ( ( input.userType() == QMetaType::Type::QString && input.toString().isEmpty() ) || ( !input.isValid() &&
mDefault.userType() == QMetaType::Type::QString &&
mDefault.toString().isEmpty() ) )
9421 if ( !value.isValid() )
9424 if ( value.userType() == qMetaTypeId<QgsProperty>() )
9432 QString code = u
"##%1="_s.arg(
mName );
9434 code +=
"optional "_L1;
9435 code +=
"databasetable "_L1;
9437 code += ( mParentConnectionParameterName.isEmpty() ? u
"none"_s : mParentConnectionParameterName ) +
' ';
9438 code += ( mParentSchemaParameterName.isEmpty() ? u
"none"_s : mParentSchemaParameterName ) +
' ';
9441 return code.trimmed();
9446 switch ( outputType )
9452 code +=
", optional=True"_L1;
9454 if ( mAllowNewTableNames )
9455 code +=
", allowNewTableNames=True"_L1;
9457 code += u
", connectionParameterName='%1'"_s.arg( mParentConnectionParameterName );
9458 code += u
", schemaParameterName='%1'"_s.arg( mParentSchemaParameterName );
9472 QStringList depends;
9473 if ( !mParentConnectionParameterName.isEmpty() )
9474 depends << mParentConnectionParameterName;
9475 if ( !mParentSchemaParameterName.isEmpty() )
9476 depends << mParentSchemaParameterName;
9482 return mParentConnectionParameterName;
9487 mParentConnectionParameterName =
name;
9492 return mParentSchemaParameterName;
9497 mParentSchemaParameterName =
name;
9503 map.insert( u
"mParentConnectionParameterName"_s, mParentConnectionParameterName );
9504 map.insert( u
"mParentSchemaParameterName"_s, mParentSchemaParameterName );
9505 map.insert( u
"mAllowNewTableNames"_s, mAllowNewTableNames );
9512 mParentConnectionParameterName = map.value( u
"mParentConnectionParameterName"_s ).toString();
9513 mParentSchemaParameterName = map.value( u
"mParentSchemaParameterName"_s ).toString();
9514 mAllowNewTableNames = map.value( u
"mAllowNewTableNames"_s,
false ).toBool();
9522 QString def = definition;
9524 const thread_local QRegularExpression re( u
"(.*?)\\s+(.*+)\\b\\s*(.*)$"_s );
9525 const QRegularExpressionMatch m = re.match( def );
9528 connection = m.captured( 1 ).trimmed();
9529 if ( connection ==
"none"_L1 )
9531 schema = m.captured( 2 ).trimmed();
9532 if ( schema ==
"none"_L1 )
9534 def = m.captured( 3 );
9542 return mAllowNewTableNames;
9567 if ( !var.isValid() )
9575 if ( var.userType() == qMetaTypeId<QgsProperty>() )
9588 if ( qobject_cast< QgsPointCloudLayer * >( qvariant_cast<QObject *>( var ) ) )
9591 if ( var.userType() != QMetaType::Type::QString || var.toString().isEmpty() )
9609 if ( !val.isValid() )
9612 if ( val.userType() == qMetaTypeId<QgsProperty>() )
9616 p.insert(
name(), val );
9657 if ( !var.isValid() )
9665 if ( var.userType() == qMetaTypeId<QgsProperty>() )
9678 if ( qobject_cast< QgsAnnotationLayer * >( qvariant_cast<QObject *>( var ) ) )
9681 if ( var.userType() != QMetaType::Type::QString || var.toString().isEmpty() )
9699 if ( !val.isValid() )
9702 if ( val.userType() == qMetaTypeId<QgsProperty>() )
9706 p.insert(
name(), val );
9738 QVariant var = input;
9739 if ( !var.isValid() )
9747 if ( var.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
9753 if ( var.userType() == qMetaTypeId<QgsProperty>() )
9766 if ( var.userType() != QMetaType::Type::QString )
9769 if ( var.toString().isEmpty() )
9777 if ( !value.isValid() )
9780 if ( value.userType() == qMetaTypeId<QgsProperty>() )
9783 if ( value.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
9792 return u
"QgsProperty.fromExpression('%1')"_s.arg( fromVar.
sink.
asExpression() );
9808 return lOriginalProvider->defaultPointCloudFileExtension();
9812 return p->defaultPointCloudFileExtension();
9823 QStringList filters;
9824 for (
const QString &ext : exts )
9826 filters << QObject::tr(
"%1 files (*.%2)" ).arg( ext.toUpper(), ext.toLower() );
9828 return filters.join(
";;"_L1 ) + u
";;"_s + QObject::tr(
"All files (*.*)" );
9835 return lOriginalProvider->supportedOutputPointCloudLayerExtensions();
9839 return p->supportedOutputPointCloudLayerExtensions();
9844 return QStringList() << ext;
9882 if ( input.userType() == qMetaTypeId<QgsProperty>() )
9887 if ( input.userType() == QMetaType::Type::QVariantList || input.userType() == QMetaType::Type::QStringList )
9889 if ( !mAllowMultiple )
9895 else if ( input.userType() == QMetaType::Type::QString )
9897 if ( input.toString().isEmpty() )
9900 const QStringList parts = input.toString().split(
';' );
9901 if ( parts.count() > 1 && !mAllowMultiple )
9906 if ( input.toString().isEmpty() )
9914 if ( !value.isValid() )
9917 if ( value.userType() == qMetaTypeId<QgsProperty>() )
9920 if ( value.userType() == QMetaType::Type::QVariantList )
9923 const auto constToList = value.toList();
9924 for (
const QVariant &val : constToList )
9928 return parts.join(
',' ).prepend(
'[' ).append(
']' );
9930 else if ( value.userType() == QMetaType::Type::QStringList )
9933 const auto constToStringList = value.toStringList();
9934 for (
const QString &s : constToStringList )
9938 return parts.join(
',' ).prepend(
'[' ).append(
']' );
9946 QString code = u
"##%1="_s.arg(
mName );
9948 code +=
"optional "_L1;
9949 code +=
"attribute "_L1;
9951 if ( mAllowMultiple )
9952 code +=
"multiple "_L1;
9954 if ( mDefaultToAllAttributes )
9955 code +=
"default_to_all_attributes "_L1;
9957 code += mParentLayerParameterName +
' ';
9960 return code.trimmed();
9965 switch ( outputType )
9971 code +=
", optional=True"_L1;
9973 code += u
", parentLayerParameterName='%1'"_s.arg( mParentLayerParameterName );
9974 code += u
", allowMultiple=%1"_s.arg( mAllowMultiple ? u
"True"_s : u
"False"_s );
9978 if ( mDefaultToAllAttributes )
9979 code +=
", defaultToAllAttributes=True"_L1;
9991 QStringList depends;
9992 if ( !mParentLayerParameterName.isEmpty() )
9993 depends << mParentLayerParameterName;
9999 return mParentLayerParameterName;
10009 return mAllowMultiple;
10019 return mDefaultToAllAttributes;
10024 mDefaultToAllAttributes = enabled;
10030 map.insert( u
"parent_layer"_s, mParentLayerParameterName );
10031 map.insert( u
"allow_multiple"_s, mAllowMultiple );
10032 map.insert( u
"default_to_all_attributes"_s, mDefaultToAllAttributes );
10039 mParentLayerParameterName = map.value( u
"parent_layer"_s ).toString();
10040 mAllowMultiple = map.value( u
"allow_multiple"_s ).toBool();
10041 mDefaultToAllAttributes = map.value( u
"default_to_all_attributes"_s ).toBool();
10050 QString def = definition;
10052 if ( def.startsWith(
"multiple"_L1, Qt::CaseInsensitive ) )
10055 def = def.mid( 8 ).trimmed();
10058 if ( def.startsWith(
"default_to_all_attributes"_L1, Qt::CaseInsensitive ) )
10061 def = def.mid( 25 ).trimmed();
10064 const thread_local QRegularExpression re( u
"(.*?)\\s+(.*)$"_s );
10065 const QRegularExpressionMatch m = re.match( def );
10066 if ( m.hasMatch() )
10068 parent = m.captured( 1 ).trimmed();
10069 def = m.captured( 2 );
10095 QVariant var = input;
10096 if ( !var.isValid() )
10104 if ( var.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
10107 var = fromVar.
sink;
10110 if ( var.userType() == qMetaTypeId<QgsProperty>() )
10123 if ( var.userType() != QMetaType::Type::QString )
10126 if ( var.toString().isEmpty() )
10134 if ( !value.isValid() )
10137 if ( value.userType() == qMetaTypeId<QgsProperty>() )
10140 if ( value.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
10149 return u
"QgsProperty.fromExpression('%1')"_s.arg( fromVar.
sink.
asExpression() );
10169 QStringList filters;
10170 for (
const QString &ext : exts )
10172 filters << QObject::tr(
"%1 files (*.%2)" ).arg( ext.toUpper(), ext.toLower() );
10174 return filters.join(
";;"_L1 ) + u
";;"_s + QObject::tr(
"All files (*.*)" );
10180 return QStringList() << ext;
Provides global constants and enumerations for use throughout the application.
ProcessingSourceType
Processing data source types.
@ File
Files (i.e. non map layer sources, such as text files).
@ TiledScene
Tiled scene layers.
@ Annotation
Annotation layers.
@ Vector
Tables (i.e. vector layers with or without geometry). When used for a sink this indicates the sink ha...
@ VectorTile
Vector tile layers.
@ MapLayer
Any map layer type (raster, vector, mesh, point cloud, annotation or plugin layer).
@ VectorAnyGeometry
Any vector layer with geometry.
@ VectorPoint
Vector point layers.
@ VectorPolygon
Vector polygon layers.
@ VectorLine
Vector line layers.
@ PointCloud
Point cloud layers.
ProcessingFileParameterBehavior
Flags which dictate the behavior of QgsProcessingParameterFile.
@ File
Parameter is a single file.
@ Folder
Parameter is a folder.
ExpressionType
Expression types.
@ RasterCalculator
Raster calculator expression.
@ Qgis
Native QGIS expression.
@ PointCloud
Point cloud expression.
@ ShortString
A heavily abbreviated string, for use when a compact representation is required.
DistanceUnit
Units of distance.
@ Unknown
Unknown distance unit.
QFlags< RasterProcessingParameterCapability > RasterProcessingParameterCapabilities
Raster layer processing parameter capabilities.
ProcessingFieldParameterDataType
Processing field parameter data types.
@ String
Accepts string fields.
@ Boolean
Accepts boolean fields, since QGIS 3.34.
@ Binary
Accepts binary fields, since QGIS 3.34.
@ Numeric
Accepts numeric fields.
@ DateTime
Accepts datetime fields.
@ Unknown
Unknown areal unit.
@ Invalid
Invalid (not set) property.
@ Field
Field based property.
@ Expression
Expression based property.
TemporalUnit
Temporal units.
GeometryType
The geometry types are used to group Qgis::WkbType in a coarse way.
QFlags< ProcessingParameterFlag > ProcessingParameterFlags
Flags which dictate the behavior of Processing parameters.
@ Unknown
Unknown volume unit.
InvalidGeometryCheck
Methods for handling of features with invalid geometries.
@ NoCheck
No invalid geometry checking.
@ AbortOnInvalid
Close iterator on encountering any features with invalid geometry. This requires a slow geometry vali...
@ SkipInvalid
Skip any features with invalid geometry. This requires a slow geometry validity check for every featu...
QFlags< ProcessingFeatureSourceDefinitionFlag > ProcessingFeatureSourceDefinitionFlags
Flags which control behavior for a Processing feature source.
@ CreateIndividualOutputPerInputFeature
If set, every feature processed from this source will be placed into its own individually created out...
@ OverrideDefaultGeometryCheck
If set, the default geometry check method (as dictated by QgsProcessingContext) will be overridden fo...
WkbType
The WKB type describes the number of dimensions a geometry has.
@ Preferred
Preferred format, matching the most recent WKT ISO standard. Currently an alias to WKT2_2019,...
@ Optional
Parameter is optional.
ProcessingDateTimeParameterDataType
Processing date time parameter data types.
@ DateTime
Datetime values.
ProcessingNumberParameterType
Processing numeric parameter data types.
@ Double
Double/float values.
Represents a map layer containing a set of georeferenced annotations, e.g.
static QgsProcessingRegistry * processingRegistry()
Returns the application's processing registry, used for managing processing providers,...
Represents a coordinate reference system (CRS).
bool isValid() const
Returns whether this CRS is correctly initialized and usable.
QString userFriendlyIdentifier(Qgis::CrsIdentifierType type=Qgis::CrsIdentifierType::MediumString) const
Returns a user friendly identifier for the CRS.
QString toWkt(Qgis::CrsWktVariant variant=Qgis::CrsWktVariant::Wkt1Gdal, bool multiline=false, int indentationWidth=4) const
Returns a WKT representation of this CRS.
Custom exception class for Coordinate Reference System related exceptions.
Handles parsing and evaluation of expressions (formerly called "search strings").
bool isValid() const
Checks if this expression is valid.
An interface for objects which accept features via addFeature(s) methods.
QFlags< SinkFlag > SinkFlags
Container of fields for a vector layer.
static bool fileMatchesFilter(const QString &fileName, const QString &filter)
Returns true if the given fileName matches a file filter string.
A geometry is the spatial representation of a feature.
QgsGeometry densifyByCount(int extraNodesPerSegment) const
Returns a copy of the geometry which has been densified by adding the specified number of extra nodes...
static QgsGeometry fromRect(const QgsRectangle &rect)
Creates a new geometry from a QgsRectangle.
QString lastError() const
Returns an error string referring to the last error encountered either when this geometry was created...
Qgis::GeometryOperationResult transform(const QgsCoordinateTransform &ct, Qgis::TransformDirection direction=Qgis::TransformDirection::Forward, bool transformZ=false)
Transforms this geometry as described by the coordinate transform ct.
static Q_INVOKABLE QgsGeometry fromWkt(const QString &wkt)
Creates a new geometry from a WKT string.
QgsPointXY asPoint() const
Returns the contents of the geometry as a 2-dimensional point.
static QgsGeometry fromPointXY(const QgsPointXY &point)
Creates a new geometry from a QgsPointXY object.
bool isMultipart() const
Returns true if WKB of the geometry is of WKBMulti* type.
QgsGeometry centroid() const
Returns the center of mass of a geometry.
QgsRectangle boundingBox() const
Returns the bounding box of the geometry.
Q_INVOKABLE QString asWkt(int precision=17) const
Exports the geometry to WKT.
Base class for graphical items within a QgsLayout.
QgsMasterLayoutInterface * layoutByName(const QString &name) const
Returns the layout with a matching name, or nullptr if no matching layouts were found.
QgsLayoutItem * itemById(const QString &id) const
Returns a layout item given its id.
QgsLayoutItem * itemByUuid(const QString &uuid, bool includeTemplateUuids=false) const
Returns the layout item with matching uuid unique identifier, or nullptr if a matching item could not...
Base class for all map layer types.
virtual 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.
QgsExpressionContext & expressionContext()
Returns the expression context.
void addLayerToLoadOnCompletion(const QString &layer, const QgsProcessingContext::LayerDetails &details)
Adds a layer to load (by ID or datasource) into the canvas upon completion of the algorithm or model.
QgsProject * project() const
Returns the project in which the algorithm is being executed.
Base class for all parameter definitions which represent file or layer destinations,...
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonOutputType::PythonQgsProcessingAlgorithmSubclass) const override
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
virtual QString defaultFileExtension() const =0
Returns the default file extension for destination file paths associated with this parameter.
void setCreateByDefault(bool createByDefault)
Sets whether the destination should be created by default.
QVariantMap toVariantMap() const override
Saves this parameter to a QVariantMap.
bool supportsNonFileBasedOutput() const
Returns true if the destination parameter supports non filed-based outputs, such as memory layers or ...
bool createByDefault() const
Returns true if the destination should be created by default.
QString createFileFilter() const override
This method needs to be reimplemented in all classes which implement this interface and return a file...
virtual bool isSupportedOutputValue(const QVariant &value, QgsProcessingContext &context, QString &error) const
Tests whether a value is a supported value for this parameter.
virtual QString generateTemporaryDestination(const QgsProcessingContext *context=nullptr) const
Generates a temporary destination value for this parameter.
QgsProcessingProvider * originalProvider() const
Original (source) provider which this parameter has been derived from.
QgsProcessingDestinationParameter(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), bool optional=false, bool createByDefault=true)
Constructor for QgsProcessingDestinationParameter.
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
Custom exception class for processing related exceptions.
Encapsulates settings relating to a feature source input to a processing algorithm.
bool loadVariant(const QVariantMap &map)
Loads this source definition from a QVariantMap, wrapped in a QVariant.
bool selectedFeaturesOnly
true if only selected features in the source should be used by algorithms.
QgsProperty source
Source definition.
Qgis::InvalidGeometryCheck geometryCheck
Geometry check method to apply to this source.
Qgis::ProcessingFeatureSourceDefinitionFlags flags
Flags which dictate source behavior.
long long featureLimit
If set to a value > 0, places a limit on the maximum number of features which will be read from the s...
QVariant toVariant() const
Saves this source definition to a QVariantMap, wrapped in a QVariant.
QString filterExpression
Optional expression filter to use for filtering features which will be read from the source.
QgsFeatureSource subclass which proxies methods to an underlying QgsFeatureSource,...
Base class for providing feedback from a processing algorithm.
Base class for the definition of processing outputs.
A file output for processing algorithms.
A folder output for processing algorithms.
A HTML file output for processing algorithms.
Encapsulates settings relating to a feature sink or output raster layer for a processing algorithm.
QString format() const
Returns the format (if set).
bool loadVariant(const QVariantMap &map)
Loads this output layer definition from a QVariantMap, wrapped in a QVariant.
bool operator!=(const QgsProcessingOutputLayerDefinition &other) const
QgsProject * destinationProject
Destination project.
bool operator==(const QgsProcessingOutputLayerDefinition &other) const
QgsProperty sink
Sink/layer definition.
bool useRemapping() const
Returns true if the output uses a remapping definition.
QgsProcessingOutputLayerDefinition(const QString &sink=QString(), QgsProject *destinationProject=nullptr)
Constructor for QgsProcessingOutputLayerDefinition, accepting a static sink/layer string.
QgsRemappingSinkDefinition remappingDefinition() const
Returns the output remapping definition, if useRemapping() is true.
QVariant toVariant() const
Saves this output layer definition to a QVariantMap, wrapped in a QVariant.
QString destinationName
Name to use for sink if it's to be loaded into a destination project.
QVariantMap createOptions
Map of optional sink/layer creation options, which are passed to the underlying provider when creatin...
void setRemappingDefinition(const QgsRemappingSinkDefinition &definition)
Sets the remapping definition to use when adding features to the output layer.
A pointcloud layer output for processing algorithms.
A raster layer output for processing algorithms.
A vector layer output for processing algorithms.
A vector tile layer output for processing algorithms.
QgsProcessingParameterAnnotationLayer(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), bool optional=false)
Constructor for QgsProcessingParameterAnnotationLayer.
QVariant valueAsJsonObject(const QVariant &value, QgsProcessingContext &context) const override
Returns a version of the parameter input value, which is suitable for use in a JSON object.
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
QString valueAsPythonString(const QVariant &value, QgsProcessingContext &context) const override
Returns a string version of the parameter input value, which is suitable for use as an input paramete...
static QgsProcessingParameterAnnotationLayer * fromScriptCode(const QString &name, const QString &description, bool isOptional, const QString &definition)
Creates a new parameter using the definition from a script code.
bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
QString valueAsString(const QVariant &value, QgsProcessingContext &context, bool &ok) const override
Returns a string version of the parameter input value (if possible).
static QString typeName()
Returns the type name for the parameter class.
QgsProcessingParameterArea * clone() const override
Creates a clone of the parameter definition.
QString type() const override
Unique parameter type name.
QString parentParameterName() const
Returns the name of the parent parameter, or an empty string if this is not set.
QVariantMap toVariantMap() const override
Saves this parameter to a QVariantMap.
void setParentParameterName(const QString &parentParameterName)
Sets the name of the parent layer parameter.
Qgis::AreaUnit defaultUnit() const
Returns the default area unit for the parameter.
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
QgsProcessingParameterArea(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), const QString &parentParameterName=QString(), bool optional=false, double minValue=0, double maxValue=std::numeric_limits< double >::max())
Constructor for QgsProcessingParameterArea.
static QString typeName()
Returns the type name for the parameter class.
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonOutputType::PythonQgsProcessingAlgorithmSubclass) const override
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
QStringList dependsOnOtherParameters() const override
Returns a list of other parameter names on which this parameter is dependent (e.g.
QString userFriendlyString(const QVariant &value) const override
Returns a user-friendly string representation of the provided parameter value.
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
QgsProcessingParameterAuthConfig(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), bool optional=false)
Constructor for QgsProcessingParameterAuthConfig.
static QString typeName()
Returns the type name for the parameter class.
QString asScriptCode() const override
Returns the parameter definition encoded in a string which can be used within a Processing script.
QString valueAsPythonString(const QVariant &value, QgsProcessingContext &context) const override
Returns a string version of the parameter input value, which is suitable for use as an input paramete...
static QgsProcessingParameterAuthConfig * fromScriptCode(const QString &name, const QString &description, bool isOptional, const QString &definition)
Creates a new parameter using the definition from a script code.
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonOutputType::PythonQgsProcessingAlgorithmSubclass) const override
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
void setAllowMultiple(bool allowMultiple)
Sets whether multiple band selections are permitted.
void setParentLayerParameterName(const QString &parentLayerParameterName)
Sets the name of the parent layer parameter.
QVariantMap toVariantMap() const override
Saves this parameter to a QVariantMap.
QStringList dependsOnOtherParameters() const override
Returns a list of other parameter names on which this parameter is dependent (e.g.
QString valueAsPythonString(const QVariant &value, QgsProcessingContext &context) const override
Returns a string version of the parameter input value, which is suitable for use as an input paramete...
QString parentLayerParameterName() const
Returns the name of the parent layer parameter, or an empty string if this is not set.
QgsProcessingParameterBand(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), const QString &parentLayerParameterName=QString(), bool optional=false, bool allowMultiple=false)
Constructor for QgsProcessingParameterBand.
QString asScriptCode() const override
Returns the parameter definition encoded in a string which can be used within a Processing script.
bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
static QgsProcessingParameterBand * fromScriptCode(const QString &name, const QString &description, bool isOptional, const QString &definition)
Creates a new parameter using the definition from a script code.
static QString typeName()
Returns the type name for the parameter class.
bool allowMultiple() const
Returns whether multiple band selections are permitted.
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
QString valueAsPythonString(const QVariant &value, QgsProcessingContext &context) const override
Returns a string version of the parameter input value, which is suitable for use as an input paramete...
QString type() const override
Unique parameter type name.
static QString typeName()
Returns the type name for the parameter class.
static QgsProcessingParameterBoolean * fromScriptCode(const QString &name, const QString &description, bool isOptional, const QString &definition)
Creates a new parameter using the definition from a script code.
QgsProcessingParameterBoolean(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), bool optional=false)
Constructor for QgsProcessingParameterBoolean.
QString asScriptCode() const override
Returns the parameter definition encoded in a string which can be used within a Processing script.
A color parameter for processing algorithms.
QString valueAsPythonString(const QVariant &value, QgsProcessingContext &context) const override
Returns a string version of the parameter input value, which is suitable for use as an input paramete...
static QgsProcessingParameterColor * fromScriptCode(const QString &name, const QString &description, bool isOptional, const QString &definition)
Creates a new parameter using the definition from a script code.
bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
bool opacityEnabled() const
Returns true if the parameter allows opacity control.
void setOpacityEnabled(bool enabled)
Sets whether the parameter allows opacity control.
QgsProcessingParameterColor(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), bool opacityEnabled=true, bool optional=false)
Constructor for QgsProcessingParameterColor.
static QString typeName()
Returns the type name for the parameter class.
QVariantMap toVariantMap() const override
Saves this parameter to a QVariantMap.
QString asScriptCode() const override
Returns the parameter definition encoded in a string which can be used within a Processing script.
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonOutputType::PythonQgsProcessingAlgorithmSubclass) const override
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
static QString typeName()
Returns the type name for the parameter class.
QVariantMap toVariantMap() const override
Saves this parameter to a QVariantMap.
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonOutputType::PythonQgsProcessingAlgorithmSubclass) const override
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
QString valueAsPythonString(const QVariant &value, QgsProcessingContext &context) const override
Returns a string version of the parameter input value, which is suitable for use as an input paramete...
QString destinationCrsParameterName() const
Returns the name of the destination CRS parameter, or an empty string if this is not set.
QString asScriptCode() const override
Returns the parameter definition encoded in a string which can be used within a Processing script.
static QgsProcessingParameterCoordinateOperation * fromScriptCode(const QString &name, const QString &description, bool isOptional, const QString &definition)
Creates a new parameter using the definition from a script code.
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
QgsProcessingParameterCoordinateOperation(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), const QString &sourceCrsParameterName=QString(), const QString &destinationCrsParameterName=QString(), const QVariant &staticSourceCrs=QVariant(), const QVariant &staticDestinationCrs=QVariant(), bool optional=false)
Constructor for QgsProcessingParameterCoordinateOperation.
QStringList dependsOnOtherParameters() const override
Returns a list of other parameter names on which this parameter is dependent (e.g.
QString sourceCrsParameterName() const
Returns the name of the source CRS parameter, or an empty string if this is not set.
QgsProcessingParameterCrs(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), bool optional=false)
Constructor for QgsProcessingParameterCrs.
QString valueAsString(const QVariant &value, QgsProcessingContext &context, bool &ok) const override
Returns a string version of the parameter input value (if possible).
QString userFriendlyString(const QVariant &value) const override
Returns a user-friendly string representation of the provided parameter value.
bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
static QString typeName()
Returns the type name for the parameter class.
QString valueAsPythonString(const QVariant &value, QgsProcessingContext &context) const override
Returns a string version of the parameter input value, which is suitable for use as an input paramete...
static QgsProcessingParameterCrs * fromScriptCode(const QString &name, const QString &description, bool isOptional, const QString &definition)
Creates a new parameter using the definition from a script code.
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
QVariant valueAsJsonObject(const QVariant &value, QgsProcessingContext &context) const override
Returns a version of the parameter input value, which is suitable for use in a JSON object.
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonOutputType::PythonQgsProcessingAlgorithmSubclass) const override
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
void setParentConnectionParameterName(const QString &name)
Sets the name of the parent connection parameter.
QStringList dependsOnOtherParameters() const override
Returns a list of other parameter names on which this parameter is dependent (e.g.
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
QgsProcessingParameterDatabaseSchema(const QString &name, const QString &description, const QString &connectionParameterName=QString(), const QVariant &defaultValue=QVariant(), bool optional=false)
Constructor for QgsProcessingParameterDatabaseSchema.
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
static QgsProcessingParameterDatabaseSchema * fromScriptCode(const QString &name, const QString &description, bool isOptional, const QString &definition)
Creates a new parameter using the definition from a script code.
QString asScriptCode() const override
Returns the parameter definition encoded in a string which can be used within a Processing script.
QString valueAsPythonString(const QVariant &value, QgsProcessingContext &context) const override
Returns a string version of the parameter input value, which is suitable for use as an input paramete...
bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
QString parentConnectionParameterName() const
Returns the name of the parent connection parameter, or an empty string if this is not set.
QVariantMap toVariantMap() const override
Saves this parameter to a QVariantMap.
QgsProcessingParameterDatabaseTable(const QString &name, const QString &description, const QString &connectionParameterName=QString(), const QString &schemaParameterName=QString(), const QVariant &defaultValue=QVariant(), bool optional=false, bool allowNewTableNames=false)
Constructor for QgsProcessingParameterDatabaseTable.
void setParentSchemaParameterName(const QString &name)
Sets the name of the parent schema parameter.
QString parentConnectionParameterName() const
Returns the name of the parent connection parameter, or an empty string if this is not set.
QString parentSchemaParameterName() const
Returns the name of the parent schema parameter, or an empty string if this is not set.
QString asScriptCode() const override
Returns the parameter definition encoded in a string which can be used within a Processing script.
static QgsProcessingParameterDatabaseTable * fromScriptCode(const QString &name, const QString &description, bool isOptional, const QString &definition)
Creates a new parameter using the definition from a script code.
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
bool allowNewTableNames() const
Returns true if the parameter allows users to enter names for a new (non-existing) tables.
QString valueAsPythonString(const QVariant &value, QgsProcessingContext &context) const override
Returns a string version of the parameter input value, which is suitable for use as an input paramete...
QStringList dependsOnOtherParameters() const override
Returns a list of other parameter names on which this parameter is dependent (e.g.
void setAllowNewTableNames(bool allowed)
Sets whether the parameter allows users to enter names for a new (non-existing) tables.
QVariantMap toVariantMap() const override
Saves this parameter to a QVariantMap.
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonOutputType::PythonQgsProcessingAlgorithmSubclass) const override
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
void setParentConnectionParameterName(const QString &name)
Sets the name of the parent connection parameter.
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
QString type() const override
Unique parameter type name.
void setMaximum(const QDateTime &maximum)
Sets the maximum value acceptable by the parameter.
static QgsProcessingParameterDateTime * fromScriptCode(const QString &name, const QString &description, bool isOptional, const QString &definition)
Creates a new parameter using the definition from a script code.
QDateTime minimum() const
Returns the minimum value acceptable by the parameter.
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonOutputType::PythonQgsProcessingAlgorithmSubclass) const override
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
void setDataType(Qgis::ProcessingDateTimeParameterDataType type)
Sets the acceptable data type for the parameter.
Qgis::ProcessingDateTimeParameterDataType dataType() const
Returns the acceptable data type for the parameter.
QString toolTip() const override
Returns a formatted tooltip for use with the parameter, which gives helpful information like paramete...
void setMinimum(const QDateTime &minimum)
Sets the minimum value acceptable by the parameter.
QString valueAsPythonString(const QVariant &value, QgsProcessingContext &context) const override
Returns a string version of the parameter input value, which is suitable for use as an input paramete...
QDateTime maximum() const
Returns the maximum value acceptable by the parameter.
QVariantMap toVariantMap() const override
Saves this parameter to a QVariantMap.
QString userFriendlyString(const QVariant &value) const override
Returns a user-friendly string representation of the provided parameter value.
QgsProcessingParameterDateTime(const QString &name, const QString &description=QString(), Qgis::ProcessingDateTimeParameterDataType type=Qgis::ProcessingDateTimeParameterDataType::DateTime, const QVariant &defaultValue=QVariant(), bool optional=false, const QDateTime &minValue=QDateTime(), const QDateTime &maxValue=QDateTime())
Constructor for QgsProcessingParameterDateTime.
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
Base class for the definition of processing parameters.
QgsProcessingAlgorithm * mAlgorithm
Pointer to algorithm which owns this parameter.
QString mHelp
Parameter help.
virtual QVariant valueAsJsonObject(const QVariant &value, QgsProcessingContext &context) const
Returns a version of the parameter input value, which is suitable for use in a JSON object.
QVariant defaultValue() const
Returns the default value for the parameter.
QVariant guiDefaultValueOverride() const
Returns the default value to use in the GUI for the parameter.
QString valueAsStringPrivate(const QVariant &value, QgsProcessingContext &context, bool &ok, ValueAsStringFlags flags) const
Internal method for evaluating values as string.
QString help() const
Returns the help for the parameter.
virtual QString asScriptCode() const
Returns the parameter definition encoded in a string which can be used within a Processing script.
virtual QString toolTip() const
Returns a formatted tooltip for use with the parameter, which gives helpful information like paramete...
Qgis::ProcessingParameterFlags mFlags
Parameter flags.
virtual QString userFriendlyString(const QVariant &value) const
Returns a user-friendly string representation of the provided parameter value.
QFlags< ValueAsStringFlag > ValueAsStringFlags
virtual QStringList valueAsStringList(const QVariant &value, QgsProcessingContext &context, bool &ok) const
Returns a string list version of the parameter input value (if possible).
QgsProcessingAlgorithm * algorithm() const
Returns a pointer to the algorithm which owns this parameter.
QgsProcessingProvider * provider() const
Returns a pointer to the provider for the algorithm which owns this parameter.
@ AllowMapLayerValues
Enable map layer value handling.
QString mName
Parameter name.
virtual QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonOutputType::PythonQgsProcessingAlgorithmSubclass) const
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
QString description() const
Returns the description for the parameter.
QgsProcessingParameterDefinition(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), bool optional=false, const QString &help=QString())
Constructor for QgsProcessingParameterDefinition.
QVariant defaultValueForGui() const
Returns the default value to use for the parameter in a GUI.
friend class QgsProcessingAlgorithm
virtual QString valueAsString(const QVariant &value, QgsProcessingContext &context, bool &ok) const
Returns a string version of the parameter input value (if possible).
QVariantMap mMetadata
Freeform metadata for parameter. Mostly used by widget wrappers to customize their appearance and beh...
QString mDescription
Parameter description.
virtual QString type() const =0
Unique parameter type name.
virtual QVariantMap toVariantMap() const
Saves this parameter to a QVariantMap.
QString name() const
Returns the name of the parameter.
QVariant mDefault
Default value for parameter.
Qgis::ProcessingParameterFlags flags() const
Returns any flags associated with the parameter.
QVariant mGuiDefault
Default value for parameter in GUI.
virtual QString valueAsPythonString(const QVariant &value, QgsProcessingContext &context) const
Returns a string version of the parameter input value, which is suitable for use as an input paramete...
virtual bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const
Checks whether the specified input value is acceptable for the parameter.
QVariant defaultGuiValueFromSetting() const
Default gui value for an algorithm parameter from settings.
virtual bool fromVariantMap(const QVariantMap &map)
Restores this parameter to a QVariantMap.
virtual QString valueAsPythonComment(const QVariant &value, QgsProcessingContext &context) const
Returns a Python comment explaining a parameter value, or an empty string if no comment is required.
QVariant valueAsJsonObjectPrivate(const QVariant &value, QgsProcessingContext &context, ValueAsStringFlags flags) const
Internal method for evaluating values as JSON objects.
virtual QColor modelColor() const
Returns the color to use for the parameter in model designer windows.
void setParentParameterName(const QString &parentParameterName)
Sets the name of the parent layer parameter.
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonOutputType::PythonQgsProcessingAlgorithmSubclass) const override
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
static QString typeName()
Returns the type name for the parameter class.
QString parentParameterName() const
Returns the name of the parent parameter, or an empty string if this is not set.
QStringList dependsOnOtherParameters() const override
Returns a list of other parameter names on which this parameter is dependent (e.g.
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
QVariantMap toVariantMap() const override
Saves this parameter to a QVariantMap.
Qgis::DistanceUnit defaultUnit() const
Returns the default distance unit for the parameter.
QgsProcessingParameterDistance * clone() const override
Creates a clone of the parameter definition.
QString userFriendlyString(const QVariant &value) const override
Returns a user-friendly string representation of the provided parameter value.
QString type() const override
Unique parameter type name.
QgsProcessingParameterDistance(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), const QString &parentParameterName=QString(), bool optional=false, double minValue=std::numeric_limits< double >::lowest()+1, double maxValue=std::numeric_limits< double >::max())
Constructor for QgsProcessingParameterDistance.
Qgis::TemporalUnit defaultUnit() const
Returns the default duration unit for the parameter.
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
QString userFriendlyString(const QVariant &value) const override
Returns a user-friendly string representation of the provided parameter value.
QgsProcessingParameterDuration * clone() const override
Creates a clone of the parameter definition.
QVariantMap toVariantMap() const override
Saves this parameter to a QVariantMap.
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonOutputType::PythonQgsProcessingAlgorithmSubclass) const override
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
static QString typeName()
Returns the type name for the parameter class.
QString type() const override
Unique parameter type name.
QgsProcessingParameterDuration(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), bool optional=false, double minValue=std::numeric_limits< double >::lowest()+1, double maxValue=std::numeric_limits< double >::max())
Constructor for QgsProcessingParameterDuration.
An enum based parameter for processing algorithms, allowing for selection from predefined values.
void setUsesStaticStrings(bool usesStaticStrings)
Sets whether the parameter uses static (non-translated) string values for its enumeration choice list...
QString userFriendlyString(const QVariant &value) const override
Returns a user-friendly string representation of the provided parameter value.
static QgsProcessingParameterEnum * fromScriptCode(const QString &name, const QString &description, bool isOptional, const QString &definition)
Creates a new parameter using the definition from a script code.
QString valueAsPythonString(const QVariant &value, QgsProcessingContext &context) const override
Returns a string version of the parameter input value, which is suitable for use as an input paramete...
bool allowMultiple() const
Returns true if the parameter allows multiple selected values.
QStringList options() const
Returns the list of acceptable options for the parameter.
QgsProcessingParameterEnum(const QString &name, const QString &description=QString(), const QStringList &options=QStringList(), bool allowMultiple=false, const QVariant &defaultValue=QVariant(), bool optional=false, bool usesStaticStrings=false)
Constructor for QgsProcessingParameterEnum.
void setOptions(const QStringList &options)
Sets the list of acceptable options for the parameter.
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonOutputType::PythonQgsProcessingAlgorithmSubclass) const override
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
bool usesStaticStrings() const
Returns true if the parameter uses static (non-translated) string values for its enumeration choice l...
QString valueAsPythonComment(const QVariant &value, QgsProcessingContext &context) const override
Returns a Python comment explaining a parameter value, or an empty string if no comment is required.
void setAllowMultiple(bool allowMultiple)
Sets whether the parameter allows multiple selected values.
bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
QVariantMap toVariantMap() const override
Saves this parameter to a QVariantMap.
QString asScriptCode() const override
Returns the parameter definition encoded in a string which can be used within a Processing script.
static QString typeName()
Returns the type name for the parameter class.
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonOutputType::PythonQgsProcessingAlgorithmSubclass) const override
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
static QgsProcessingParameterExpression * fromScriptCode(const QString &name, const QString &description, bool isOptional, const QString &definition)
Creates a new parameter using the definition from a script code.
QString valueAsPythonString(const QVariant &value, QgsProcessingContext &context) const override
Returns a string version of the parameter input value, which is suitable for use as an input paramete...
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
QgsProcessingParameterExpression(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), const QString &parentLayerParameterName=QString(), bool optional=false, Qgis::ExpressionType type=Qgis::ExpressionType::Qgis)
Constructor for QgsProcessingParameterExpression.
QStringList dependsOnOtherParameters() const override
Returns a list of other parameter names on which this parameter is dependent (e.g.
void setParentLayerParameterName(const QString &parentLayerParameterName)
Sets the name of the parent layer parameter.
QVariantMap toVariantMap() const override
Saves this parameter to a QVariantMap.
QString parentLayerParameterName() const
Returns the name of the parent layer parameter, or an empty string if this is not set.
QString type() const override
Unique parameter type name.
static QString typeName()
Returns the type name for the parameter class.
Qgis::ExpressionType expressionType() const
Returns the parameter's expression type.
void setExpressionType(Qgis::ExpressionType type)
Sets the parameter's expression type.
QString valueAsPythonString(const QVariant &value, QgsProcessingContext &context) const override
Returns a string version of the parameter input value, which is suitable for use as an input paramete...
QgsProcessingParameterExtent(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), bool optional=false)
Constructor for QgsProcessingParameterExtent.
bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
static QString typeName()
Returns the type name for the parameter class.
static QgsProcessingParameterExtent * fromScriptCode(const QString &name, const QString &description, bool isOptional, const QString &definition)
Creates a new parameter using the definition from a script code.
QVariant valueAsJsonObject(const QVariant &value, QgsProcessingContext &context) const override
Returns a version of the parameter input value, which is suitable for use in a JSON object.
QString valueAsString(const QVariant &value, QgsProcessingContext &context, bool &ok) const override
Returns a string version of the parameter input value (if possible).
QgsProcessingParameterFeatureSink(const QString &name, const QString &description=QString(), Qgis::ProcessingSourceType type=Qgis::ProcessingSourceType::VectorAnyGeometry, const QVariant &defaultValue=QVariant(), bool optional=false, bool createByDefault=true, bool supportsAppend=false)
Constructor for QgsProcessingParameterFeatureSink.
QString generateTemporaryDestination(const QgsProcessingContext *context=nullptr) const override
Generates a temporary destination value for this parameter.
static QgsProcessingParameterFeatureSink * fromScriptCode(const QString &name, const QString &description, bool isOptional, const QString &definition)
Creates a new parameter using the definition from a script code.
QgsProcessingOutputDefinition * toOutputDefinition() const override
Returns a new QgsProcessingOutputDefinition corresponding to the definition of the destination parame...
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
bool hasGeometry() const
Returns true if sink is likely to include geometries.
QString type() const override
Unique parameter type name.
void setDataType(Qgis::ProcessingSourceType type)
Sets the layer type for the sinks associated with the parameter.
virtual QStringList supportedOutputVectorLayerExtensions() const
Returns a list of the vector format file extensions supported by this parameter.
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
QString valueAsPythonString(const QVariant &value, QgsProcessingContext &context) const override
Returns a string version of the parameter input value, which is suitable for use as an input paramete...
bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
void setSupportsAppend(bool supportsAppend)
Sets whether the sink supports appending features to an existing table.
QString createFileFilter() const override
This method needs to be reimplemented in all classes which implement this interface and return a file...
QString defaultFileExtension() const override
Returns the default file extension for destination file paths associated with this parameter.
bool supportsAppend() const
Returns true if the sink supports appending features to an existing table.
Qgis::ProcessingSourceType dataType() const
Returns the layer type for sinks associated with the parameter.
static QString typeName()
Returns the type name for the parameter class.
QVariantMap toVariantMap() const override
Saves this parameter to a QVariantMap.
QString asScriptCode() const override
Returns the parameter definition encoded in a string which can be used within a Processing script.
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonOutputType::PythonQgsProcessingAlgorithmSubclass) const override
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
QgsProcessingParameterFeatureSource(const QString &name, const QString &description=QString(), const QList< int > &types=QList< int >(), const QVariant &defaultValue=QVariant(), bool optional=false)
Constructor for QgsProcessingParameterFeatureSource.
QString valueAsString(const QVariant &value, QgsProcessingContext &context, bool &ok) const override
Returns a string version of the parameter input value (if possible).
QString valueAsPythonString(const QVariant &value, QgsProcessingContext &context) const override
Returns a string version of the parameter input value, which is suitable for use as an input paramete...
QString asScriptCode() const override
Returns the parameter definition encoded in a string which can be used within a Processing script.
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
QVariantMap toVariantMap() const override
Saves this parameter to a QVariantMap.
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonOutputType::PythonQgsProcessingAlgorithmSubclass) const override
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
QString createFileFilter() const override
This method needs to be reimplemented in all classes which implement this interface and return a file...
static QString typeName()
Returns the type name for the parameter class.
QString type() const override
Unique parameter type name.
static QgsProcessingParameterFeatureSource * fromScriptCode(const QString &name, const QString &description, bool isOptional, const QString &definition)
Creates a new parameter using the definition from a script code.
QVariant valueAsJsonObject(const QVariant &value, QgsProcessingContext &context) const override
Returns a version of the parameter input value, which is suitable for use in a JSON object.
QStringList dependsOnOtherParameters() const override
Returns a list of other parameter names on which this parameter is dependent (e.g.
QString parentLayerParameterName() const
Returns the name of the parent layer parameter, or an empty string if this is not set.
void setParentLayerParameterName(const QString &parentLayerParameterName)
Sets the name of the parent layer parameter.
Qgis::ProcessingFieldParameterDataType dataType() const
Returns the acceptable data type for the field.
bool allowMultiple() const
Returns whether multiple field selections are permitted.
bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
QVariantMap toVariantMap() const override
Saves this parameter to a QVariantMap.
QString type() const override
Unique parameter type name.
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonOutputType::PythonQgsProcessingAlgorithmSubclass) const override
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
bool defaultToAllFields() const
Returns whether a parameter which allows multiple selections (see allowMultiple()) should automatical...
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
static QString typeName()
Returns the type name for the parameter class.
QString valueAsPythonString(const QVariant &value, QgsProcessingContext &context) const override
Returns a string version of the parameter input value, which is suitable for use as an input paramete...
void setDataType(Qgis::ProcessingFieldParameterDataType type)
Sets the acceptable data type for the field.
void setAllowMultiple(bool allowMultiple)
Sets whether multiple field selections are permitted.
QgsProcessingParameterField(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), const QString &parentLayerParameterName=QString(), Qgis::ProcessingFieldParameterDataType type=Qgis::ProcessingFieldParameterDataType::Any, bool allowMultiple=false, bool optional=false, bool defaultToAllFields=false)
Constructor for QgsProcessingParameterField.
QString asScriptCode() const override
Returns the parameter definition encoded in a string which can be used within a Processing script.
void setDefaultToAllFields(bool enabled)
Sets whether a parameter which allows multiple selections (see allowMultiple()) should automatically ...
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
static QgsProcessingParameterField * fromScriptCode(const QString &name, const QString &description, bool isOptional, const QString &definition)
Creates a new parameter using the definition from a script code.
static QgsProcessingParameterFileDestination * fromScriptCode(const QString &name, const QString &description, bool isOptional, const QString &definition)
Creates a new parameter using the definition from a script code.
QgsProcessingOutputDefinition * toOutputDefinition() const override
Returns a new QgsProcessingOutputDefinition corresponding to the definition of the destination parame...
QString defaultFileExtension() const override
Returns the default file extension for destination file paths associated with this parameter.
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonOutputType::PythonQgsProcessingAlgorithmSubclass) const override
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
QgsProcessingParameterFileDestination(const QString &name, const QString &description=QString(), const QString &fileFilter=QString(), const QVariant &defaultValue=QVariant(), bool optional=false, bool createByDefault=true)
Constructor for QgsProcessingParameterFileDestination.
static QString typeName()
Returns the type name for the parameter class.
QString valueAsPythonString(const QVariant &value, QgsProcessingContext &context) const override
Returns a string version of the parameter input value, which is suitable for use as an input paramete...
QString fileFilter() const
Returns the file filter string for file destinations compatible with this parameter.
void setFileFilter(const QString &filter)
Sets the file filter string for file destinations compatible with this parameter.
QString createFileFilter() const override
This method needs to be reimplemented in all classes which implement this interface and return a file...
QVariantMap toVariantMap() const override
Saves this parameter to a QVariantMap.
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
QString extension() const
Returns any specified file extension for the parameter.
void setExtension(const QString &extension)
Sets a file extension for the parameter.
static QString typeName()
Returns the type name for the parameter class.
QVariantMap toVariantMap() const override
Saves this parameter to a QVariantMap.
QString asScriptCode() const override
Returns the parameter definition encoded in a string which can be used within a Processing script.
QgsProcessingParameterFile(const QString &name, const QString &description=QString(), Qgis::ProcessingFileParameterBehavior behavior=Qgis::ProcessingFileParameterBehavior::File, const QString &extension=QString(), const QVariant &defaultValue=QVariant(), bool optional=false, const QString &fileFilter=QString())
Constructor for QgsProcessingParameterFile.
void setFileFilter(const QString &filter)
Sets the file filter string for file destinations compatible with this parameter.
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonOutputType::PythonQgsProcessingAlgorithmSubclass) const override
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
QString fileFilter() const
Returns the file filter string for file destinations compatible with this parameter.
bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
QString createFileFilter() const override
This method needs to be reimplemented in all classes which implement this interface and return a file...
static QgsProcessingParameterFile * fromScriptCode(const QString &name, const QString &description, bool isOptional, const QString &definition, Qgis::ProcessingFileParameterBehavior behavior=Qgis::ProcessingFileParameterBehavior::File)
Creates a new parameter using the definition from a script code.
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
Qgis::ProcessingFileParameterBehavior behavior() const
Returns the parameter behavior (e.g.
QgsProcessingOutputDefinition * toOutputDefinition() const override
Returns a new QgsProcessingOutputDefinition corresponding to the definition of the destination parame...
static QgsProcessingParameterFolderDestination * fromScriptCode(const QString &name, const QString &description, bool isOptional, const QString &definition)
Creates a new parameter using the definition from a script code.
bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
QString defaultFileExtension() const override
Returns the default file extension for destination file paths associated with this parameter.
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
static QString typeName()
Returns the type name for the parameter class.
QgsProcessingParameterFolderDestination(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), bool optional=false, bool createByDefault=true)
Constructor for QgsProcessingParameterFolderDestination.
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
QString type() const override
Unique parameter type name.
QString valueAsPythonString(const QVariant &value, QgsProcessingContext &context) const override
Returns a string version of the parameter input value, which is suitable for use as an input paramete...
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonOutputType::PythonQgsProcessingAlgorithmSubclass) const override
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
QString asScriptCode() const override
Returns the parameter definition encoded in a string which can be used within a Processing script.
bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
bool allowMultipart() const
Returns the parameter allow multipart geometries.
QgsProcessingParameterGeometry(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), bool optional=false, const QList< int > &geometryTypes=QList< int >(), bool allowMultipart=true)
Constructor for QgsProcessingParameterGeometry.
QList< int > geometryTypes() const
Returns the parameter allowed geometries, as a list of Qgis::GeometryType values.
QVariantMap toVariantMap() const override
Saves this parameter to a QVariantMap.
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
QString userFriendlyString(const QVariant &value) const override
Returns a user-friendly string representation of the provided parameter value.
static QgsProcessingParameterGeometry * fromScriptCode(const QString &name, const QString &description, bool isOptional, const QString &definition)
Creates a new parameter using the definition from a script code.
QString type() const override
Unique parameter type name.
static QgsProcessingParameterLayoutItem * fromScriptCode(const QString &name, const QString &description, bool isOptional, const QString &definition)
Creates a new parameter using the definition from a script code.
QgsProcessingParameterLayoutItem(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), const QString &parentLayoutParameterName=QString(), int itemType=-1, bool optional=false)
Constructor for QgsProcessingParameterLayoutItem.
void setParentLayoutParameterName(const QString &name)
Sets the name of the parent layout parameter.
QString parentLayoutParameterName() const
Returns the name of the parent layout parameter, or an empty string if this is not set.
static QString typeName()
Returns the type name for the parameter class.
QVariantMap toVariantMap() const override
Saves this parameter to a QVariantMap.
int itemType() const
Returns the acceptable item type, or -1 if any item type is allowed.
void setItemType(int type)
Sets the acceptable item type, or -1 if any item type is allowed.
QString valueAsPythonString(const QVariant &value, QgsProcessingContext &context) const override
Returns a string version of the parameter input value, which is suitable for use as an input paramete...
QString asScriptCode() const override
Returns the parameter definition encoded in a string which can be used within a Processing script.
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonOutputType::PythonQgsProcessingAlgorithmSubclass) const override
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
QStringList dependsOnOtherParameters() const override
Returns a list of other parameter names on which this parameter is dependent (e.g.
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonOutputType::PythonQgsProcessingAlgorithmSubclass) const override
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
QString valueAsPythonString(const QVariant &value, QgsProcessingContext &context) const override
Returns a string version of the parameter input value, which is suitable for use as an input paramete...
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
static QgsProcessingParameterLayout * fromScriptCode(const QString &name, const QString &description, bool isOptional, const QString &definition)
Creates a new parameter using the definition from a script code.
QString asScriptCode() const override
Returns the parameter definition encoded in a string which can be used within a Processing script.
QgsProcessingParameterLayout(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), bool optional=false)
Constructor for QgsProcessingParameterLayout.
static QString typeName()
Returns the type name for the parameter class.
void setDataTypes(const QList< int > &types)
Sets the geometry types for sources acceptable by the parameter.
QgsProcessingParameterLimitedDataTypes(const QList< int > &types=QList< int >())
Constructor for QgsProcessingParameterLimitedDataTypes, with a list of acceptable data types.
QList< int > mDataTypes
List of acceptable data types for the parameter.
QList< int > dataTypes() const
Returns the geometry types for sources acceptable by the parameter.
QString asScriptCode() const override
Returns the parameter definition encoded in a string which can be used within a Processing script.
static QgsProcessingParameterMapLayer * fromScriptCode(const QString &name, const QString &description, bool isOptional, const QString &definition)
Creates a new parameter using the definition from a script code.
QVariantMap toVariantMap() const override
Saves this parameter to a QVariantMap.
QString valueAsPythonString(const QVariant &value, QgsProcessingContext &context) const override
Returns a string version of the parameter input value, which is suitable for use as an input paramete...
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
QString valueAsString(const QVariant &value, QgsProcessingContext &context, bool &ok) const override
Returns a string version of the parameter input value (if possible).
QString createFileFilter() const override
This method needs to be reimplemented in all classes which implement this interface and return a file...
QString type() const override
Unique parameter type name.
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonOutputType::PythonQgsProcessingAlgorithmSubclass) const override
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
QgsProcessingParameterMapLayer(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), bool optional=false, const QList< int > &types=QList< int >())
Constructor for QgsProcessingParameterMapLayer.
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
QVariant valueAsJsonObject(const QVariant &value, QgsProcessingContext &context) const override
Returns a version of the parameter input value, which is suitable for use in a JSON object.
bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
static QString typeName()
Returns the type name for the parameter class.
QString asScriptCode() const override
Returns the parameter definition encoded in a string which can be used within a Processing script.
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
static QgsProcessingParameterMapTheme * fromScriptCode(const QString &name, const QString &description, bool isOptional, const QString &definition)
Creates a new parameter using the definition from a script code.
QString valueAsPythonString(const QVariant &value, QgsProcessingContext &context) const override
Returns a string version of the parameter input value, which is suitable for use as an input paramete...
QgsProcessingParameterMapTheme(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), bool optional=false)
Constructor for QgsProcessingParameterMapTheme.
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
QVariantMap toVariantMap() const override
Saves this parameter to a QVariantMap.
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonOutputType::PythonQgsProcessingAlgorithmSubclass) const override
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
QStringList headers() const
Returns a list of column headers (if set).
void setHeaders(const QStringList &headers)
Sets the list of column headers.
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
void setHasFixedNumberRows(bool hasFixedNumberRows)
Sets whether the table has a fixed number of rows.
QVariantMap toVariantMap() const override
Saves this parameter to a QVariantMap.
void setNumberRows(int rows)
Sets the fixed number of rows in the table.
int numberRows() const
Returns the fixed number of rows in the table.
static QgsProcessingParameterMatrix * fromScriptCode(const QString &name, const QString &description, bool isOptional, const QString &definition)
Creates a new parameter using the definition from a script code.
QString valueAsPythonString(const QVariant &value, QgsProcessingContext &context) const override
Returns a string version of the parameter input value, which is suitable for use as an input paramete...
static QString typeName()
Returns the type name for the parameter class.
QgsProcessingParameterMatrix(const QString &name, const QString &description=QString(), int numberRows=3, bool hasFixedNumberRows=false, const QStringList &headers=QStringList(), const QVariant &defaultValue=QVariant(), bool optional=false)
Constructor for QgsProcessingParameterMatrix.
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonOutputType::PythonQgsProcessingAlgorithmSubclass) const override
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
bool hasFixedNumberRows() const
Returns whether the table has a fixed number of rows.
bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
QString valueAsString(const QVariant &value, QgsProcessingContext &context, bool &ok) const override
Returns a string version of the parameter input value (if possible).
QgsProcessingParameterMeshLayer(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), bool optional=false)
Constructor for QgsProcessingParameterMeshLayer.
QVariant valueAsJsonObject(const QVariant &value, QgsProcessingContext &context) const override
Returns a version of the parameter input value, which is suitable for use in a JSON object.
QString createFileFilter() const override
This method needs to be reimplemented in all classes which implement this interface and return a file...
QString valueAsPythonString(const QVariant &value, QgsProcessingContext &context) const override
Returns a string version of the parameter input value, which is suitable for use as an input paramete...
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
static QgsProcessingParameterMeshLayer * fromScriptCode(const QString &name, const QString &description, bool isOptional, const QString &definition)
Creates a new parameter using the definition from a script code.
static QString typeName()
Returns the type name for the parameter class.
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
QVariant valueAsJsonObject(const QVariant &value, QgsProcessingContext &context) const override
Returns a version of the parameter input value, which is suitable for use in a JSON object.
QString valueAsString(const QVariant &value, QgsProcessingContext &context, bool &ok) const override
Returns a string version of the parameter input value (if possible).
void setMinimumNumberInputs(int minimum)
Sets the minimum number of layers required for the parameter.
bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
QString asScriptCode() const override
Returns the parameter definition encoded in a string which can be used within a Processing script.
Qgis::ProcessingSourceType layerType() const
Returns the layer type for layers acceptable by the parameter.
QString valueAsPythonString(const QVariant &value, QgsProcessingContext &context) const override
Returns a string version of the parameter input value, which is suitable for use as an input paramete...
static QString typeName()
Returns the type name for the parameter class.
void setLayerType(Qgis::ProcessingSourceType type)
Sets the layer type for layers acceptable by the parameter.
QVariantMap toVariantMap() const override
Saves this parameter to a QVariantMap.
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
QString createFileFilter() const override
This method needs to be reimplemented in all classes which implement this interface and return a file...
QgsProcessingParameterMultipleLayers(const QString &name, const QString &description=QString(), Qgis::ProcessingSourceType layerType=Qgis::ProcessingSourceType::VectorAnyGeometry, const QVariant &defaultValue=QVariant(), bool optional=false)
Constructor for QgsProcessingParameterMultipleLayers.
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonOutputType::PythonQgsProcessingAlgorithmSubclass) const override
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
static QgsProcessingParameterMultipleLayers * fromScriptCode(const QString &name, const QString &description, bool isOptional, const QString &definition)
Creates a new parameter using the definition from a script code.
QString type() const override
Unique parameter type name.
int minimumNumberInputs() const
Returns the minimum number of layers required for the parameter.
double minimum() const
Returns the minimum value acceptable by the parameter.
static QgsProcessingParameterNumber * fromScriptCode(const QString &name, const QString &description, bool isOptional, const QString &definition)
Creates a new parameter using the definition from a script code.
void setMinimum(double minimum)
Sets the minimum value acceptable by the parameter.
void setMaximum(double maximum)
Sets the maximum value acceptable by the parameter.
double maximum() const
Returns the maximum value acceptable by the parameter.
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonOutputType::PythonQgsProcessingAlgorithmSubclass) const override
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
QString type() const override
Unique parameter type name.
QVariantMap toVariantMap() const override
Saves this parameter to a QVariantMap.
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
QString toolTip() const override
Returns a formatted tooltip for use with the parameter, which gives helpful information like paramete...
QString valueAsPythonString(const QVariant &value, QgsProcessingContext &context) const override
Returns a string version of the parameter input value, which is suitable for use as an input paramete...
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
Qgis::ProcessingNumberParameterType dataType() const
Returns the acceptable data type for the parameter.
static QString typeName()
Returns the type name for the parameter class.
QgsProcessingParameterNumber(const QString &name, const QString &description=QString(), Qgis::ProcessingNumberParameterType type=Qgis::ProcessingNumberParameterType::Integer, const QVariant &defaultValue=QVariant(), bool optional=false, double minValue=std::numeric_limits< double >::lowest()+1, double maxValue=std::numeric_limits< double >::max())
Constructor for QgsProcessingParameterNumber.
void setDataType(Qgis::ProcessingNumberParameterType type)
Sets the acceptable data type for the parameter.
QgsProcessingParameterPointCloudAttribute(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), const QString &parentLayerParameterName=QString(), bool allowMultiple=false, bool optional=false, bool defaultToAllAttributes=false)
Constructor for QgsProcessingParameterField.
QStringList dependsOnOtherParameters() const override
Returns a list of other parameter names on which this parameter is dependent (e.g.
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
void setDefaultToAllAttributes(bool enabled)
Sets whether a parameter which allows multiple selections (see allowMultiple()) should automatically ...
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonOutputType::PythonQgsProcessingAlgorithmSubclass) const override
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
void setParentLayerParameterName(const QString &parentLayerParameterName)
Sets the name of the parent layer parameter.
QString parentLayerParameterName() const
Returns the name of the parent layer parameter, or an empty string if this is not set.
static QgsProcessingParameterPointCloudAttribute * fromScriptCode(const QString &name, const QString &description, bool isOptional, const QString &definition)
Creates a new parameter using the definition from a script code.
static QString typeName()
Returns the type name for the parameter class.
bool allowMultiple() const
Returns whether multiple field selections are permitted.
void setAllowMultiple(bool allowMultiple)
Sets whether multiple field selections are permitted.
QString valueAsPythonString(const QVariant &value, QgsProcessingContext &context) const override
Returns a string version of the parameter input value, which is suitable for use as an input paramete...
bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
QVariantMap toVariantMap() const override
Saves this parameter to a QVariantMap.
bool defaultToAllAttributes() const
Returns whether a parameter which allows multiple selections (see allowMultiple()) should automatical...
QString asScriptCode() const override
Returns the parameter definition encoded in a string which can be used within a Processing script.
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
QString createFileFilter() const override
This method needs to be reimplemented in all classes which implement this interface and return a file...
QString valueAsPythonString(const QVariant &value, QgsProcessingContext &context) const override
Returns a string version of the parameter input value, which is suitable for use as an input paramete...
static QgsProcessingParameterPointCloudDestination * fromScriptCode(const QString &name, const QString &description, bool isOptional, const QString &definition)
Creates a new parameter using the definition from a script code.
virtual QStringList supportedOutputPointCloudLayerExtensions() const
Returns a list of the point cloud format file extensions supported for this parameter.
bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
QString defaultFileExtension() const override
Returns the default file extension for destination file paths associated with this parameter.
static QString typeName()
Returns the type name for the parameter class.
QgsProcessingParameterPointCloudDestination(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), bool optional=false, bool createByDefault=true)
Constructor for QgsProcessingParameterPointCloudDestination.
QgsProcessingOutputDefinition * toOutputDefinition() const override
Returns a new QgsProcessingOutputDefinition corresponding to the definition of the destination parame...
QString valueAsPythonString(const QVariant &value, QgsProcessingContext &context) const override
Returns a string version of the parameter input value, which is suitable for use as an input paramete...
QString valueAsString(const QVariant &value, QgsProcessingContext &context, bool &ok) const override
Returns a string version of the parameter input value (if possible).
static QgsProcessingParameterPointCloudLayer * fromScriptCode(const QString &name, const QString &description, bool isOptional, const QString &definition)
Creates a new parameter using the definition from a script code.
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
QVariant valueAsJsonObject(const QVariant &value, QgsProcessingContext &context) const override
Returns a version of the parameter input value, which is suitable for use in a JSON object.
QString createFileFilter() const override
This method needs to be reimplemented in all classes which implement this interface and return a file...
bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
static QString typeName()
Returns the type name for the parameter class.
QgsProcessingParameterPointCloudLayer(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), bool optional=false)
Constructor for QgsProcessingParameterPointCloudLayer.
bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
static QgsProcessingParameterPoint * fromScriptCode(const QString &name, const QString &description, bool isOptional, const QString &definition)
Creates a new parameter using the definition from a script code.
QgsProcessingParameterPoint(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), bool optional=false)
Constructor for QgsProcessingParameterPoint.
static QString typeName()
Returns the type name for the parameter class.
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
QString valueAsPythonString(const QVariant &value, QgsProcessingContext &context) const override
Returns a string version of the parameter input value, which is suitable for use as an input paramete...
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
QgsProcessingParameterProviderConnection(const QString &name, const QString &description, const QString &provider, const QVariant &defaultValue=QVariant(), bool optional=false)
Constructor for QgsProcessingParameterProviderConnection, for the specified provider type.
QVariantMap toVariantMap() const override
Saves this parameter to a QVariantMap.
QString asScriptCode() const override
Returns the parameter definition encoded in a string which can be used within a Processing script.
QString valueAsPythonString(const QVariant &value, QgsProcessingContext &context) const override
Returns a string version of the parameter input value, which is suitable for use as an input paramete...
bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonOutputType::PythonQgsProcessingAlgorithmSubclass) const override
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
static QgsProcessingParameterProviderConnection * fromScriptCode(const QString &name, const QString &description, bool isOptional, const QString &definition)
Creates a new parameter using the definition from a script code.
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
static QString typeName()
Returns the type name for the parameter class.
bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonOutputType::PythonQgsProcessingAlgorithmSubclass) const override
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
Qgis::ProcessingNumberParameterType dataType() const
Returns the acceptable data type for the range.
QgsProcessingParameterRange(const QString &name, const QString &description=QString(), Qgis::ProcessingNumberParameterType type=Qgis::ProcessingNumberParameterType::Integer, const QVariant &defaultValue=QVariant(), bool optional=false)
Constructor for QgsProcessingParameterRange.
QVariantMap toVariantMap() const override
Saves this parameter to a QVariantMap.
QString valueAsPythonString(const QVariant &value, QgsProcessingContext &context) const override
Returns a string version of the parameter input value, which is suitable for use as an input paramete...
void setDataType(Qgis::ProcessingNumberParameterType dataType)
Sets the acceptable data type for the range.
QString type() const override
Unique parameter type name.
static QgsProcessingParameterRange * fromScriptCode(const QString &name, const QString &description, bool isOptional, const QString &definition)
Creates a new parameter using the definition from a script code.
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
QString valueAsPythonString(const QVariant &value, QgsProcessingContext &context) const override
Returns a string version of the parameter input value, which is suitable for use as an input paramete...
QgsProcessingOutputDefinition * toOutputDefinition() const override
Returns a new QgsProcessingOutputDefinition corresponding to the definition of the destination parame...
QString createFileFilter() const override
This method needs to be reimplemented in all classes which implement this interface and return a file...
QgsProcessingParameterRasterDestination(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), bool optional=false, bool createByDefault=true)
Constructor for QgsProcessingParameterRasterDestination.
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
static QgsProcessingParameterRasterDestination * fromScriptCode(const QString &name, const QString &description, bool isOptional, const QString &definition)
Creates a new parameter using the definition from a script code.
QString defaultFileExtension() const override
Returns the default file extension for destination file paths associated with this parameter.
QString defaultFileFormat() const
Returns the default file format for destination file paths associated with this parameter.
virtual Q_DECL_DEPRECATED QStringList supportedOutputRasterLayerExtensions() const
Returns a list of the raster format file extensions supported for this parameter.
static QString typeName()
Returns the type name for the parameter class.
bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
virtual QList< QPair< QString, QString > > supportedOutputRasterLayerFormatAndExtensions() const
Returns a list of (format, file extension) supported by this provider.
Qgis::RasterProcessingParameterCapabilities parameterCapabilities() const
Returns flags containing the supported capabilities of the raster layer parameter.
QString valueAsString(const QVariant &value, QgsProcessingContext &context, bool &ok) const override
Returns a string version of the parameter input value (if possible).
QString valueAsPythonString(const QVariant &value, QgsProcessingContext &context) const override
Returns a string version of the parameter input value, which is suitable for use as an input paramete...
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
static QgsProcessingParameterRasterLayer * fromScriptCode(const QString &name, const QString &description, bool isOptional, const QString &definition)
Creates a new parameter using the definition from a script code.
QVariant valueAsJsonObject(const QVariant &value, QgsProcessingContext &context) const override
Returns a version of the parameter input value, which is suitable for use in a JSON object.
bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
static QString typeName()
Returns the type name for the parameter class.
QgsProcessingParameterRasterLayer(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), bool optional=false)
Constructor for QgsProcessingParameterRasterLayer.
QString createFileFilter() const override
This method needs to be reimplemented in all classes which implement this interface and return a file...
void setParameterCapabilities(Qgis::RasterProcessingParameterCapabilities capabilities)
Sets the supported capabilities of the raster layer parameter.
QString type() const override
Unique parameter type name.
static QString typeName()
Returns the type name for the parameter class.
static QgsProcessingParameterScale * fromScriptCode(const QString &name, const QString &description, bool isOptional, const QString &definition)
Creates a new parameter using the definition from a script code.
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonOutputType::PythonQgsProcessingAlgorithmSubclass) const override
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
QgsProcessingParameterScale * clone() const override
Creates a clone of the parameter definition.
QgsProcessingParameterScale(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), bool optional=false)
Constructor for QgsProcessingParameterScale.
static QString typeName()
Returns the type name for the parameter class.
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
void setMultiLine(bool multiLine)
Sets whether the parameter allows multiline strings.
QVariantMap toVariantMap() const override
Saves this parameter to a QVariantMap.
QString asScriptCode() const override
Returns the parameter definition encoded in a string which can be used within a Processing script.
static QgsProcessingParameterString * fromScriptCode(const QString &name, const QString &description, bool isOptional, const QString &definition)
Creates a new parameter using the definition from a script code.
bool multiLine() const
Returns true if the parameter allows multiline strings.
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
QgsProcessingParameterString(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), bool multiLine=false, bool optional=false)
Constructor for QgsProcessingParameterString.
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonOutputType::PythonQgsProcessingAlgorithmSubclass) const override
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
QString valueAsPythonString(const QVariant &value, QgsProcessingContext &context) const override
Returns a string version of the parameter input value, which is suitable for use as an input paramete...
Makes metadata of processing parameters available.
virtual QgsProcessingParameterDefinition * create(const QString &name) const =0
Creates a new parameter of this type.
virtual QColor modelColor() const
Returns the color to use for the parameter in model designer windows.
static QColor defaultModelColor()
Returns the default color for a processing parameter.
QgsProcessingParameterVectorDestination(const QString &name, const QString &description=QString(), Qgis::ProcessingSourceType type=Qgis::ProcessingSourceType::VectorAnyGeometry, const QVariant &defaultValue=QVariant(), bool optional=false, bool createByDefault=true)
Constructor for QgsProcessingParameterVectorDestination.
QString defaultFileExtension() const override
Returns the default file extension for destination file paths associated with this parameter.
QString createFileFilter() const override
This method needs to be reimplemented in all classes which implement this interface and return a file...
QString type() const override
Unique parameter type name.
QVariantMap toVariantMap() const override
Saves this parameter to a QVariantMap.
static QString typeName()
Returns the type name for the parameter class.
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
Qgis::ProcessingSourceType dataType() const
Returns the layer type for this created vector layer.
bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
QString asScriptCode() const override
Returns the parameter definition encoded in a string which can be used within a Processing script.
virtual QStringList supportedOutputVectorLayerExtensions() const
Returns a list of the vector format file extensions supported by this parameter.
bool hasGeometry() const
Returns true if the created layer is likely to include geometries.
void setDataType(Qgis::ProcessingSourceType type)
Sets the layer type for the created vector layer.
QString valueAsPythonString(const QVariant &value, QgsProcessingContext &context) const override
Returns a string version of the parameter input value, which is suitable for use as an input paramete...
static QgsProcessingParameterVectorDestination * fromScriptCode(const QString &name, const QString &description, bool isOptional, const QString &definition)
Creates a new parameter using the definition from a script code.
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
QgsProcessingOutputDefinition * toOutputDefinition() const override
Returns a new QgsProcessingOutputDefinition corresponding to the definition of the destination parame...
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonOutputType::PythonQgsProcessingAlgorithmSubclass) const override
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonOutputType::PythonQgsProcessingAlgorithmSubclass) const override
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
static QgsProcessingParameterVectorLayer * fromScriptCode(const QString &name, const QString &description, bool isOptional, const QString &definition)
Creates a new parameter using the definition from a script code.
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
QString valueAsString(const QVariant &value, QgsProcessingContext &context, bool &ok) const override
Returns a string version of the parameter input value (if possible).
QVariantMap toVariantMap() const override
Saves this parameter to a QVariantMap.
QString type() const override
Unique parameter type name.
QString createFileFilter() const override
This method needs to be reimplemented in all classes which implement this interface and return a file...
QgsProcessingParameterVectorLayer(const QString &name, const QString &description=QString(), const QList< int > &types=QList< int >(), const QVariant &defaultValue=QVariant(), bool optional=false)
Constructor for QgsProcessingParameterVectorLayer.
static QString typeName()
Returns the type name for the parameter class.
QVariant valueAsJsonObject(const QVariant &value, QgsProcessingContext &context) const override
Returns a version of the parameter input value, which is suitable for use in a JSON object.
QString valueAsPythonString(const QVariant &value, QgsProcessingContext &context) const override
Returns a string version of the parameter input value, which is suitable for use as an input paramete...
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
QgsProcessingOutputDefinition * toOutputDefinition() const override
Returns a new QgsProcessingOutputDefinition corresponding to the definition of the destination parame...
QString valueAsPythonString(const QVariant &value, QgsProcessingContext &context) const override
Returns a string version of the parameter input value, which is suitable for use as an input paramete...
QgsProcessingParameterVectorTileDestination(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), bool optional=false, bool createByDefault=true)
Constructor for QgsProcessingParameterVectorTileDestination.
bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
virtual QStringList supportedOutputVectorTileLayerExtensions() const
Returns a list of the point cloud format file extensions supported for this parameter.
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
static QgsProcessingParameterVectorTileDestination * fromScriptCode(const QString &name, const QString &description, bool isOptional, const QString &definition)
Creates a new parameter using the definition from a script code.
static QString typeName()
Returns the type name for the parameter class.
QString defaultFileExtension() const override
Returns the default file extension for destination file paths associated with this parameter.
QString createFileFilter() const override
This method needs to be reimplemented in all classes which implement this interface and return a file...
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
QString userFriendlyString(const QVariant &value) const override
Returns a user-friendly string representation of the provided parameter value.
static QString typeName()
Returns the type name for the parameter class.
QgsProcessingParameterVolume(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), const QString &parentParameterName=QString(), bool optional=false, double minValue=0, double maxValue=std::numeric_limits< double >::max())
Constructor for QgsProcessingParameterVolume.
Qgis::VolumeUnit defaultUnit() const
Returns the default volume unit for the parameter.
void setParentParameterName(const QString &parentParameterName)
Sets the name of the parent layer parameter.
QgsProcessingParameterVolume * clone() const override
Creates a clone of the parameter definition.
QVariantMap toVariantMap() const override
Saves this parameter to a QVariantMap.
QStringList dependsOnOtherParameters() const override
Returns a list of other parameter names on which this parameter is dependent (e.g.
QString parentParameterName() const
Returns the name of the parent parameter, or an empty string if this is not set.
QString type() const override
Unique parameter type name.
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonOutputType::PythonQgsProcessingAlgorithmSubclass) const override
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
static QString descriptionFromName(const QString &name)
Creates an autogenerated parameter description from a parameter name.
static int parameterAsEnum(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, const QgsProcessingContext &context)
Evaluates the parameter with matching definition to a enum value.
static double parameterAsDouble(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, const QgsProcessingContext &context)
Evaluates the parameter with matching definition to a static double value.
static QgsPointXY parameterAsPoint(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context, const QgsCoordinateReferenceSystem &crs=QgsCoordinateReferenceSystem())
Evaluates the parameter with matching definition to a point.
static QString parameterAsOutputLayer(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context)
Evaluates the parameter with matching definition to a output layer destination.
static QgsFeatureSink * parameterAsSink(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, const QgsFields &fields, Qgis::WkbType geometryType, const QgsCoordinateReferenceSystem &crs, QgsProcessingContext &context, QString &destinationIdentifier, QgsFeatureSink::SinkFlags sinkFlags=QgsFeatureSink::SinkFlags(), const QVariantMap &createOptions=QVariantMap(), const QStringList &datasourceOptions=QStringList(), const QStringList &layerOptions=QStringList())
Evaluates the parameter with matching definition to a feature sink.
static QgsPrintLayout * parameterAsLayout(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context)
Evaluates the parameter with matching definition to a print layout.
static QList< QgsMapLayer * > parameterAsLayerList(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context, QgsProcessing::LayerOptionsFlags flags=QgsProcessing::LayerOptionsFlags())
Evaluates the parameter with matching definition to a list of map layers.
static QTime parameterAsTime(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, const QgsProcessingContext &context)
Evaluates the parameter with matching definition to a static time value.
static QgsProcessingParameterDefinition * parameterFromVariantMap(const QVariantMap &map)
Creates a new QgsProcessingParameterDefinition using the configuration from a supplied variant map.
static QgsRectangle parameterAsExtent(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context, const QgsCoordinateReferenceSystem &crs=QgsCoordinateReferenceSystem())
Evaluates the parameter with matching definition to a rectangular extent.
static QgsCoordinateReferenceSystem parameterAsGeometryCrs(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context)
Returns the coordinate reference system associated with a geometry parameter value.
static QgsAnnotationLayer * parameterAsAnnotationLayer(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context)
Evaluates the parameter with matching definition to an annotation layer.
static QString parameterAsEnumString(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, const QgsProcessingContext &context)
Evaluates the parameter with matching definition to a static enum string.
static QList< double > parameterAsRange(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context)
Evaluates the parameter with matching definition to a range of values.
static QStringList parameterAsStrings(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context)
Evaluates the parameter with matching definition to a list of strings (e.g.
static QList< int > parameterAsInts(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, const QgsProcessingContext &context)
Evaluates the parameter with matching definition to a list of integer values.
static QString parameterAsConnectionName(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, const QgsProcessingContext &context)
Evaluates the parameter with matching definition to a connection name string.
static QgsProcessingFeatureSource * parameterAsSource(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context)
Evaluates the parameter with matching definition to a feature source.
static QString parameterAsFileOutput(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context)
Evaluates the parameter with matching definition to a file based output destination.
static bool parameterAsBoolean(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, const QgsProcessingContext &context)
Evaluates the parameter with matching definition to a static boolean value.
static QgsPointCloudLayer * parameterAsPointCloudLayer(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context, QgsProcessing::LayerOptionsFlags flags=QgsProcessing::LayerOptionsFlags())
Evaluates the parameter with matching definition to a point cloud layer.
static QgsCoordinateReferenceSystem parameterAsPointCrs(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context)
Returns the coordinate reference system associated with an point parameter value.
static QgsLayoutItem * parameterAsLayoutItem(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context, QgsPrintLayout *layout)
Evaluates the parameter with matching definition to a print layout item, taken from the specified lay...
static bool parameterAsBool(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, const QgsProcessingContext &context)
Evaluates the parameter with matching definition to a static boolean value.
static QString parameterAsCompatibleSourceLayerPathAndLayerName(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context, const QStringList &compatibleFormats, const QString &preferredFormat=QString("shp"), QgsProcessingFeedback *feedback=nullptr, QString *layerName=nullptr)
Evaluates the parameter with matching definition to a source vector layer file path and layer name of...
static QgsMeshLayer * parameterAsMeshLayer(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context)
Evaluates the parameter with matching definition and value to a mesh layer.
static QString parameterAsCompatibleSourceLayerPath(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context, const QStringList &compatibleFormats, const QString &preferredFormat=QString("shp"), QgsProcessingFeedback *feedback=nullptr)
Evaluates the parameter with matching definition to a source vector layer file path of compatible for...
static QgsProcessingParameterDefinition * parameterFromScriptCode(const QString &code)
Creates a new QgsProcessingParameterDefinition using the configuration from a supplied script code st...
static QColor parameterAsColor(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context)
Returns the color associated with an point parameter value, or an invalid color if the parameter was ...
static QgsVectorLayer * parameterAsVectorLayer(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context)
Evaluates the parameter with matching definition to a vector layer.
static QString parameterAsOutputFormat(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context)
Evaluates the parameter with matching definition to a output format.
static int parameterAsInt(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, const QgsProcessingContext &context)
Evaluates the parameter with matching definition to a static integer value.
static QString parameterAsDatabaseTableName(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, const QgsProcessingContext &context)
Evaluates the parameter with matching definition to a database table name.
static QString parameterAsSchema(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, const QgsProcessingContext &context)
Evaluates the parameter with matching definition to a database schema name.
static QgsGeometry parameterAsGeometry(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context, const QgsCoordinateReferenceSystem &crs=QgsCoordinateReferenceSystem())
Evaluates the parameter with matching definition to a geometry.
static QgsMapLayer * parameterAsLayer(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context, QgsProcessingUtils::LayerHint layerHint=QgsProcessingUtils::LayerHint::UnknownType, QgsProcessing::LayerOptionsFlags flags=QgsProcessing::LayerOptionsFlags())
Evaluates the parameter with matching definition to a map layer.
static QString parameterAsExpression(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, const QgsProcessingContext &context)
Evaluates the parameter with matching definition to an expression.
static QString parameterAsString(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, const QgsProcessingContext &context)
Evaluates the parameter with matching definition to a static string value.
static QgsRasterLayer * parameterAsRasterLayer(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context)
Evaluates the parameter with matching definition to a raster layer.
static QList< int > parameterAsEnums(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, const QgsProcessingContext &context)
Evaluates the parameter with matching definition to list of enum values.
static QStringList parameterAsEnumStrings(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, const QgsProcessingContext &context)
Evaluates the parameter with matching definition to list of static enum strings.
static QgsGeometry parameterAsExtentGeometry(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context, const QgsCoordinateReferenceSystem &crs=QgsCoordinateReferenceSystem())
Evaluates the parameter with matching definition to a rectangular extent, and returns a geometry cove...
static QStringList parameterAsFileList(const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context)
Evaluates the parameter with matching definition to a list of files (for QgsProcessingParameterMultip...
static bool isDynamic(const QVariantMap ¶meters, const QString &name)
Returns true if the parameter with matching name is a dynamic parameter, and must be evaluated once f...
static Q_DECL_DEPRECATED QStringList parameterAsFields(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context)
Evaluates the parameter with matching definition to a list of fields.
static QgsCoordinateReferenceSystem parameterAsExtentCrs(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context)
Returns the coordinate reference system associated with an extent parameter value.
static QDateTime parameterAsDateTime(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, const QgsProcessingContext &context)
Evaluates the parameter with matching definition to a static datetime value.
static QString parameterAsFile(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context)
Evaluates the parameter with matching definition to a file/folder name.
static QDate parameterAsDate(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, const QgsProcessingContext &context)
Evaluates the parameter with matching definition to a static date value.
static QVariantList parameterAsMatrix(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context)
Evaluates the parameter with matching definition to a matrix/table of values.
static QgsCoordinateReferenceSystem parameterAsCrs(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context)
Evaluates the parameter with matching definition to a coordinate reference system.
Abstract base class for processing providers.
virtual bool isSupportedOutputValue(const QVariant &outputValue, const QgsProcessingDestinationParameter *parameter, QgsProcessingContext &context, QString &error) const
Returns true if the specified outputValue is of a supported file format for the given destination par...
static QList< QPair< QString, QString > > supportedOutputRasterLayerFormatAndExtensionsDefault()
Returns a list of (format, file extension) supported by GDAL.
Encapsulates settings relating to a raster layer input to a processing algorithm.
double referenceScale
If set to a value > 0, sets a scale at which a raster (e.g., a WMS) should be requested or rendered.
int dpi
Indicates the resolution of the raster source (e.g., a WMS server).
QgsProperty source
Source definition.
bool loadVariant(const QVariantMap &map)
Loads this raster layer definition from a QVariantMap, wrapped in a QVariant.
QVariant toVariant() const
Saves this raster layer definition to a QVariantMap, wrapped in a QVariant.
QgsProcessingParameterType * parameterType(const QString &id) const
Returns the parameter type registered for id.
static QString stringToPythonLiteral(const QString &string)
Converts a string to a Python string literal.
static QString defaultVectorExtension()
Returns the default vector extension to use, in the absence of all other constraints (e....
static QString layerToStringIdentifier(const QgsMapLayer *layer, const QString &layerName=QString())
Returns a string representation of the source for a layer.
static QString generateTempFilename(const QString &basename, const QgsProcessingContext *context=nullptr)
Returns a temporary filename for a given file, putting it into a temporary folder (creating that fold...
static QString encodeProviderKeyAndUri(const QString &providerKey, const QString &uri)
Encodes a provider key and layer uri to a single string, for use with decodeProviderKeyAndUri().
LayerHint
Layer type hints.
@ Annotation
Annotation layer type, since QGIS 3.22.
@ Vector
Vector layer type.
@ VectorTile
Vector tile layer type, since QGIS 3.32.
@ Mesh
Mesh layer type, since QGIS 3.6.
@ Raster
Raster layer type.
@ UnknownType
Unknown layer type.
@ PointCloud
Point cloud layer type, since QGIS 3.22.
static QString defaultRasterFormat()
Returns the default raster format to use, in the absence of all other constraints (e....
static QgsProcessingFeatureSource * variantToSource(const QVariant &value, QgsProcessingContext &context, const QVariant &fallbackValue=QVariant())
Converts a variant value to a new feature source.
static QString variantToPythonLiteral(const QVariant &value)
Converts a variant to a Python literal.
static QgsCoordinateReferenceSystem variantToCrs(const QVariant &value, QgsProcessingContext &context, const QVariant &fallbackValue=QVariant())
Converts a variant value to a coordinate reference system.
static QString convertToCompatibleFormatAndLayerName(const QgsVectorLayer *layer, bool selectedFeaturesOnly, const QString &baseName, const QStringList &compatibleFormats, const QString &preferredFormat, QgsProcessingContext &context, QgsProcessingFeedback *feedback, QString &layerName, long long featureLimit=-1, const QString &filterExpression=QString())
Converts a source vector layer to a file path and layer name of a vector layer of compatible format.
static QString convertToCompatibleFormat(const QgsVectorLayer *layer, bool selectedFeaturesOnly, const QString &baseName, const QStringList &compatibleFormats, const QString &preferredFormat, QgsProcessingContext &context, QgsProcessingFeedback *feedback, long long featureLimit=-1, const QString &filterExpression=QString())
Converts a source vector layer to a file path of a vector layer of compatible format.
static QgsFeatureSink * createFeatureSink(QString &destination, QgsProcessingContext &context, const QgsFields &fields, Qgis::WkbType geometryType, const QgsCoordinateReferenceSystem &crs, const QVariantMap &createOptions=QVariantMap(), const QStringList &datasourceOptions=QStringList(), const QStringList &layerOptions=QStringList(), QgsFeatureSink::SinkFlags sinkFlags=QgsFeatureSink::SinkFlags(), QgsRemappingSinkDefinition *remappingDefinition=nullptr)
Creates a feature sink ready for adding features.
static QString defaultVectorTileExtension()
Returns the default vector tile extension to use, in the absence of all other constraints (e....
static QgsMapLayer * mapLayerFromString(const QString &string, QgsProcessingContext &context, bool allowLoadingNewLayers=true, QgsProcessingUtils::LayerHint typeHint=QgsProcessingUtils::LayerHint::UnknownType, QgsProcessing::LayerOptionsFlags flags=QgsProcessing::LayerOptionsFlags())
Interprets a string as a map layer within the supplied context.
static QString defaultPointCloudExtension()
Returns the default point cloud extension to use, in the absence of all other constraints (e....
QFlags< LayerOptionsFlag > LayerOptionsFlags
static const QString TEMPORARY_OUTPUT
Constant used to indicate that a Processing algorithm output should be a temporary layer/file.
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()