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 QVariant settingValue = s.
value( u
"/Processing/DefaultGuiParam/%1/%2"_s.arg(
mAlgorithm->id() ).arg(
mName ) );
2609 if ( settingValue.isValid() )
2611 return settingValue;
2619 if ( !input.isValid() && !
mDefault.isValid() )
2622 if ( ( input.userType() == QMetaType::Type::QString && input.toString().isEmpty() ) || ( !input.isValid() &&
mDefault.userType() == QMetaType::Type::QString &&
mDefault.toString().isEmpty() ) )
2630 if ( !value.isValid() )
2633 if ( value.userType() == qMetaTypeId<QgsProperty>() )
2646 if ( !value.isValid() )
2650 if ( value.userType() == QMetaType::Type::QVariantMap )
2652 const QVariantMap sourceMap = value.toMap();
2653 QVariantMap resultMap;
2654 for (
auto it = sourceMap.constBegin(); it != sourceMap.constEnd(); it++ )
2660 else if ( value.userType() == QMetaType::Type::QVariantList || value.userType() == QMetaType::Type::QStringList )
2662 const QVariantList sourceList = value.toList();
2663 QVariantList resultList;
2664 resultList.reserve( sourceList.size() );
2665 for (
const QVariant &v : sourceList )
2673 switch ( value.userType() )
2676 case QMetaType::Bool:
2677 case QMetaType::Char:
2678 case QMetaType::Int:
2679 case QMetaType::Double:
2680 case QMetaType::Float:
2681 case QMetaType::LongLong:
2682 case QMetaType::ULongLong:
2683 case QMetaType::UInt:
2684 case QMetaType::ULong:
2685 case QMetaType::UShort:
2692 if ( value.userType() == qMetaTypeId<QgsProperty>() )
2702 return QVariantMap( { { u
"type"_s, u
"data_defined"_s }, { u
"field"_s, prop.
field() } } );
2704 return QVariantMap( { { u
"type"_s, u
"data_defined"_s }, { u
"expression"_s, prop.
expressionString() } } );
2709 if ( value.userType() == qMetaTypeId<QgsCoordinateReferenceSystem>() )
2714 else if ( !crs.
authid().isEmpty() )
2719 else if ( value.userType() == qMetaTypeId<QgsRectangle>() )
2724 else if ( value.userType() == qMetaTypeId<QgsReferencedRectangle>() )
2729 else if ( value.userType() == qMetaTypeId< QgsGeometry>() )
2741 else if ( value.userType() == qMetaTypeId<QgsReferencedGeometry>() )
2756 else if ( value.userType() == qMetaTypeId<QgsPointXY>() )
2761 else if ( value.userType() == qMetaTypeId<QgsReferencedPointXY>() )
2766 else if ( value.userType() == qMetaTypeId<QgsProcessingFeatureSourceDefinition>() )
2773 else if ( value.userType() == qMetaTypeId<QgsProcessingRasterLayerDefinition>() )
2780 else if ( value.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
2785 else if ( value.userType() == qMetaTypeId<QColor>() )
2787 const QColor fromVar = value.value< QColor >();
2788 if ( !fromVar.isValid() )
2791 return u
"rgba( %1, %2, %3, %4 )"_s.arg( fromVar.red() ).arg( fromVar.green() ).arg( fromVar.blue() ).arg( QString::number( fromVar.alphaF(),
'f', 2 ) );
2793 else if ( value.userType() == qMetaTypeId<QDateTime>() )
2795 const QDateTime fromVar = value.toDateTime();
2796 if ( !fromVar.isValid() )
2799 return fromVar.toString( Qt::ISODate );
2801 else if ( value.userType() == qMetaTypeId<QDate>() )
2803 const QDate fromVar = value.toDate();
2804 if ( !fromVar.isValid() )
2807 return fromVar.toString( Qt::ISODate );
2809 else if ( value.userType() == qMetaTypeId<QTime>() )
2811 const QTime fromVar = value.toTime();
2812 if ( !fromVar.isValid() )
2815 return fromVar.toString( Qt::ISODate );
2822 p.insert(
name(), value );
2830 if ( value.userType() == QMetaType::QString )
2835 Q_ASSERT_X(
false,
"QgsProcessingParameterDefinition::valueAsJsonObject", u
"unsupported variant type %1"_s.arg( QMetaType::typeName( value.userType() ) ).toLocal8Bit() );
2848 if ( !value.isValid() )
2851 switch ( value.userType() )
2854 case QMetaType::Bool:
2855 case QMetaType::Char:
2856 case QMetaType::Int:
2857 case QMetaType::Double:
2858 case QMetaType::Float:
2859 case QMetaType::LongLong:
2860 case QMetaType::ULongLong:
2861 case QMetaType::UInt:
2862 case QMetaType::ULong:
2863 case QMetaType::UShort:
2864 return value.toString();
2870 if ( value.userType() == qMetaTypeId<QgsProperty>() )
2880 return u
"field:%1"_s.arg( prop.
field() );
2887 if ( value.userType() == qMetaTypeId<QgsCoordinateReferenceSystem>() )
2892 else if ( !crs.
authid().isEmpty() )
2897 else if ( value.userType() == qMetaTypeId<QgsRectangle>() )
2902 else if ( value.userType() == qMetaTypeId<QgsReferencedRectangle>() )
2907 else if ( value.userType() == qMetaTypeId< QgsGeometry>() )
2919 else if ( value.userType() == qMetaTypeId<QgsReferencedGeometry>() )
2934 else if ( value.userType() == qMetaTypeId<QgsPointXY>() )
2939 else if ( value.userType() == qMetaTypeId<QgsReferencedPointXY>() )
2944 else if ( value.userType() == qMetaTypeId<QgsProcessingFeatureSourceDefinition>() )
2949 else if ( value.userType() == qMetaTypeId<QgsProcessingRasterLayerDefinition>() )
2954 else if ( value.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
2959 else if ( value.userType() == qMetaTypeId<QColor>() )
2961 const QColor fromVar = value.value< QColor >();
2962 if ( !fromVar.isValid() )
2965 return u
"rgba( %1, %2, %3, %4 )"_s.arg( fromVar.red() ).arg( fromVar.green() ).arg( fromVar.blue() ).arg( QString::number( fromVar.alphaF(),
'f', 2 ) );
2967 else if ( value.userType() == qMetaTypeId<QDateTime>() )
2969 const QDateTime fromVar = value.toDateTime();
2970 if ( !fromVar.isValid() )
2973 return fromVar.toString( Qt::ISODate );
2975 else if ( value.userType() == qMetaTypeId<QDate>() )
2977 const QDate fromVar = value.toDate();
2978 if ( !fromVar.isValid() )
2981 return fromVar.toString( Qt::ISODate );
2983 else if ( value.userType() == qMetaTypeId<QTime>() )
2985 const QTime fromVar = value.toTime();
2986 if ( !fromVar.isValid() )
2989 return fromVar.toString( Qt::ISODate );
2996 p.insert(
name(), value );
3004 if ( value.userType() == QMetaType::QString )
3005 return value.toString();
3008 QgsDebugError( u
"unsupported variant type %1"_s.arg( QMetaType::typeName( value.userType() ) ) );
3010 return value.toString();
3016 if ( !value.isValid() )
3017 return QStringList();
3019 if ( value.userType() == QMetaType::Type::QVariantList || value.userType() == QMetaType::Type::QStringList )
3021 const QVariantList sourceList = value.toList();
3022 QStringList resultList;
3023 resultList.reserve( sourceList.size() );
3024 for (
const QVariant &v : sourceList )
3033 return QStringList();
3045 QString code = u
"##%1="_s.arg(
mName );
3047 code +=
"optional "_L1;
3048 code +=
type() +
' ';
3050 return code.trimmed();
3058 switch ( outputType )
3064 code +=
", optional=True"_L1;
3080 map.insert( u
"parameter_type"_s,
type() );
3081 map.insert( u
"name"_s,
mName );
3083 map.insert( u
"help"_s,
mHelp );
3084 map.insert( u
"default"_s,
mDefault );
3086 map.insert( u
"flags"_s,
static_cast< int >(
mFlags ) );
3093 mName = map.value( u
"name"_s ).toString();
3094 mDescription = map.value( u
"description"_s ).toString();
3095 mHelp = map.value( u
"help"_s ).toString();
3096 mDefault = map.value( u
"default"_s );
3099 mMetadata = map.value( u
"metadata"_s ).toMap();
3115 QString text = u
"<p><b>%1</b></p>"_s.arg(
description() );
3116 if ( !
help().isEmpty() )
3118 text += u
"<p>%1</p>"_s.arg(
help() );
3120 text += u
"<p>%1</p>"_s.arg( QObject::tr(
"Python identifier: ‘%1’" ).arg( u
"<i>%1</i>"_s.arg(
name() ) ) );
3149 if ( value.userType() == qMetaTypeId<QgsPointXY>() )
3155 else if ( value.userType() == qMetaTypeId<QgsReferencedPointXY>() )
3161 else if ( value.userType() == qMetaTypeId<QgsRectangle>() )
3167 else if ( value.userType() == qMetaTypeId<QgsReferencedRectangle>() )
3177 else if ( value.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
3190 return value.toString();
3196 if ( !val.isValid() )
3199 if ( val.userType() == qMetaTypeId<QgsProperty>() )
3201 return val.toBool() ? u
"True"_s : u
"False"_s;
3206 QString code = u
"##%1="_s.arg(
mName );
3208 code +=
"optional "_L1;
3209 code +=
type() +
' ';
3210 code +=
mDefault.toBool() ? u
"true"_s : u
"false"_s;
3211 return code.trimmed();
3231 if ( !input.isValid() )
3239 if ( input.userType() == qMetaTypeId<QgsCoordinateReferenceSystem>() )
3243 else if ( input.userType() == qMetaTypeId<QgsProcessingFeatureSourceDefinition>() )
3247 else if ( input.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
3252 if ( input.userType() == qMetaTypeId<QgsProperty>() )
3257 if ( input.type() == QVariant::String )
3259 const QString
string = input.toString();
3260 if (
string.compare(
"ProjectCrs"_L1, Qt::CaseInsensitive ) == 0 )
3269 if ( qobject_cast< QgsMapLayer * >( qvariant_cast<QObject *>( input ) ) )
3272 if ( input.userType() != QMetaType::Type::QString || input.toString().isEmpty() )
3280 if ( !value.isValid() )
3283 if ( value.userType() == qMetaTypeId<QgsCoordinateReferenceSystem>() )
3286 return u
"QgsCoordinateReferenceSystem()"_s;
3291 if ( value.userType() == qMetaTypeId<QgsProperty>() )
3294 if ( value.type() == QVariant::String )
3296 const QString
string = value.toString();
3297 if (
string.compare(
"ProjectCrs"_L1, Qt::CaseInsensitive ) == 0 )
3306 p.insert(
name(), value );
3316 if ( value.type() == QVariant::String )
3318 const QString
string = value.toString();
3319 if (
string.compare(
"ProjectCrs"_L1, Qt::CaseInsensitive ) == 0 )
3332 if ( value.type() == QVariant::String )
3334 const QString
string = value.toString();
3335 if (
string.compare(
"ProjectCrs"_L1, Qt::CaseInsensitive ) == 0 )
3361 return QObject::tr(
"Invalid CRS" );
3379 if ( !input.isValid() )
3387 if ( input.userType() == qMetaTypeId<QgsProperty>() )
3392 if ( qobject_cast< QgsMapLayer * >( qvariant_cast<QObject *>( input ) ) )
3397 if ( input.userType() != QMetaType::Type::QString || input.toString().isEmpty() )
3415 if ( !val.isValid() )
3418 if ( val.userType() == qMetaTypeId<QgsProperty>() )
3422 p.insert(
name(), val );
3441 for (
const QString &raster : rasters )
3443 if ( !vectors.contains( raster ) )
3447 for (
const QString &mesh : meshFilters )
3449 if ( !vectors.contains( mesh ) )
3453 for (
const QString &pointCloud : pointCloudFilters )
3455 if ( !vectors.contains( pointCloud ) )
3456 vectors << pointCloud;
3458 vectors.removeAll( QObject::tr(
"All files (*.*)" ) );
3459 std::sort( vectors.begin(), vectors.end() );
3461 return QObject::tr(
"All files (*.*)" ) + u
";;"_s + vectors.join(
";;"_L1 );
3471 QString code = u
"##%1="_s.arg(
mName );
3473 code +=
"optional "_L1;
3474 code +=
"layer "_L1;
3481 code +=
"table "_L1;
3485 code +=
"hasgeometry "_L1;
3489 code +=
"point "_L1;
3497 code +=
"polygon "_L1;
3501 code +=
"raster "_L1;
3509 code +=
"plugin "_L1;
3513 code +=
"pointcloud "_L1;
3517 code +=
"annotation "_L1;
3521 code +=
"vectortile "_L1;
3525 code +=
"tiledscene "_L1;
3534 return code.trimmed();
3540 QString def = definition;
3543 if ( def.startsWith(
"table"_L1, Qt::CaseInsensitive ) )
3549 if ( def.startsWith(
"hasgeometry"_L1, Qt::CaseInsensitive ) )
3552 def = def.mid( 12 );
3555 else if ( def.startsWith(
"point"_L1, Qt::CaseInsensitive ) )
3561 else if ( def.startsWith(
"line"_L1, Qt::CaseInsensitive ) )
3567 else if ( def.startsWith(
"polygon"_L1, Qt::CaseInsensitive ) )
3573 else if ( def.startsWith(
"raster"_L1, Qt::CaseInsensitive ) )
3579 else if ( def.startsWith(
"mesh"_L1, Qt::CaseInsensitive ) )
3585 else if ( def.startsWith(
"plugin"_L1, Qt::CaseInsensitive ) )
3591 else if ( def.startsWith(
"pointcloud"_L1, Qt::CaseInsensitive ) )
3594 def = def.mid( 11 );
3597 else if ( def.startsWith(
"annotation"_L1, Qt::CaseInsensitive ) )
3600 def = def.mid( 11 );
3603 else if ( def.startsWith(
"vectortile"_L1, Qt::CaseInsensitive ) )
3606 def = def.mid( 11 );
3609 else if ( def.startsWith(
"tiledscene"_L1, Qt::CaseInsensitive ) )
3612 def = def.mid( 11 );
3623 switch ( outputType )
3629 code +=
", optional=True"_L1;
3636 QStringList options;
3640 code += u
", types=[%1])"_s.arg( options.join(
',' ) );
3661 map.insert( u
"data_types"_s, types );
3669 const QVariantList values = map.value( u
"data_types"_s ).toList();
3670 for (
const QVariant &val : values )
3689 if ( !input.isValid() )
3697 if ( input.userType() == qMetaTypeId<QgsProcessingFeatureSourceDefinition>() )
3701 else if ( input.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
3706 if ( input.userType() == qMetaTypeId<QgsProperty>() )
3711 if ( input.userType() == qMetaTypeId<QgsRectangle>() )
3716 if ( input.userType() == qMetaTypeId< QgsGeometry>() )
3720 if ( input.userType() == qMetaTypeId<QgsReferencedRectangle>() )
3727 if ( qobject_cast< QgsMapLayer * >( qvariant_cast<QObject *>( input ) ) )
3730 if ( input.userType() != QMetaType::Type::QString || input.toString().isEmpty() )
3733 if ( variantIsValidStringForExtent( input ) )
3746bool QgsProcessingParameterExtent::variantIsValidStringForExtent(
const QVariant &value )
3748 if ( value.userType() == QMetaType::Type::QString )
3750 const thread_local QRegularExpression rx( u
"^(.*?)\\s*,\\s*(.*?)\\s*,\\s*(.*?)\\s*,\\s*(.*?)\\s*(?:\\[(.*)\\])?\\s*$"_s );
3751 const QRegularExpressionMatch match = rx.match( value.toString() );
3752 if ( match.hasMatch() )
3754 bool xMinOk =
false;
3755 ( void ) match.captured( 1 ).toDouble( &xMinOk );
3756 bool xMaxOk =
false;
3757 ( void ) match.captured( 2 ).toDouble( &xMaxOk );
3758 bool yMinOk =
false;
3759 ( void ) match.captured( 3 ).toDouble( &yMinOk );
3760 bool yMaxOk =
false;
3761 ( void ) match.captured( 4 ).toDouble( &yMaxOk );
3762 if ( xMinOk && xMaxOk && yMinOk && yMaxOk )
3771 if ( !value.isValid() )
3774 if ( value.userType() == qMetaTypeId<QgsProperty>() )
3777 if ( value.userType() == qMetaTypeId<QgsRectangle>() )
3782 else if ( value.userType() == qMetaTypeId<QgsReferencedRectangle>() )
3787 else if ( value.userType() == qMetaTypeId< QgsGeometry>() )
3792 const QString wkt = g.
asWkt();
3793 return u
"QgsGeometry.fromWkt('%1')"_s.arg( wkt );
3796 else if ( variantIsValidStringForExtent( value ) )
3802 p.insert(
name(), value );
3812 if ( variantIsValidStringForExtent( value ) )
3814 return value.toString();
3822 if ( variantIsValidStringForExtent( value ) )
3847 if ( !input.isValid() )
3855 if ( input.userType() == qMetaTypeId<QgsProperty>() )
3860 if ( input.userType() == qMetaTypeId<QgsPointXY>() )
3864 if ( input.userType() == qMetaTypeId<QgsReferencedPointXY>() )
3868 if ( input.userType() == qMetaTypeId< QgsGeometry>() )
3873 if ( input.userType() == QMetaType::Type::QString )
3875 if ( input.toString().isEmpty() )
3879 const thread_local QRegularExpression rx( u
"^\\s*\\(?\\s*(.*?)\\s*,\\s*(.*?)\\s*(?:\\[(.*)\\])?\\s*\\)?\\s*$"_s );
3881 const QRegularExpressionMatch match = rx.match( input.toString() );
3882 if ( match.hasMatch() )
3885 ( void ) match.captured( 1 ).toDouble( &xOk );
3887 ( void ) match.captured( 2 ).toDouble( &yOk );
3896 if ( !value.isValid() )
3899 if ( value.userType() == qMetaTypeId<QgsProperty>() )
3902 if ( value.userType() == qMetaTypeId<QgsPointXY>() )
3907 else if ( value.userType() == qMetaTypeId<QgsReferencedPointXY>() )
3912 else if ( value.userType() == qMetaTypeId< QgsGeometry>() )
3917 const QString wkt = g.
asWkt();
3918 return u
"QgsGeometry.fromWkt('%1')"_s.arg( wkt );
3947 if ( !input.isValid() )
3955 if ( input.userType() == qMetaTypeId<QgsProperty>() )
3962 if ( input.userType() == qMetaTypeId< QgsGeometry>() )
3967 if ( input.userType() == qMetaTypeId<QgsReferencedGeometry>() )
3972 if ( input.userType() == qMetaTypeId<QgsPointXY>() )
3977 if ( input.userType() == qMetaTypeId<QgsRectangle>() )
3982 if ( input.userType() == qMetaTypeId<QgsReferencedPointXY>() )
3987 if ( input.userType() == qMetaTypeId<QgsReferencedRectangle>() )
3992 if ( input.userType() == QMetaType::Type::QString )
3994 if ( input.toString().isEmpty() )
3999 const thread_local QRegularExpression rx( u
"^\\s*(?:CRS=(.*);)?(.*?)$"_s );
4001 const QRegularExpressionMatch match = rx.match( input.toString() );
4002 if ( match.hasMatch() )
4007 return ( anyTypeAllowed || mGeomTypes.contains(
static_cast< int >( g.
type() ) ) ) && ( mAllowMultipart || !g.
isMultipart() );
4020 if ( !crs.isValid() )
4026 if ( !value.isValid() )
4029 if ( value.userType() == qMetaTypeId<QgsProperty>() )
4032 if ( value.userType() == qMetaTypeId< QgsGeometry>() )
4039 if ( value.userType() == qMetaTypeId<QgsReferencedGeometry>() )
4046 if ( value.userType() == qMetaTypeId<QgsPointXY>() )
4053 if ( value.userType() == qMetaTypeId<QgsReferencedPointXY>() )
4060 if ( value.userType() == qMetaTypeId<QgsRectangle>() )
4067 if ( value.userType() == qMetaTypeId<QgsReferencedRectangle>() )
4079 QString code = u
"##%1="_s.arg(
mName );
4081 code +=
"optional "_L1;
4082 code +=
type() +
' ';
4084 for (
const int type : mGeomTypes )
4089 code +=
"point "_L1;
4097 code +=
"polygon "_L1;
4101 code +=
"unknown "_L1;
4107 return code.trimmed();
4112 switch ( outputType )
4118 code +=
", optional=True"_L1;
4120 if ( !mGeomTypes.empty() )
4126 return u
"PointGeometry"_s;
4129 return u
"LineGeometry"_s;
4132 return u
"PolygonGeometry"_s;
4135 return u
"UnknownGeometry"_s;
4138 return u
"NullGeometry"_s;
4143 QStringList options;
4144 options.reserve( mGeomTypes.size() );
4145 for (
const int type : mGeomTypes )
4149 code += u
", geometryTypes=[%1 ]"_s.arg( options.join(
',' ) );
4152 if ( !mAllowMultipart )
4154 code +=
", allowMultipart=False"_L1;
4169 for (
const int type : mGeomTypes )
4173 map.insert( u
"geometrytypes"_s, types );
4174 map.insert( u
"multipart"_s, mAllowMultipart );
4182 const QVariantList values = map.value( u
"geometrytypes"_s ).toList();
4183 for (
const QVariant &val : values )
4185 mGeomTypes << val.toInt();
4187 mAllowMultipart = map.value( u
"multipart"_s ).toBool();
4201 if ( value.isValid() )
4203 if ( value.userType() == qMetaTypeId< QgsGeometry>() )
4209 else if ( value.userType() == qMetaTypeId<QgsReferencedGeometry>() )
4219 else if ( value.userType() == QMetaType::QString )
4231 return QObject::tr(
"Invalid geometry" );
4251 if ( !input.isValid() )
4259 if ( input.userType() == qMetaTypeId<QgsProperty>() )
4264 const QString
string = input.toString().trimmed();
4266 if ( input.userType() != QMetaType::Type::QString ||
string.isEmpty() )
4269 switch ( mBehavior )
4273 if ( !mExtension.isEmpty() )
4275 return string.endsWith( mExtension, Qt::CaseInsensitive );
4277 else if ( !mFileFilter.isEmpty() )
4295 QString code = u
"##%1="_s.arg(
mName );
4297 code +=
"optional "_L1;
4300 return code.trimmed();
4305 switch ( outputType )
4311 code +=
", optional=True"_L1;
4313 if ( !mExtension.isEmpty() )
4314 code += u
", extension='%1'"_s.arg( mExtension );
4315 if ( !mFileFilter.isEmpty() )
4316 code += u
", fileFilter='%1'"_s.arg( mFileFilter );
4327 switch ( mBehavior )
4331 if ( !mFileFilter.isEmpty() )
4332 return mFileFilter != QObject::tr(
"All files (*.*)" ) ? mFileFilter + u
";;"_s + QObject::tr(
"All files (*.*)" ) : mFileFilter;
4333 else if ( !mExtension.isEmpty() )
4334 return QObject::tr(
"%1 files" ).arg( mExtension.toUpper() ) + u
" (*."_s + mExtension.toLower() + u
");;"_s + QObject::tr(
"All files (*.*)" );
4336 return QObject::tr(
"All files (*.*)" );
4348 mFileFilter.clear();
4358 mFileFilter = filter;
4365 map.insert( u
"behavior"_s,
static_cast< int >( mBehavior ) );
4366 map.insert( u
"extension"_s, mExtension );
4367 map.insert( u
"filefilter"_s, mFileFilter );
4375 mExtension = map.value( u
"extension"_s ).toString();
4376 mFileFilter = map.value( u
"filefilter"_s ).toString();
4393 , mFixedNumberRows( fixedNumberRows )
4404 if ( !input.isValid() )
4412 if ( input.userType() == QMetaType::Type::QString )
4414 if ( input.toString().isEmpty() )
4418 else if ( input.userType() == QMetaType::Type::QVariantList )
4420 if ( input.toList().isEmpty() )
4424 else if ( input.userType() == QMetaType::Type::Double || input.userType() == QMetaType::Type::Int )
4434 if ( !value.isValid() )
4437 if ( value.userType() == qMetaTypeId<QgsProperty>() )
4441 p.insert(
name(), value );
4449 switch ( outputType )
4455 code +=
", optional=True"_L1;
4456 code += u
", numberRows=%1"_s.arg( mNumberRows );
4457 code += u
", hasFixedNumberRows=%1"_s.arg( mFixedNumberRows ? u
"True"_s : u
"False"_s );
4460 headers.reserve( mHeaders.size() );
4461 for (
const QString &h : mHeaders )
4463 code += u
", headers=[%1]"_s.arg(
headers.join(
',' ) );
4495 return mFixedNumberRows;
4500 mFixedNumberRows = fixedNumberRows;
4506 map.insert( u
"headers"_s, mHeaders );
4507 map.insert( u
"rows"_s, mNumberRows );
4508 map.insert( u
"fixed_number_rows"_s, mFixedNumberRows );
4515 mHeaders = map.value( u
"headers"_s ).toStringList();
4516 mNumberRows = map.value( u
"rows"_s ).toInt();
4517 mFixedNumberRows = map.value( u
"fixed_number_rows"_s ).toBool();
4539 if ( !input.isValid() )
4549 if ( qobject_cast< QgsMapLayer * >( qvariant_cast<QObject *>( input ) ) )
4555 if ( input.userType() == QMetaType::Type::QString )
4557 if ( input.toString().isEmpty() )
4560 if ( mMinimumNumberInputs > 1 )
4571 else if ( input.userType() == QMetaType::Type::QVariantList )
4573 if ( input.toList().count() < mMinimumNumberInputs )
4576 if ( mMinimumNumberInputs > input.toList().count() )
4584 const auto constToList = input.toList();
4585 for (
const QVariant &v : constToList )
4587 if ( qobject_cast< QgsMapLayer * >( qvariant_cast<QObject *>( v ) ) )
4596 else if ( input.userType() == QMetaType::Type::QStringList )
4598 if ( input.toStringList().count() < mMinimumNumberInputs )
4601 if ( mMinimumNumberInputs > input.toStringList().count() )
4609 const auto constToStringList = input.toStringList();
4610 for (
const QString &v : constToStringList )
4623 if ( !value.isValid() )
4626 if ( value.userType() == qMetaTypeId<QgsProperty>() )
4632 if ( value.userType() == QMetaType::Type::QStringList )
4634 const QStringList list = value.toStringList();
4635 parts.reserve( list.count() );
4636 for (
const QString &v : list )
4639 else if ( value.userType() == QMetaType::Type::QVariantList )
4641 const QVariantList list = value.toList();
4642 parts.reserve( list.count() );
4643 for (
const QVariant &v : list )
4646 if ( !parts.isEmpty() )
4647 return parts.join(
',' ).prepend(
'[' ).append(
']' );
4652 p.insert(
name(), value );
4654 if ( !list.isEmpty() )
4657 parts.reserve( list.count() );
4662 return parts.join(
',' ).prepend(
'[' ).append(
']' );
4681 QString code = u
"##%1="_s.arg(
mName );
4683 code +=
"optional "_L1;
4684 switch ( mLayerType )
4687 code +=
"multiple raster"_L1;
4691 code +=
"multiple file"_L1;
4695 code +=
"multiple vector"_L1;
4699 if (
mDefault.userType() == QMetaType::Type::QVariantList )
4702 const auto constToList =
mDefault.toList();
4703 for (
const QVariant &var : constToList )
4705 parts << var.toString();
4707 code += parts.join(
',' );
4709 else if (
mDefault.userType() == QMetaType::Type::QStringList )
4711 code +=
mDefault.toStringList().join(
',' );
4717 return code.trimmed();
4722 switch ( outputType )
4728 code +=
", optional=True"_L1;
4732 code += u
", layerType=%1"_s.arg(
layerType );
4743 switch ( mLayerType )
4746 return QObject::tr(
"All files (*.*)" );
4786 return mMinimumNumberInputs;
4798 map.insert( u
"layer_type"_s,
static_cast< int >( mLayerType ) );
4799 map.insert( u
"min_inputs"_s, mMinimumNumberInputs );
4807 mMinimumNumberInputs = map.value( u
"min_inputs"_s ).toInt();
4813 QString
type = definition;
4815 const thread_local QRegularExpression re( u
"(.*?)\\s+(.*)"_s );
4816 const QRegularExpressionMatch m = re.match( definition );
4819 type = m.captured( 1 ).toLower().trimmed();
4820 defaultVal = m.captured( 2 );
4823 if (
type ==
"vector"_L1 )
4825 else if (
type ==
"raster"_L1 )
4827 else if (
type ==
"file"_L1 )
4842 QgsMessageLog::logMessage( QObject::tr(
"Invalid number parameter \"%1\": min value %2 is >= max value %3!" ).arg(
name ).arg( mMin ).arg( mMax ), QObject::tr(
"Processing" ) );
4853 QVariant input = value;
4854 if ( !input.isValid() )
4862 if ( input.userType() == qMetaTypeId<QgsProperty>() )
4868 const double res = input.toDouble( &ok );
4872 return !( res < mMin || res > mMax );
4877 if ( !value.isValid() )
4880 if ( value.userType() == qMetaTypeId<QgsProperty>() )
4883 return value.toString();
4890 if ( mMin > std::numeric_limits<double>::lowest() + 1 )
4891 parts << QObject::tr(
"Minimum value: %1" ).arg( mMin );
4892 if ( mMax < std::numeric_limits<double>::max() )
4893 parts << QObject::tr(
"Maximum value: %1" ).arg( mMax );
4896 const QString extra = parts.join(
"<br />"_L1 );
4897 if ( !extra.isEmpty() )
4898 text += u
"<p>%1</p>"_s.arg( extra );
4904 switch ( outputType )
4910 code +=
", optional=True"_L1;
4914 if ( mMin != std::numeric_limits<double>::lowest() + 1 )
4915 code += u
", minValue=%1"_s.arg( mMin );
4916 if ( mMax != std::numeric_limits<double>::max() )
4917 code += u
", maxValue=%1"_s.arg( mMax );
4959 map.insert( u
"min"_s, mMin );
4960 map.insert( u
"max"_s, mMax );
4961 map.insert( u
"data_type"_s,
static_cast< int >( mDataType ) );
4968 mMin = map.value( u
"min"_s ).toDouble();
4969 mMax = map.value( u
"max"_s ).toDouble();
4992 if ( !input.isValid() )
5000 if ( input.userType() == qMetaTypeId<QgsProperty>() )
5005 if ( input.userType() == QMetaType::Type::QString )
5007 const QStringList list = input.toString().split(
',' );
5008 if ( list.count() != 2 )
5011 list.at( 0 ).toDouble( &ok );
5013 list.at( 1 ).toDouble( &ok2 );
5018 else if ( input.userType() == QMetaType::Type::QVariantList )
5020 if ( input.toList().count() != 2 )
5024 input.toList().at( 0 ).toDouble( &ok );
5026 input.toList().at( 1 ).toDouble( &ok2 );
5037 if ( !value.isValid() )
5040 if ( value.userType() == qMetaTypeId<QgsProperty>() )
5044 p.insert(
name(), value );
5047 QStringList stringParts;
5048 const auto constParts = parts;
5049 for (
const double v : constParts )
5051 stringParts << QString::number( v );
5053 return stringParts.join(
',' ).prepend(
'[' ).append(
']' );
5058 switch ( outputType )
5064 code +=
", optional=True"_L1;
5089 map.insert( u
"data_type"_s,
static_cast< int >( mDataType ) );
5117 if ( !input.isValid() )
5125 if ( input.userType() == qMetaTypeId<QgsProcessingRasterLayerDefinition>() )
5131 if ( input.userType() == qMetaTypeId<QgsProperty>() )
5144 if ( qobject_cast< QgsRasterLayer * >( qvariant_cast<QObject *>( input ) ) )
5147 if ( input.userType() != QMetaType::Type::QString || input.toString().isEmpty() )
5165 if ( !val.isValid() )
5168 if ( val.userType() == qMetaTypeId<QgsProperty>() )
5171 if ( val.userType() == qMetaTypeId<QgsProcessingRasterLayerDefinition>() )
5180 layerString = layer->source();
5184 return u
"QgsProcessingRasterLayerDefinition(%1, referenceScale=%2, dpi=%3)"_s
5196 return u
"QgsProcessingRasterLayerDefinition(QgsProperty.fromExpression(%1), referenceScale=%2, dpi=%3)"_s
5207 p.insert(
name(), val );
5234 mCapabilities = capabilities;
5239 return mCapabilities;
5258 QVariant input = value;
5259 if ( !input.isValid() )
5267 if ( input.userType() == qMetaTypeId<QgsProperty>() )
5272 if ( mUsesStaticStrings )
5274 if ( input.userType() == QMetaType::Type::QVariantList )
5276 if ( !mAllowMultiple )
5279 const QVariantList values = input.toList();
5283 for (
const QVariant &val : values )
5285 if ( !mOptions.contains( val.toString() ) )
5291 else if ( input.userType() == QMetaType::Type::QStringList )
5293 if ( !mAllowMultiple )
5296 const QStringList values = input.toStringList();
5301 if ( values.count() > 1 && !mAllowMultiple )
5304 for (
const QString &val : values )
5306 if ( !mOptions.contains( val ) )
5311 else if ( input.userType() == QMetaType::Type::QString )
5313 const QStringList parts = input.toString().split(
',' );
5314 if ( parts.count() > 1 && !mAllowMultiple )
5317 const auto constParts = parts;
5318 for (
const QString &part : constParts )
5320 if ( !mOptions.contains( part ) )
5328 if ( input.userType() == QMetaType::Type::QVariantList )
5330 if ( !mAllowMultiple )
5333 const QVariantList values = input.toList();
5337 for (
const QVariant &val : values )
5340 const int res = val.toInt( &ok );
5343 else if ( res < 0 || res >= mOptions.count() )
5349 else if ( input.userType() == QMetaType::Type::QString )
5351 const QStringList parts = input.toString().split(
',' );
5352 if ( parts.count() > 1 && !mAllowMultiple )
5355 const auto constParts = parts;
5356 for (
const QString &part : constParts )
5359 const int res = part.toInt( &ok );
5362 else if ( res < 0 || res >= mOptions.count() )
5367 else if ( input.userType() == QMetaType::Type::Int || input.userType() == QMetaType::Type::Double )
5370 const int res = input.toInt( &ok );
5373 else if ( res >= 0 && res < mOptions.count() )
5383 if ( !value.isValid() )
5386 if ( value.userType() == qMetaTypeId<QgsProperty>() )
5389 if ( mUsesStaticStrings )
5391 if ( value.userType() == QMetaType::Type::QVariantList || value.userType() == QMetaType::Type::QStringList )
5394 const QStringList constList = value.toStringList();
5395 for (
const QString &val : constList )
5399 return parts.join(
',' ).prepend(
'[' ).append(
']' );
5401 else if ( value.userType() == QMetaType::Type::QString )
5404 const QStringList constList = value.toString().split(
',' );
5405 if ( constList.count() > 1 )
5407 for (
const QString &val : constList )
5411 return parts.join(
',' ).prepend(
'[' ).append(
']' );
5419 if ( value.userType() == QMetaType::Type::QVariantList )
5422 const auto constToList = value.toList();
5423 for (
const QVariant &val : constToList )
5425 parts << QString::number( static_cast< int >( val.toDouble() ) );
5427 return parts.join(
',' ).prepend(
'[' ).append(
']' );
5429 else if ( value.userType() == QMetaType::Type::QString )
5431 const QStringList parts = value.toString().split(
',' );
5432 if ( parts.count() > 1 )
5434 return parts.join(
',' ).prepend(
'[' ).append(
']' );
5438 return QString::number(
static_cast< int >( value.toDouble() ) );
5444 if ( !value.isValid() )
5447 if ( value.userType() == qMetaTypeId<QgsProperty>() )
5450 if ( mUsesStaticStrings )
5456 if ( value.userType() == QMetaType::Type::QVariantList )
5459 const QVariantList toList = value.toList();
5460 parts.reserve( toList.size() );
5461 for (
const QVariant &val : toList )
5463 parts << mOptions.value(
static_cast< int >( val.toDouble() ) );
5465 return parts.join(
',' );
5467 else if ( value.userType() == QMetaType::Type::QString )
5469 const QStringList parts = value.toString().split(
',' );
5470 QStringList comments;
5471 if ( parts.count() > 1 )
5473 for (
const QString &part : parts )
5476 const int val = part.toInt( &ok );
5478 comments << mOptions.value( val );
5480 return comments.join(
',' );
5484 return mOptions.value(
static_cast< int >( value.toDouble() ) );
5490 QString code = u
"##%1="_s.arg(
mName );
5492 code +=
"optional "_L1;
5495 if ( mAllowMultiple )
5496 code +=
"multiple "_L1;
5498 if ( mUsesStaticStrings )
5499 code +=
"static "_L1;
5501 code += mOptions.join(
';' ) +
' ';
5504 return code.trimmed();
5509 switch ( outputType )
5515 code +=
", optional=True"_L1;
5518 options.reserve( mOptions.size() );
5519 for (
const QString &o : mOptions )
5521 code += u
", options=[%1]"_s.arg(
options.join(
',' ) );
5523 code += u
", allowMultiple=%1"_s.arg( mAllowMultiple ? u
"True"_s : u
"False"_s );
5525 code += u
", usesStaticStrings=%1"_s.arg( mUsesStaticStrings ? u
"True"_s : u
"False"_s );
5541 return options().value( value.toInt() );
5556 return mAllowMultiple;
5566 return mUsesStaticStrings;
5577 map.insert( u
"options"_s, mOptions );
5578 map.insert( u
"allow_multiple"_s, mAllowMultiple );
5579 map.insert( u
"uses_static_strings"_s, mUsesStaticStrings );
5586 mOptions = map.value( u
"options"_s ).toStringList();
5587 mAllowMultiple = map.value( u
"allow_multiple"_s ).toBool();
5588 mUsesStaticStrings = map.value( u
"uses_static_strings"_s ).toBool();
5595 QString def = definition;
5597 bool multiple =
false;
5598 if ( def.startsWith(
"multiple"_L1, Qt::CaseInsensitive ) )
5604 bool staticStrings =
false;
5605 if ( def.startsWith(
"static"_L1, Qt::CaseInsensitive ) )
5607 staticStrings =
true;
5611 const thread_local QRegularExpression re( u
"(.*)\\s+(.*?)$"_s );
5612 const QRegularExpressionMatch m = re.match( def );
5613 QString values = def;
5616 values = m.captured( 1 ).trimmed();
5617 defaultVal = m.captured( 2 );
5638 if ( value.userType() == qMetaTypeId<QgsProperty>() )
5641 const QString s = value.toString();
5647 QString code = u
"##%1="_s.arg(
mName );
5649 code +=
"optional "_L1;
5650 code +=
"string "_L1;
5656 return code.trimmed();
5661 switch ( outputType )
5667 code +=
", optional=True"_L1;
5668 code += u
", multiLine=%1"_s.arg( mMultiLine ? u
"True"_s : u
"False"_s );
5691 map.insert( u
"multiline"_s, mMultiLine );
5698 mMultiLine = map.value( u
"multiline"_s ).toBool();
5704 QString def = definition;
5706 if ( def.startsWith(
"long"_L1, Qt::CaseInsensitive ) )
5712 if ( def.startsWith(
'"' ) || def.startsWith(
'\'' ) )
5714 if ( def.endsWith(
'"' ) || def.endsWith(
'\'' ) )
5718 if ( def ==
"None"_L1 )
5739 if ( !value.isValid() )
5742 const QString s = value.toString();
5748 QString code = u
"##%1="_s.arg(
mName );
5750 code +=
"optional "_L1;
5751 code +=
"authcfg "_L1;
5754 return code.trimmed();
5759 QString def = definition;
5761 if ( def.startsWith(
'"' ) || def.startsWith(
'\'' ) )
5763 if ( def.endsWith(
'"' ) || def.endsWith(
'\'' ) )
5767 if ( def ==
"None"_L1 )
5783 , mExpressionType(
type )
5793 if ( !value.isValid() )
5796 if ( value.userType() == qMetaTypeId<QgsProperty>() )
5799 const QString s = value.toString();
5805 QStringList depends;
5806 if ( !mParentLayerParameterName.isEmpty() )
5807 depends << mParentLayerParameterName;
5813 switch ( outputType )
5819 code +=
", optional=True"_L1;
5821 code += u
", parentLayerParameterName='%1'"_s.arg( mParentLayerParameterName );
5827 switch ( mExpressionType )
5830 code +=
", type=Qgis.ExpressionType.PointCloud)"_L1;
5833 code +=
", type=Qgis.ExpressionType.RasterCalculator)"_L1;
5847 return mParentLayerParameterName;
5857 return mExpressionType;
5868 map.insert( u
"parent_layer"_s, mParentLayerParameterName );
5869 map.insert( u
"expression_type"_s,
static_cast< int >( mExpressionType ) );
5876 mParentLayerParameterName = map.value( u
"parent_layer"_s ).toString();
5877 mExpressionType =
static_cast< Qgis::ExpressionType >( map.value( u
"expression_type"_s ).toInt() );
5900 if ( !var.isValid() )
5908 if ( var.userType() == qMetaTypeId<QgsProperty>() )
5921 if ( qobject_cast< QgsVectorLayer * >( qvariant_cast<QObject *>( var ) ) )
5924 if ( var.userType() != QMetaType::Type::QString || var.toString().isEmpty() )
5942 if ( !val.isValid() )
5945 if ( val.userType() == qMetaTypeId<QgsProperty>() )
5949 p.insert(
name(), val );
5966 switch ( outputType )
5972 code +=
", optional=True"_L1;
5976 QStringList options;
5979 code += u
", types=[%1]"_s.arg( options.join(
',' ) );
6013 map.insert( u
"data_types"_s, types );
6021 const QVariantList values = map.value( u
"data_types"_s ).toList();
6022 for (
const QVariant &val : values )
6047 if ( !var.isValid() )
6055 if ( var.userType() == qMetaTypeId<QgsProperty>() )
6068 if ( qobject_cast< QgsMeshLayer * >( qvariant_cast<QObject *>( var ) ) )
6071 if ( var.userType() != QMetaType::Type::QString || var.toString().isEmpty() )
6089 if ( !val.isValid() )
6092 if ( val.userType() == qMetaTypeId<QgsProperty>() )
6096 p.insert(
name(), val );
6122 const QString &
name,
6147 if ( !input.isValid() )
6155 if ( input.userType() == qMetaTypeId<QgsProperty>() )
6160 if ( input.userType() == QMetaType::Type::QVariantList || input.userType() == QMetaType::Type::QStringList )
6162 if ( !mAllowMultiple )
6168 else if ( input.userType() == QMetaType::Type::QString )
6170 if ( input.toString().isEmpty() )
6173 const QStringList parts = input.toString().split(
';' );
6174 if ( parts.count() > 1 && !mAllowMultiple )
6179 if ( input.toString().isEmpty() )
6187 if ( !value.isValid() )
6190 if ( value.userType() == qMetaTypeId<QgsProperty>() )
6193 if ( value.userType() == QMetaType::Type::QVariantList )
6196 const auto constToList = value.toList();
6197 for (
const QVariant &val : constToList )
6201 return parts.join(
',' ).prepend(
'[' ).append(
']' );
6203 else if ( value.userType() == QMetaType::Type::QStringList )
6206 const auto constToStringList = value.toStringList();
6207 for (
const QString &s : constToStringList )
6211 return parts.join(
',' ).prepend(
'[' ).append(
']' );
6219 QString code = u
"##%1="_s.arg(
mName );
6221 code +=
"optional "_L1;
6222 code +=
"field "_L1;
6224 switch ( mDataType )
6227 code +=
"numeric "_L1;
6231 code +=
"string "_L1;
6235 code +=
"datetime "_L1;
6239 code +=
"binary "_L1;
6243 code +=
"boolean "_L1;
6250 if ( mAllowMultiple )
6251 code +=
"multiple "_L1;
6253 if ( mDefaultToAllFields )
6254 code +=
"default_to_all_fields "_L1;
6256 code += mParentLayerParameterName +
' ';
6259 return code.trimmed();
6264 switch ( outputType )
6270 code +=
", optional=True"_L1;
6273 switch ( mDataType )
6276 dataType = u
"QgsProcessingParameterField.Any"_s;
6280 dataType = u
"QgsProcessingParameterField.Numeric"_s;
6284 dataType = u
"QgsProcessingParameterField.String"_s;
6288 dataType = u
"QgsProcessingParameterField.DateTime"_s;
6292 dataType = u
"QgsProcessingParameterField.Binary"_s;
6296 dataType = u
"QgsProcessingParameterField.Boolean"_s;
6299 code += u
", type=%1"_s.arg(
dataType );
6301 code += u
", parentLayerParameterName='%1'"_s.arg( mParentLayerParameterName );
6302 code += u
", allowMultiple=%1"_s.arg( mAllowMultiple ? u
"True"_s : u
"False"_s );
6306 if ( mDefaultToAllFields )
6307 code +=
", defaultToAllFields=True"_L1;
6319 QStringList depends;
6320 if ( !mParentLayerParameterName.isEmpty() )
6321 depends << mParentLayerParameterName;
6327 return mParentLayerParameterName;
6347 return mAllowMultiple;
6357 return mDefaultToAllFields;
6362 mDefaultToAllFields = enabled;
6368 map.insert( u
"parent_layer"_s, mParentLayerParameterName );
6369 map.insert( u
"data_type"_s,
static_cast< int >( mDataType ) );
6370 map.insert( u
"allow_multiple"_s, mAllowMultiple );
6371 map.insert( u
"default_to_all_fields"_s, mDefaultToAllFields );
6378 mParentLayerParameterName = map.value( u
"parent_layer"_s ).toString();
6380 mAllowMultiple = map.value( u
"allow_multiple"_s ).toBool();
6381 mDefaultToAllFields = map.value( u
"default_to_all_fields"_s ).toBool();
6391 QString def = definition;
6393 if ( def.startsWith(
"numeric "_L1, Qt::CaseInsensitive ) )
6398 else if ( def.startsWith(
"string "_L1, Qt::CaseInsensitive ) )
6403 else if ( def.startsWith(
"datetime "_L1, Qt::CaseInsensitive ) )
6408 else if ( def.startsWith(
"binary "_L1, Qt::CaseInsensitive ) )
6413 else if ( def.startsWith(
"boolean "_L1, Qt::CaseInsensitive ) )
6419 if ( def.startsWith(
"multiple"_L1, Qt::CaseInsensitive ) )
6422 def = def.mid( 8 ).trimmed();
6425 if ( def.startsWith(
"default_to_all_fields"_L1, Qt::CaseInsensitive ) )
6428 def = def.mid( 21 ).trimmed();
6431 const thread_local QRegularExpression re( u
"(.*?)\\s+(.*)$"_s );
6432 const QRegularExpressionMatch m = re.match( def );
6435 parent = m.captured( 1 ).trimmed();
6436 def = m.captured( 2 );
6459 QVariant var = input;
6460 if ( !var.isValid() )
6468 if ( var.userType() == qMetaTypeId<QgsProcessingFeatureSourceDefinition>() )
6473 else if ( var.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
6480 if ( var.userType() == qMetaTypeId<QgsProperty>() )
6492 if ( qobject_cast< QgsVectorLayer * >( qvariant_cast<QObject *>( input ) ) )
6497 if ( var.userType() != QMetaType::Type::QString || var.toString().isEmpty() )
6515 if ( !value.isValid() )
6518 if ( value.userType() == qMetaTypeId<QgsProperty>() )
6521 if ( value.userType() == qMetaTypeId<QgsProcessingFeatureSourceDefinition>() )
6524 QString geometryCheckString;
6528 geometryCheckString = u
"QgsFeatureRequest.GeometryNoCheck"_s;
6532 geometryCheckString = u
"QgsFeatureRequest.GeometrySkipInvalid"_s;
6536 geometryCheckString = u
"QgsFeatureRequest.GeometryAbortOnInvalid"_s;
6543 flags << u
"QgsProcessingFeatureSourceDefinition.FlagOverrideDefaultGeometryCheck"_s;
6545 flags << u
"QgsProcessingFeatureSourceDefinition.FlagCreateIndividualOutputPerInputFeature"_s;
6546 if ( !
flags.empty() )
6547 flagString =
flags.join(
" | "_L1 );
6554 layerString = layer->source();
6558 return u
"QgsProcessingFeatureSourceDefinition(%1, selectedFeaturesOnly=%2, featureLimit=%3%4%6, geometryCheck=%5)"_s.arg(
6562 flagString.isEmpty() ? QString() : ( u
", flags=%1"_s.arg( flagString ) ),
6563 geometryCheckString,
6576 return u
"QgsProcessingFeatureSourceDefinition(QgsProperty.fromExpression(%1), selectedFeaturesOnly=%2, featureLimit=%3%4%6, geometryCheck=%5)"_s.arg(
6580 flagString.isEmpty() ? QString() : ( u
", flags=%1"_s.arg( flagString ) ),
6581 geometryCheckString,
6591 else if (
QgsVectorLayer *layer = qobject_cast< QgsVectorLayer * >( qvariant_cast<QObject *>( value ) ) )
6596 QString layerString = value.toString();
6600 layerString = layer->providerType() !=
"ogr"_L1 && layer->providerType() !=
"gdal"_L1 && layer->providerType() !=
"mdal"_L1
6619 QString code = u
"##%1="_s.arg(
mName );
6621 code +=
"optional "_L1;
6622 code +=
"source "_L1;
6629 code +=
"point "_L1;
6637 code +=
"polygon "_L1;
6646 return code.trimmed();
6651 switch ( outputType )
6657 code +=
", optional=True"_L1;
6661 QStringList options;
6665 code += u
", types=[%1]"_s.arg( options.join(
',' ) );
6693 map.insert( u
"data_types"_s, types );
6701 const QVariantList values = map.value( u
"data_types"_s ).toList();
6702 for (
const QVariant &val : values )
6712 QString def = definition;
6715 if ( def.startsWith(
"point"_L1, Qt::CaseInsensitive ) )
6721 else if ( def.startsWith(
"line"_L1, Qt::CaseInsensitive ) )
6727 else if ( def.startsWith(
"polygon"_L1, Qt::CaseInsensitive ) )
6754 QVariant var = input;
6755 if ( !var.isValid() )
6763 if ( var.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
6769 if ( var.userType() == qMetaTypeId<QgsProperty>() )
6782 if ( var.userType() != QMetaType::Type::QString )
6785 if ( var.toString().isEmpty() )
6793 if ( !value.isValid() )
6796 if ( value.userType() == qMetaTypeId<QgsProperty>() )
6799 if ( value.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
6808 return u
"QgsProperty.fromExpression('%1')"_s.arg( fromVar.
sink.
asExpression() );
6817 QString code = u
"##%1="_s.arg(
mName );
6819 code +=
"optional "_L1;
6822 switch ( mDataType )
6825 code +=
"point "_L1;
6833 code +=
"polygon "_L1;
6837 code +=
"table "_L1;
6845 return code.trimmed();
6857 return lOriginalProvider->defaultVectorFileExtension(
hasGeometry() );
6861 return p->defaultVectorFileExtension(
hasGeometry() );
6878 switch ( outputType )
6884 code +=
", optional=True"_L1;
6888 code += u
", createByDefault=%1"_s.arg(
createByDefault() ? u
"True"_s : u
"False"_s );
6889 if ( mSupportsAppend )
6890 code +=
", supportsAppend=True"_L1;
6903 QStringList filters;
6904 for (
const QString &ext : exts )
6906 filters << QObject::tr(
"%1 files (*.%2)" ).arg( ext.toUpper(), ext.toLower() );
6908 return filters.join(
";;"_L1 ) + u
";;"_s + QObject::tr(
"All files (*.*)" );
6916 return lOriginalProvider->supportedOutputVectorLayerExtensions();
6918 return lOriginalProvider->supportedOutputTableExtensions();
6923 return p->supportedOutputVectorLayerExtensions();
6925 return p->supportedOutputTableExtensions();
6940 switch ( mDataType )
6971 map.insert( u
"data_type"_s,
static_cast< int >( mDataType ) );
6972 map.insert( u
"supports_append"_s, mSupportsAppend );
6980 mSupportsAppend = map.value( u
"supports_append"_s,
false ).toBool();
6995 QString def = definition;
6996 if ( def.startsWith(
"point"_L1, Qt::CaseInsensitive ) )
7001 else if ( def.startsWith(
"line"_L1, Qt::CaseInsensitive ) )
7006 else if ( def.startsWith(
"polygon"_L1, Qt::CaseInsensitive ) )
7011 else if ( def.startsWith(
"table"_L1, Qt::CaseInsensitive ) )
7022 return mSupportsAppend;
7041 QVariant var = input;
7042 if ( !var.isValid() )
7050 if ( var.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
7056 if ( var.userType() == qMetaTypeId<QgsProperty>() )
7069 if ( var.userType() != QMetaType::Type::QString )
7072 if ( var.toString().isEmpty() )
7080 if ( !value.isValid() )
7083 if ( value.userType() == qMetaTypeId<QgsProperty>() )
7086 if ( value.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
7095 return u
"QgsProperty.fromExpression('%1')"_s.arg( fromVar.
sink.
asExpression() );
7111 return lOriginalProvider->defaultRasterFileFormat();
7115 return p->defaultRasterFileFormat();
7127 if ( !extensions.isEmpty() )
7128 return extensions[0];
7135 QStringList filters;
7140 for (
const QPair<QString, QString> &formatAndExt : std::as_const( formatAndExtensions ) )
7142 QString format = formatAndExt.first;
7143 const QString &extension = formatAndExt.second;
7144 if ( format.isEmpty() )
7146 filters << QObject::tr(
"%1 files (*.%2)" ).arg( format.toUpper(), extension.toLower() );
7149 return filters.join(
";;"_L1 ) + u
";;"_s + QObject::tr(
"All files (*.*)" );
7155 QSet< QString > extensions;
7156 for (
const QPair<QString, QString> &formatAndExt : std::as_const( formatAndExtensions ) )
7158 extensions.insert( formatAndExt.second );
7160 return QStringList( extensions.constBegin(), extensions.constEnd() );
7167 return lOriginalProvider->supportedOutputRasterLayerFormatAndExtensions();
7171 return p->supportedOutputRasterLayerFormatAndExtensions();
7199 QVariant var = input;
7200 if ( !var.isValid() )
7208 if ( var.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
7214 if ( var.userType() == qMetaTypeId<QgsProperty>() )
7227 if ( var.userType() != QMetaType::Type::QString )
7230 if ( var.toString().isEmpty() )
7240 if ( !value.isValid() )
7243 if ( value.userType() == qMetaTypeId<QgsProperty>() )
7246 if ( value.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
7255 return u
"QgsProperty.fromExpression('%1')"_s.arg( fromVar.
sink.
asExpression() );
7264 if ( !mFileFilter.isEmpty() && mFileFilter.contains( u
"htm"_s, Qt::CaseInsensitive ) )
7276 if ( mFileFilter.isEmpty() || mFileFilter == QObject::tr(
"All files (*.*)" ) )
7280 const thread_local QRegularExpression rx( u
".*?\\(\\*\\.([a-zA-Z0-9._]+).*"_s );
7281 const QRegularExpressionMatch match = rx.match( mFileFilter );
7282 if ( !match.hasMatch() )
7285 return match.captured( 1 );
7290 switch ( outputType )
7296 code +=
", optional=True"_L1;
7300 code += u
", createByDefault=%1"_s.arg(
createByDefault() ? u
"True"_s : u
"False"_s );
7312 return (
fileFilter().isEmpty() ? QString() :
fileFilter() + u
";;"_s ) + QObject::tr(
"All files (*.*)" );
7328 map.insert( u
"file_filter"_s, mFileFilter );
7335 mFileFilter = map.value( u
"file_filter"_s ).toString();
7355 QVariant var = input;
7356 if ( !var.isValid() )
7364 if ( var.userType() == qMetaTypeId<QgsProperty>() )
7377 if ( var.userType() != QMetaType::Type::QString )
7380 if ( var.toString().isEmpty() )
7409 map.insert( u
"supports_non_file_outputs"_s, mSupportsNonFileBasedOutputs );
7410 map.insert( u
"create_by_default"_s, mCreateByDefault );
7417 mSupportsNonFileBasedOutputs = map.value( u
"supports_non_file_outputs"_s ).toBool();
7418 mCreateByDefault = map.value( u
"create_by_default"_s, u
"1"_s ).toBool();
7424 switch ( outputType )
7433 code +=
", optional=True"_L1;
7435 code += u
", createByDefault=%1"_s.arg( mCreateByDefault ? u
"True"_s : u
"False"_s );
7457 const thread_local QRegularExpression rx( u
"[.]"_s );
7458 QString sanitizedName =
name();
7459 sanitizedName.replace( rx, u
"_"_s );
7474 return lOriginalProvider->isSupportedOutputValue( value,
this, context, error );
7483 return mCreateByDefault;
7505 QVariant var = input;
7506 if ( !var.isValid() )
7514 if ( var.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
7520 if ( var.userType() == qMetaTypeId<QgsProperty>() )
7533 if ( var.userType() != QMetaType::Type::QString )
7536 if ( var.toString().isEmpty() )
7544 if ( !value.isValid() )
7547 if ( value.userType() == qMetaTypeId<QgsProperty>() )
7550 if ( value.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
7559 return u
"QgsProperty.fromExpression('%1')"_s.arg( fromVar.
sink.
asExpression() );
7568 QString code = u
"##%1="_s.arg(
mName );
7570 code +=
"optional "_L1;
7571 code +=
"vectorDestination "_L1;
7573 switch ( mDataType )
7576 code +=
"point "_L1;
7584 code +=
"polygon "_L1;
7592 return code.trimmed();
7604 return lOriginalProvider->defaultVectorFileExtension(
hasGeometry() );
7608 return p->defaultVectorFileExtension(
hasGeometry() );
7625 switch ( outputType )
7631 code +=
", optional=True"_L1;
7635 code += u
", createByDefault=%1"_s.arg(
createByDefault() ? u
"True"_s : u
"False"_s );
7648 QStringList filters;
7649 for (
const QString &ext : exts )
7651 filters << QObject::tr(
"%1 files (*.%2)" ).arg( ext.toUpper(), ext.toLower() );
7653 return filters.join(
";;"_L1 ) + u
";;"_s + QObject::tr(
"All files (*.*)" );
7661 return lOriginalProvider->supportedOutputVectorLayerExtensions();
7663 return lOriginalProvider->supportedOutputTableExtensions();
7668 return p->supportedOutputVectorLayerExtensions();
7670 return p->supportedOutputTableExtensions();
7685 switch ( mDataType )
7716 map.insert( u
"data_type"_s,
static_cast< int >( mDataType ) );
7730 QString def = definition;
7731 if ( def.startsWith(
"point"_L1, Qt::CaseInsensitive ) )
7736 else if ( def.startsWith(
"line"_L1, Qt::CaseInsensitive ) )
7741 else if ( def.startsWith(
"polygon"_L1, Qt::CaseInsensitive ) )
7765 QVariant input = value;
7766 if ( !input.isValid() )
7774 if ( input.userType() == qMetaTypeId<QgsProperty>() )
7779 if ( input.userType() == QMetaType::Type::QVariantList || input.userType() == QMetaType::Type::QStringList )
7781 if ( !mAllowMultiple )
7790 const double res = input.toInt( &ok );
7800 return mAllowMultiple;
7810 if ( !value.isValid() )
7813 if ( value.userType() == qMetaTypeId<QgsProperty>() )
7816 if ( value.userType() == QMetaType::Type::QVariantList )
7819 const QVariantList values = value.toList();
7820 for (
auto it = values.constBegin(); it != values.constEnd(); ++it )
7822 parts << QString::number( static_cast< int >( it->toDouble() ) );
7824 return parts.join(
',' ).prepend(
'[' ).append(
']' );
7826 else if ( value.userType() == QMetaType::Type::QStringList )
7829 const QStringList values = value.toStringList();
7830 for (
auto it = values.constBegin(); it != values.constEnd(); ++it )
7832 parts << QString::number( static_cast< int >( it->toDouble() ) );
7834 return parts.join(
',' ).prepend(
'[' ).append(
']' );
7837 return value.toString();
7842 QString code = u
"##%1="_s.arg(
mName );
7844 code +=
"optional "_L1;
7847 if ( mAllowMultiple )
7848 code +=
"multiple "_L1;
7850 code += mParentLayerParameterName +
' ';
7853 return code.trimmed();
7858 QStringList depends;
7859 if ( !mParentLayerParameterName.isEmpty() )
7860 depends << mParentLayerParameterName;
7866 switch ( outputType )
7872 code +=
", optional=True"_L1;
7874 code += u
", parentLayerParameterName='%1'"_s.arg( mParentLayerParameterName );
7875 code += u
", allowMultiple=%1"_s.arg( mAllowMultiple ? u
"True"_s : u
"False"_s );
7887 return mParentLayerParameterName;
7898 map.insert( u
"parent_layer"_s, mParentLayerParameterName );
7899 map.insert( u
"allow_multiple"_s, mAllowMultiple );
7906 mParentLayerParameterName = map.value( u
"parent_layer"_s ).toString();
7907 mAllowMultiple = map.value( u
"allow_multiple"_s ).toBool();
7914 QString def = definition;
7917 if ( def.startsWith(
"multiple"_L1, Qt::CaseInsensitive ) )
7920 def = def.mid( 8 ).trimmed();
7923 const thread_local QRegularExpression re( u
"(.*?)\\s+(.*)$"_s );
7924 const QRegularExpressionMatch m = re.match( def );
7927 parent = m.captured( 1 ).trimmed();
7928 def = m.captured( 2 );
7962 QStringList depends;
7963 if ( !mParentParameterName.isEmpty() )
7964 depends << mParentParameterName;
7970 switch ( outputType )
7976 code +=
", optional=True"_L1;
7978 code += u
", parentParameterName='%1'"_s.arg( mParentParameterName );
7980 if (
minimum() != std::numeric_limits<double>::lowest() + 1 )
7981 code += u
", minValue=%1"_s.arg(
minimum() );
7982 if (
maximum() != std::numeric_limits<double>::max() )
7983 code += u
", maxValue=%1"_s.arg(
maximum() );
7994 return mParentParameterName;
8005 map.insert( u
"parent"_s, mParentParameterName );
8006 map.insert( u
"default_unit"_s,
static_cast< int >( mDefaultUnit ) );
8013 mParentParameterName = map.value( u
"parent"_s ).toString();
8051 QStringList depends;
8052 if ( !mParentParameterName.isEmpty() )
8053 depends << mParentParameterName;
8059 switch ( outputType )
8065 code +=
", optional=True"_L1;
8067 code += u
", parentParameterName='%1'"_s.arg( mParentParameterName );
8070 code += u
", minValue=%1"_s.arg(
minimum() );
8071 if (
maximum() != std::numeric_limits<double>::max() )
8072 code += u
", maxValue=%1"_s.arg(
maximum() );
8083 return mParentParameterName;
8094 map.insert( u
"parent"_s, mParentParameterName );
8102 mParentParameterName = map.value( u
"parent"_s ).toString();
8140 QStringList depends;
8141 if ( !mParentParameterName.isEmpty() )
8142 depends << mParentParameterName;
8148 switch ( outputType )
8154 code +=
", optional=True"_L1;
8156 code += u
", parentParameterName='%1'"_s.arg( mParentParameterName );
8159 code += u
", minValue=%1"_s.arg(
minimum() );
8160 if (
maximum() != std::numeric_limits<double>::max() )
8161 code += u
", maxValue=%1"_s.arg(
maximum() );
8172 return mParentParameterName;
8183 map.insert( u
"parent"_s, mParentParameterName );
8191 mParentParameterName = map.value( u
"parent"_s ).toString();
8224 switch ( outputType )
8230 code +=
", optional=True"_L1;
8232 if (
minimum() != std::numeric_limits<double>::lowest() + 1 )
8233 code += u
", minValue=%1"_s.arg(
minimum() );
8234 if (
maximum() != std::numeric_limits<double>::max() )
8235 code += u
", maxValue=%1"_s.arg(
maximum() );
8247 map.insert( u
"default_unit"_s,
static_cast< int >( mDefaultUnit ) );
8287 switch ( outputType )
8293 code +=
", optional=True"_L1;
8326 if ( value.userType() == qMetaTypeId<QgsProperty>() )
8329 const QString s = value.toString();
8335 QString code = u
"##%1="_s.arg(
mName );
8337 code +=
"optional "_L1;
8338 code +=
"layout "_L1;
8341 return code.trimmed();
8346 switch ( outputType )
8352 code +=
", optional=True"_L1;
8363 QString def = definition;
8365 if ( def.startsWith(
'"' ) || def.startsWith(
'\'' ) )
8367 if ( def.endsWith(
'"' ) || def.endsWith(
'\'' ) )
8371 if ( def ==
"None"_L1 )
8400 if ( value.userType() == qMetaTypeId<QgsProperty>() )
8403 const QString s = value.toString();
8409 QString code = u
"##%1="_s.arg(
mName );
8411 code +=
"optional "_L1;
8412 code +=
"layoutitem "_L1;
8413 if ( mItemType >= 0 )
8414 code += QString::number( mItemType ) +
' ';
8416 code += mParentLayoutParameterName +
' ';
8419 return code.trimmed();
8424 switch ( outputType )
8430 code +=
", optional=True"_L1;
8432 if ( mItemType >= 0 )
8433 code += u
", itemType=%1"_s.arg( mItemType );
8435 code += u
", parentLayoutParameterName='%1'"_s.arg( mParentLayoutParameterName );
8448 map.insert( u
"parent_layout"_s, mParentLayoutParameterName );
8449 map.insert( u
"item_type"_s, mItemType );
8456 mParentLayoutParameterName = map.value( u
"parent_layout"_s ).toString();
8457 mItemType = map.value( u
"item_type"_s ).toInt();
8463 QStringList depends;
8464 if ( !mParentLayoutParameterName.isEmpty() )
8465 depends << mParentLayoutParameterName;
8472 QString def = definition;
8474 const thread_local QRegularExpression re( u
"(\\d+)?\\s*(.*?)\\s+(.*)$"_s );
8475 const QRegularExpressionMatch m = re.match( def );
8478 itemType = m.captured( 1 ).trimmed().isEmpty() ? -1 : m.captured( 1 ).trimmed().toInt();
8479 parent = m.captured( 2 ).trimmed().isEmpty() ? m.captured( 3 ).trimmed() : m.captured( 2 ).trimmed();
8480 def = !m.captured( 2 ).trimmed().isEmpty() ? m.captured( 3 ) : QString();
8493 return mParentLayoutParameterName;
8498 mParentLayoutParameterName =
name;
8530 if ( value.userType() == qMetaTypeId<QgsProperty>() )
8533 if ( value.canConvert< QColor >() && !value.value< QColor >().isValid() )
8534 return u
"QColor()"_s;
8536 if ( value.canConvert< QColor >() )
8538 const QColor
c = value.value< QColor >();
8539 if ( !mAllowOpacity ||
c.alpha() == 255 )
8540 return u
"QColor(%1, %2, %3)"_s.arg(
c.red() ).arg(
c.green() ).arg(
c.blue() );
8542 return u
"QColor(%1, %2, %3, %4)"_s.arg(
c.red() ).arg(
c.green() ).arg(
c.blue() ).arg(
c.alpha() );
8545 const QString s = value.toString();
8551 QString code = u
"##%1="_s.arg(
mName );
8553 code +=
"optional "_L1;
8554 code +=
"color "_L1;
8556 if ( mAllowOpacity )
8557 code +=
"withopacity "_L1;
8560 return code.trimmed();
8565 switch ( outputType )
8571 code +=
", optional=True"_L1;
8573 code += u
", opacityEnabled=%1"_s.arg( mAllowOpacity ? u
"True"_s : u
"False"_s );
8585 if ( !input.isValid() && (
mDefault.isValid() && ( !
mDefault.toString().isEmpty() ||
mDefault.value< QColor >().isValid() ) ) )
8588 if ( !input.isValid() )
8591 if ( input.userType() == QMetaType::Type::QColor )
8595 else if ( input.userType() == qMetaTypeId<QgsProperty>() )
8600 if ( input.userType() != QMetaType::Type::QString || input.toString().isEmpty() )
8603 bool containsAlpha =
false;
8610 map.insert( u
"opacityEnabled"_s, mAllowOpacity );
8617 mAllowOpacity = map.value( u
"opacityEnabled"_s ).toBool();
8623 return mAllowOpacity;
8628 mAllowOpacity = enabled;
8633 QString def = definition;
8635 bool allowOpacity =
false;
8636 if ( def.startsWith(
"withopacity"_L1, Qt::CaseInsensitive ) )
8638 allowOpacity =
true;
8639 def = def.mid( 12 );
8642 if ( def.startsWith(
'"' ) || def.startsWith(
'\'' ) )
8644 if ( def.endsWith(
'"' ) || def.endsWith(
'\'' ) )
8648 if ( def ==
"None"_L1 || def.isEmpty() )
8658 const QString &
name,
8663 const QVariant &staticSourceCrs,
8664 const QVariant &staticDestinationCrs,
8670 , mSourceCrs( staticSourceCrs )
8671 , mDestCrs( staticDestinationCrs )
8681 return valueAsPythonStringPrivate( value, context,
false );
8684QString QgsProcessingParameterCoordinateOperation::valueAsPythonStringPrivate(
const QVariant &value,
QgsProcessingContext &context,
bool allowNonStringValues )
const
8689 if ( allowNonStringValues && value.userType() == qMetaTypeId<QgsCoordinateReferenceSystem>() )
8692 return u
"QgsCoordinateReferenceSystem()"_s;
8697 if ( value.userType() == qMetaTypeId<QgsProperty>() )
8698 return u
"QgsProperty.fromExpression('%1')"_s.arg( value.value< QgsProperty >().asExpression() );
8700 if ( allowNonStringValues )
8703 p.insert(
name(), value );
8709 const QString s = value.toString();
8715 QString code = u
"##%1="_s.arg(
mName );
8717 code +=
"optional "_L1;
8718 code +=
"coordinateoperation "_L1;
8721 return code.trimmed();
8726 switch ( outputType )
8733 code +=
", optional=True"_L1;
8734 if ( !mSourceParameterName.isEmpty() )
8735 code += u
", sourceCrsParameterName=%1"_s.arg( valueAsPythonStringPrivate( mSourceParameterName,
c,
false ) );
8736 if ( !mDestParameterName.isEmpty() )
8737 code += u
", destinationCrsParameterName=%1"_s.arg( valueAsPythonStringPrivate( mDestParameterName,
c,
false ) );
8739 if ( mSourceCrs.isValid() )
8740 code += u
", staticSourceCrs=%1"_s.arg( valueAsPythonStringPrivate( mSourceCrs,
c,
true ) );
8741 if ( mDestCrs.isValid() )
8742 code += u
", staticDestinationCrs=%1"_s.arg( valueAsPythonStringPrivate( mDestCrs,
c,
true ) );
8744 code += u
", defaultValue=%1)"_s.arg( valueAsPythonStringPrivate(
mDefault,
c,
false ) );
8754 if ( !mSourceParameterName.isEmpty() )
8755 res << mSourceParameterName;
8756 if ( !mDestParameterName.isEmpty() )
8757 res << mDestParameterName;
8764 map.insert( u
"source_crs_parameter_name"_s, mSourceParameterName );
8765 map.insert( u
"dest_crs_parameter_name"_s, mDestParameterName );
8766 map.insert( u
"static_source_crs"_s, mSourceCrs );
8767 map.insert( u
"static_dest_crs"_s, mDestCrs );
8774 mSourceParameterName = map.value( u
"source_crs_parameter_name"_s ).toString();
8775 mDestParameterName = map.value( u
"dest_crs_parameter_name"_s ).toString();
8776 mSourceCrs = map.value( u
"static_source_crs"_s );
8777 mDestCrs = map.value( u
"static_dest_crs"_s );
8783 QString def = definition;
8785 if ( def.startsWith(
'"' ) )
8788 if ( def.endsWith(
'"' ) )
8791 else if ( def.startsWith(
'\'' ) )
8794 if ( def.endsWith(
'\'' ) )
8799 if ( def ==
"None"_L1 )
8822 if ( !input.isValid() && !
mDefault.isValid() )
8825 if ( ( input.userType() == QMetaType::Type::QString && input.toString().isEmpty() ) || ( !input.isValid() &&
mDefault.userType() == QMetaType::Type::QString &&
mDefault.toString().isEmpty() ) )
8833 if ( !value.isValid() )
8836 if ( value.userType() == qMetaTypeId<QgsProperty>() )
8844 QString code = u
"##%1="_s.arg(
mName );
8846 code +=
"optional "_L1;
8847 code +=
"maptheme "_L1;
8850 return code.trimmed();
8855 switch ( outputType )
8861 code +=
", optional=True"_L1;
8886 QString def = definition;
8887 if ( def.startsWith(
'"' ) || def.startsWith(
'\'' ) )
8889 if ( def.endsWith(
'"' ) || def.endsWith(
'\'' ) )
8913 if ( mMin.isValid() && mMax.isValid() && mMin >= mMax )
8915 QgsMessageLog::logMessage( QObject::tr(
"Invalid datetime parameter \"%1\": min value %2 is >= max value %3!" ).arg( name, mMin.toString(), mMax.toString() ), QObject::tr(
"Processing" ) );
8926 QVariant input = value;
8927 if ( !input.isValid() )
8935 if ( input.userType() == qMetaTypeId<QgsProperty>() )
8940 if ( input.userType() != QMetaType::Type::QDateTime && input.userType() != QMetaType::Type::QDate && input.userType() != QMetaType::Type::QTime && input.userType() != QMetaType::Type::QString )
8946 if ( input.userType() == QMetaType::Type::QString )
8948 const QString s = input.toString();
8952 input = QDateTime::fromString( s, Qt::ISODate );
8955 if ( !input.toDateTime().isValid() )
8956 input = QTime::fromString( s );
8958 input = input.toDateTime().time();
8964 const QDateTime res = input.toDateTime();
8965 return res.isValid() && ( res >= mMin || !mMin.isValid() ) && ( res <= mMax || !mMax.isValid() );
8969 const QTime res = input.toTime();
8970 return res.isValid() && ( res >= mMin.time() || !mMin.isValid() ) && ( res <= mMax.time() || !mMax.isValid() );
8976 if ( !value.isValid() )
8979 if ( value.userType() == qMetaTypeId<QgsProperty>() )
8982 if ( value.userType() == QMetaType::Type::QDateTime )
8984 const QDateTime dt = value.toDateTime();
8985 if ( !dt.isValid() )
8986 return u
"QDateTime()"_s;
8988 return u
"QDateTime(QDate(%1, %2, %3), QTime(%4, %5, %6))"_s.arg( dt.date().year() )
8989 .arg( dt.date().month() )
8990 .arg( dt.date().day() )
8991 .arg( dt.time().hour() )
8992 .arg( dt.time().minute() )
8993 .arg( dt.time().second() );
8995 else if ( value.userType() == QMetaType::Type::QDate )
8997 const QDate dt = value.toDate();
8998 if ( !dt.isValid() )
8999 return u
"QDate()"_s;
9001 return u
"QDate(%1, %2, %3)"_s.arg( dt.year() ).arg( dt.month() ).arg( dt.day() );
9003 else if ( value.userType() == QMetaType::Type::QTime )
9005 const QTime dt = value.toTime();
9006 if ( !dt.isValid() )
9007 return u
"QTime()"_s;
9009 return u
"QTime(%4, %5, %6)"_s.arg( dt.hour() ).arg( dt.minute() ).arg( dt.second() );
9011 return value.toString();
9018 if ( mMin.isValid() )
9019 parts << QObject::tr(
"Minimum value: %1" ).arg( mMin.toString( Qt::ISODate ) );
9020 if ( mMax.isValid() )
9021 parts << QObject::tr(
"Maximum value: %1" ).arg( mMax.toString( Qt::ISODate ) );
9023 parts << QObject::tr(
"Default value: %1" )
9026 ?
mDefault.toDateTime().toString( Qt::ISODate )
9029 const QString extra = parts.join(
"<br />"_L1 );
9030 if ( !extra.isEmpty() )
9031 text += u
"<p>%1</p>"_s.arg( extra );
9037 switch ( outputType )
9043 code +=
", optional=True"_L1;
9045 code += u
", type=%1"_s.arg(
9048 : u
"QgsProcessingParameterDateTime.Time"_s
9052 if ( mMin.isValid() )
9054 if ( mMax.isValid() )
9096 map.insert( u
"min"_s, mMin );
9097 map.insert( u
"max"_s, mMax );
9098 map.insert( u
"data_type"_s,
static_cast< int >( mDataType ) );
9105 mMin = map.value( u
"min"_s ).toDateTime();
9106 mMax = map.value( u
"max"_s ).toDateTime();
9122 if ( value.userType() == QMetaType::Type::QDateTime )
9124 const QDateTime dt = value.toDateTime();
9125 if ( !dt.isValid() )
9126 return QObject::tr(
"Invalid datetime" );
9128 return dt.toString( Qt::ISODate );
9131 else if ( value.userType() == QMetaType::Type::QDate )
9133 const QDate dt = value.toDate();
9134 if ( !dt.isValid() )
9135 return QObject::tr(
"Invalid date" );
9137 return dt.toString( Qt::ISODate );
9140 else if ( value.userType() == QMetaType::Type::QTime )
9142 const QTime dt = value.toTime();
9143 if ( !dt.isValid() )
9144 return QObject::tr(
"Invalid time" );
9146 return dt.toString( Qt::ISODate );
9149 return value.toString();
9169 if ( !input.isValid() && !
mDefault.isValid() )
9172 if ( ( input.userType() == QMetaType::Type::QString && input.toString().isEmpty() ) || ( !input.isValid() &&
mDefault.userType() == QMetaType::Type::QString &&
mDefault.toString().isEmpty() ) )
9180 if ( !value.isValid() )
9183 if ( value.userType() == qMetaTypeId<QgsProperty>() )
9191 QString code = u
"##%1="_s.arg(
mName );
9193 code +=
"optional "_L1;
9194 code +=
"providerconnection "_L1;
9195 code += mProviderId +
' ';
9198 return code.trimmed();
9203 switch ( outputType )
9209 code +=
", optional=True"_L1;
9223 map.insert( u
"provider"_s, mProviderId );
9230 mProviderId = map.value( u
"provider"_s ).toString();
9236 QString def = definition;
9238 if ( def.contains(
' ' ) )
9240 provider = def.left( def.indexOf(
' ' ) );
9241 def = def.mid( def.indexOf(
' ' ) + 1 );
9249 if ( def.startsWith(
'"' ) || def.startsWith(
'\'' ) )
9251 if ( def.endsWith(
'"' ) || def.endsWith(
'\'' ) )
9268 const QString &
name,
const QString &
description,
const QString &parentLayerParameterName,
const QVariant &
defaultValue,
bool optional
9271 , mParentConnectionParameterName( parentLayerParameterName )
9282 if ( !input.isValid() && !
mDefault.isValid() )
9285 if ( ( input.userType() == QMetaType::Type::QString && input.toString().isEmpty() ) || ( !input.isValid() &&
mDefault.userType() == QMetaType::Type::QString &&
mDefault.toString().isEmpty() ) )
9293 if ( !value.isValid() )
9296 if ( value.userType() == qMetaTypeId<QgsProperty>() )
9304 QString code = u
"##%1="_s.arg(
mName );
9306 code +=
"optional "_L1;
9307 code +=
"databaseschema "_L1;
9309 code += mParentConnectionParameterName +
' ';
9312 return code.trimmed();
9317 switch ( outputType )
9323 code +=
", optional=True"_L1;
9325 code += u
", connectionParameterName='%1'"_s.arg( mParentConnectionParameterName );
9339 QStringList depends;
9340 if ( !mParentConnectionParameterName.isEmpty() )
9341 depends << mParentConnectionParameterName;
9347 return mParentConnectionParameterName;
9352 mParentConnectionParameterName =
name;
9358 map.insert( u
"mParentConnectionParameterName"_s, mParentConnectionParameterName );
9365 mParentConnectionParameterName = map.value( u
"mParentConnectionParameterName"_s ).toString();
9372 QString def = definition;
9374 const thread_local QRegularExpression re( u
"(.*?)\\s+(.*)$"_s );
9375 const QRegularExpressionMatch m = re.match( def );
9378 parent = m.captured( 1 ).trimmed();
9379 def = m.captured( 2 );
9398 , mParentConnectionParameterName( connectionParameterName )
9399 , mParentSchemaParameterName( schemaParameterName )
9411 if ( !input.isValid() && !
mDefault.isValid() )
9414 if ( ( input.userType() == QMetaType::Type::QString && input.toString().isEmpty() ) || ( !input.isValid() &&
mDefault.userType() == QMetaType::Type::QString &&
mDefault.toString().isEmpty() ) )
9422 if ( !value.isValid() )
9425 if ( value.userType() == qMetaTypeId<QgsProperty>() )
9433 QString code = u
"##%1="_s.arg(
mName );
9435 code +=
"optional "_L1;
9436 code +=
"databasetable "_L1;
9438 code += ( mParentConnectionParameterName.isEmpty() ? u
"none"_s : mParentConnectionParameterName ) +
' ';
9439 code += ( mParentSchemaParameterName.isEmpty() ? u
"none"_s : mParentSchemaParameterName ) +
' ';
9442 return code.trimmed();
9447 switch ( outputType )
9453 code +=
", optional=True"_L1;
9455 if ( mAllowNewTableNames )
9456 code +=
", allowNewTableNames=True"_L1;
9458 code += u
", connectionParameterName='%1'"_s.arg( mParentConnectionParameterName );
9459 code += u
", schemaParameterName='%1'"_s.arg( mParentSchemaParameterName );
9473 QStringList depends;
9474 if ( !mParentConnectionParameterName.isEmpty() )
9475 depends << mParentConnectionParameterName;
9476 if ( !mParentSchemaParameterName.isEmpty() )
9477 depends << mParentSchemaParameterName;
9483 return mParentConnectionParameterName;
9488 mParentConnectionParameterName =
name;
9493 return mParentSchemaParameterName;
9498 mParentSchemaParameterName =
name;
9504 map.insert( u
"mParentConnectionParameterName"_s, mParentConnectionParameterName );
9505 map.insert( u
"mParentSchemaParameterName"_s, mParentSchemaParameterName );
9506 map.insert( u
"mAllowNewTableNames"_s, mAllowNewTableNames );
9513 mParentConnectionParameterName = map.value( u
"mParentConnectionParameterName"_s ).toString();
9514 mParentSchemaParameterName = map.value( u
"mParentSchemaParameterName"_s ).toString();
9515 mAllowNewTableNames = map.value( u
"mAllowNewTableNames"_s,
false ).toBool();
9523 QString def = definition;
9525 const thread_local QRegularExpression re( u
"(.*?)\\s+(.*+)\\b\\s*(.*)$"_s );
9526 const QRegularExpressionMatch m = re.match( def );
9529 connection = m.captured( 1 ).trimmed();
9530 if ( connection ==
"none"_L1 )
9532 schema = m.captured( 2 ).trimmed();
9533 if ( schema ==
"none"_L1 )
9535 def = m.captured( 3 );
9543 return mAllowNewTableNames;
9568 if ( !var.isValid() )
9576 if ( var.userType() == qMetaTypeId<QgsProperty>() )
9589 if ( qobject_cast< QgsPointCloudLayer * >( qvariant_cast<QObject *>( var ) ) )
9592 if ( var.userType() != QMetaType::Type::QString || var.toString().isEmpty() )
9610 if ( !val.isValid() )
9613 if ( val.userType() == qMetaTypeId<QgsProperty>() )
9617 p.insert(
name(), val );
9658 if ( !var.isValid() )
9666 if ( var.userType() == qMetaTypeId<QgsProperty>() )
9679 if ( qobject_cast< QgsAnnotationLayer * >( qvariant_cast<QObject *>( var ) ) )
9682 if ( var.userType() != QMetaType::Type::QString || var.toString().isEmpty() )
9700 if ( !val.isValid() )
9703 if ( val.userType() == qMetaTypeId<QgsProperty>() )
9707 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 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.
PythonOutputType
Available Python output types.
@ PythonQgsProcessingAlgorithmSubclass
Full Python QgsProcessingAlgorithm subclass.
static QString sourceTypeToString(Qgis::ProcessingSourceType type)
Converts a source type to a string representation.
@ SkipIndexGeneration
Do not generate index when creating a layer. Makes sense only for point cloud layers.
Encapsulates a QGIS project, including sets of map layers and their styles, layouts,...
QgsAnnotationLayer * mainAnnotationLayer()
Returns the main annotation layer associated with the project.
const QgsLayoutManager * layoutManager() const
Returns the project's layout manager, which manages print layouts, atlases and reports within the pro...
A store for object properties.
QString asExpression() const
Returns an expression string representing the state of the property, or an empty string if the proper...
QString expressionString() const
Returns the expression used for the property value.
Qgis::PropertyType propertyType() const
Returns the property type.
QString valueAsString(const QgsExpressionContext &context, const QString &defaultString=QString(), bool *ok=nullptr) const
Calculates the current value of the property and interprets it as a string.
QString field() const
Returns the current field name the property references.
QVariant value(const QgsExpressionContext &context, const QVariant &defaultValue=QVariant(), bool *ok=nullptr) const
Calculates the current value of the property, including any transforms which are set for the property...
QVariant staticValue() const
Returns the current static value for the property.
static QgsProviderRegistry * instance(const QString &pluginPath=QString())
Means of accessing canonical single instance.
QString fileVectorFilters() const
Returns a file filter string for supported vector files.
QString fileRasterFilters() const
Returns a file filter string for supported raster files.
QString fileMeshFilters() const
Returns a file filter string for supported mesh files.
QString filePointCloudFilters() const
Returns a file filter string for supported point clouds.
static QStringList extensionsForFormat(const QString &format)
Returns a list of known file extensions for the given GDAL driver format.
Represents a raster layer.
A rectangle specified with double values.
QgsCoordinateReferenceSystem crs() const
Returns the associated coordinate reference system, or an invalid CRS if no reference system is set.
A QgsGeometry with associated coordinate reference system.
static QgsReferencedGeometry fromReferencedPointXY(const QgsReferencedPointXY &point)
Construct a new QgsReferencedGeometry from referenced point.
static QgsReferencedGeometry fromReferencedRect(const QgsReferencedRectangle &rectangle)
Construct a new QgsReferencedGeometry from referenced rectangle.
A QgsPointXY with associated coordinate reference system.
A QgsRectangle with associated coordinate reference system.
Defines the parameters used to remap features when creating a QgsRemappingProxyFeatureSink.
Stores settings for use within QGIS.
QVariant value(const QString &key, const QVariant &defaultValue=QVariant(), Section section=NoSection) const
Returns the value for setting key.
static QColor parseColorWithAlpha(const QString &colorStr, bool &containsAlpha, bool strictEval=false)
Attempts to parse a string as a color using a variety of common formats, including hex codes,...
static Q_INVOKABLE QString toAbbreviatedString(Qgis::DistanceUnit unit)
Returns a translated abbreviation representing a distance unit.
static bool isNull(const QVariant &variant, bool silenceNullWarnings=false)
Returns true if the specified variant should be considered a NULL value.
static QStringList supportedFormatExtensions(VectorFormatOptions options=SortRecommended)
Returns a list of file extensions for supported formats, e.g "shp", "gpkg".
Represents a vector layer which manages a vector based dataset.
static Q_INVOKABLE QString geometryDisplayString(Qgis::GeometryType type)
Returns a display string for a geometry type.
As part of the API refactoring and improvements which landed in the Processing API was substantially reworked from the x version This was done in order to allow much of the underlying Processing framework to be ported into c
T qgsEnumKeyToValue(const QString &key, const T &defaultValue, bool tryValueAsKey=true, bool *returnOk=nullptr)
Returns the value corresponding to the given key of an enum.
QString qgsDoubleToString(double a, int precision=17)
Returns a string representation of a double.
QString qgsEnumValueToKey(const T &value, bool *returnOk=nullptr)
Returns the value for the given key of an enum.
#define QgsDebugError(str)
QString parameterAsCompatibleSourceLayerPathInternal(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context, const QStringList &compatibleFormats, const QString &preferredFormat, QgsProcessingFeedback *feedback, QString *layerName)
QString createAllMapLayerFileFilter()