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();
824 const QVariantMap ¶meters,
826 const QStringList &compatibleFormats,
827 const QString &preferredFormat,
835 QVariant val = parameters.value( definition->
name() );
837 bool selectedFeaturesOnly =
false;
838 long long featureLimit = -1;
839 QString filterExpression;
840 if ( val.userType() == qMetaTypeId<QgsProcessingFeatureSourceDefinition>() )
849 else if ( val.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
856 if ( val.userType() == qMetaTypeId<QgsProperty>() )
862 vl = qobject_cast< QgsVectorLayer * >( qvariant_cast<QObject *>( val ) );
867 if ( val.userType() == qMetaTypeId<QgsProperty>() )
871 else if ( !val.isValid() || val.toString().isEmpty() )
877 vl = qobject_cast< QgsVectorLayer * >( qvariant_cast<QObject *>( val ) );
883 layerRef = val.toString();
888 if ( layerRef.isEmpty() )
906 const QVariantMap ¶meters,
908 const QStringList &compatibleFormats,
909 const QString &preferredFormat,
918 const QVariantMap ¶meters,
920 const QStringList &compatibleFormats,
921 const QString &preferredFormat,
926 QString *destLayer = layerName;
943 return parameterAsLayer( definition, parameters.value( definition->
name() ), context, layerHint, flags );
953 QVariant val = value;
954 if ( val.userType() == qMetaTypeId<QgsProperty>() )
959 if (
QgsMapLayer *layer = qobject_cast< QgsMapLayer * >( qvariant_cast<QObject *>( val ) ) )
964 if ( val.userType() == qMetaTypeId<QgsProcessingRasterLayerDefinition>() )
970 if ( val.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
982 if ( !val.isValid() || val.toString().isEmpty() )
988 if (
QgsMapLayer *layer = qobject_cast< QgsMapLayer * >( qvariant_cast<QObject *>( val ) ) )
993 QString layerRef = val.toString();
994 if ( layerRef.isEmpty() )
997 if ( layerRef.isEmpty() )
1028 val = parameters.value( definition->
name() );
1039 val = parameters.value( definition->
name() );
1040 if ( val.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
1044 format = fromVar.
format();
1052 QVariant val = value;
1056 if ( val.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
1066 if ( definition && val.userType() == qMetaTypeId<QgsProperty>() )
1070 else if ( definition && ( !val.isValid() || val.toString().isEmpty() ) )
1077 dest = val.toString();
1082 dest = destParam->generateTemporaryDestination( &context );
1085 if ( destinationProject )
1088 if ( destName.isEmpty() && definition )
1093 outputName = definition->
name();
1117 val = parameters.value( definition->
name() );
1124 QVariant val = value;
1126 if ( val.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
1134 if ( definition && val.userType() == qMetaTypeId<QgsProperty>() )
1138 else if ( definition && ( !val.isValid() || val.toString().isEmpty() ) )
1145 dest = val.toString();
1150 dest = destParam->generateTemporaryDestination( &context );
1170 return parameterAsCrs( definition, parameters.value( definition->
name() ), context );
1196 QVariant val = value;
1198 if ( val.userType() == qMetaTypeId<QgsRectangle>() )
1202 if ( val.userType() == qMetaTypeId< QgsGeometry>() )
1208 if ( val.userType() == qMetaTypeId<QgsReferencedRectangle>() )
1227 if ( val.userType() == qMetaTypeId<QgsProcessingFeatureSourceDefinition>() )
1233 else if ( val.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
1246 QgsMapLayer *layer = qobject_cast< QgsMapLayer * >( qvariant_cast<QObject *>( val ) );
1249 if ( val.userType() == qMetaTypeId<QgsProperty>() )
1252 rectText = val.toString();
1254 if ( rectText.isEmpty() && !layer )
1257 const thread_local QRegularExpression rx( u
"^(.*?)\\s*,\\s*(.*?),\\s*(.*?),\\s*(.*?)\\s*(?:\\[(.*)\\])?\\s*$"_s );
1258 const QRegularExpressionMatch match = rx.match( rectText );
1259 if ( match.hasMatch() )
1261 bool xMinOk =
false;
1262 const double xMin = match.captured( 1 ).toDouble( &xMinOk );
1263 bool xMaxOk =
false;
1264 const double xMax = match.captured( 2 ).toDouble( &xMaxOk );
1265 bool yMinOk =
false;
1266 const double yMin = match.captured( 3 ).toDouble( &yMinOk );
1267 bool yMaxOk =
false;
1268 const double yMax = match.captured( 4 ).toDouble( &yMaxOk );
1269 if ( xMinOk && xMaxOk && yMinOk && yMaxOk )
1322 QVariant val = parameters.value( definition->
name() );
1324 if ( val.userType() == qMetaTypeId<QgsReferencedRectangle>() )
1330 g = g.densifyByCount( 20 );
1344 if ( val.userType() == qMetaTypeId<QgsProcessingFeatureSourceDefinition>() )
1350 else if ( val.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
1363 if ( val.userType() == qMetaTypeId<QgsProperty>() )
1366 rectText = val.toString();
1368 if ( !rectText.isEmpty() )
1370 const thread_local QRegularExpression rx( u
"^(.*?)\\s*,\\s*(.*?),\\s*(.*?),\\s*(.*?)\\s*(?:\\[(.*)\\])?\\s*$"_s );
1371 const QRegularExpressionMatch match = rx.match( rectText );
1372 if ( match.hasMatch() )
1374 bool xMinOk =
false;
1375 const double xMin = match.captured( 1 ).toDouble( &xMinOk );
1376 bool xMaxOk =
false;
1377 const double xMax = match.captured( 2 ).toDouble( &xMaxOk );
1378 bool yMinOk =
false;
1379 const double yMin = match.captured( 3 ).toDouble( &yMinOk );
1380 bool yMaxOk =
false;
1381 const double yMax = match.captured( 4 ).toDouble( &yMaxOk );
1382 if ( xMinOk && xMaxOk && yMinOk && yMaxOk )
1412 QgsMapLayer *layer = qobject_cast< QgsMapLayer * >( qvariant_cast<QObject *>( val ) );
1441 const QVariant val = parameters.value( definition->
name() );
1447 QVariant val = value;
1448 if ( val.userType() == qMetaTypeId<QgsReferencedRectangle>() )
1457 if ( val.userType() == qMetaTypeId<QgsProcessingFeatureSourceDefinition>() )
1463 else if ( val.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
1475 QString valueAsString;
1476 if ( val.userType() == qMetaTypeId<QgsProperty>() )
1479 valueAsString = val.toString();
1481 const thread_local QRegularExpression rx( u
"^(.*?)\\s*,\\s*(.*?),\\s*(.*?),\\s*(.*?)\\s*(?:\\[(.*)\\])?\\s*$"_s );
1483 const QRegularExpressionMatch match = rx.match( valueAsString );
1484 if ( match.hasMatch() )
1491 if ( val.userType() == qMetaTypeId<QgsProcessingFeatureSourceDefinition>() )
1497 else if ( val.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
1510 if (
QgsMapLayer *layer = qobject_cast< QgsMapLayer * >( qvariant_cast<QObject *>( val ) ) )
1511 return layer->crs();
1513 return layer->crs();
1515 if (
auto *lProject = context.
project() )
1516 return lProject->crs();
1536 const QVariant val = value;
1537 if ( val.userType() == qMetaTypeId<QgsPointXY>() )
1541 if ( val.userType() == qMetaTypeId< QgsGeometry>() )
1547 if ( val.userType() == qMetaTypeId<QgsReferencedPointXY>() )
1566 if ( pointText.isEmpty() )
1569 if ( pointText.isEmpty() )
1572 const thread_local QRegularExpression rx( u
"^\\s*\\(?\\s*(.*?)\\s*,\\s*(.*?)\\s*(?:\\[(.*)\\])?\\s*\\)?\\s*$"_s );
1575 const QRegularExpressionMatch match = rx.match( valueAsString );
1576 if ( match.hasMatch() )
1579 const double x = match.captured( 1 ).toDouble( &xOk );
1581 const double y = match.captured( 2 ).toDouble( &yOk );
1609 const QVariant val = parameters.value( definition->
name() );
1615 if ( value.userType() == qMetaTypeId<QgsReferencedPointXY>() )
1624 const thread_local QRegularExpression rx( u
"^\\s*\\(?\\s*(.*?)\\s*,\\s*(.*?)\\s*(?:\\[(.*)\\])?\\s*\\)?\\s*$"_s );
1627 const QRegularExpressionMatch match = rx.match( valueAsString );
1628 if ( match.hasMatch() )
1635 if (
auto *lProject = context.
project() )
1636 return lProject->crs();
1656 const QVariant val = value;
1657 if ( val.userType() == qMetaTypeId< QgsGeometry>() )
1662 if ( val.userType() == qMetaTypeId<QgsPointXY>() )
1667 if ( val.userType() == qMetaTypeId<QgsRectangle>() )
1672 if ( val.userType() == qMetaTypeId<QgsReferencedPointXY>() )
1690 if ( val.userType() == qMetaTypeId<QgsReferencedRectangle>() )
1696 g = g.densifyByCount( 20 );
1710 if ( val.userType() == qMetaTypeId<QgsReferencedGeometry>() )
1729 if ( valueAsString.isEmpty() )
1732 if ( valueAsString.isEmpty() )
1735 const thread_local QRegularExpression rx( u
"^\\s*(?:CRS=(.*);)?(.*?)$"_s );
1737 const QRegularExpressionMatch match = rx.match( valueAsString );
1738 if ( match.hasMatch() )
1765 const QVariant val = parameters.value( definition->
name() );
1771 if ( value.userType() == qMetaTypeId<QgsReferencedGeometry>() )
1780 if ( value.userType() == qMetaTypeId<QgsReferencedPointXY>() )
1789 if ( value.userType() == qMetaTypeId<QgsReferencedRectangle>() )
1799 const QRegularExpression rx( u
"^\\s*(?:CRS=(.*);)?(.*?)$"_s );
1802 const QRegularExpressionMatch match = rx.match( valueAsString );
1803 if ( match.hasMatch() )
1810 if (
auto *lProject = context.
project() )
1811 return lProject->crs();
1822 if ( fileText.isEmpty() )
1833 if ( fileText.isEmpty() )
1841 return QVariantList();
1849 return QVariantList();
1851 QString resultString;
1852 const QVariant val = value;
1853 if ( val.userType() == qMetaTypeId<QgsProperty>() )
1855 else if ( val.userType() == QMetaType::Type::QVariantList )
1856 return val.toList();
1858 resultString = val.toString();
1860 if ( resultString.isEmpty() )
1863 if ( definition->
defaultValue().userType() == QMetaType::Type::QVariantList )
1869 QVariantList result;
1870 const auto constSplit = resultString.split(
',' );
1873 for (
const QString &s : constSplit )
1875 number = s.toDouble( &ok );
1876 result << ( ok ? QVariant( number ) : s );
1887 return QList<QgsMapLayer *>();
1897 return QList<QgsMapLayer *>();
1899 const QVariant val = value;
1900 if (
QgsMapLayer *layer = qobject_cast< QgsMapLayer * >( qvariant_cast<QObject *>( val ) ) )
1902 return QList<QgsMapLayer *>() << layer;
1905 QList<QgsMapLayer *> layers;
1907 std::function< void(
const QVariant &var ) > processVariant;
1908 processVariant = [&layers, &context, &definition, flags, &processVariant](
const QVariant &var ) {
1909 if ( var.userType() == QMetaType::Type::QVariantList )
1911 const auto constToList = var.toList();
1912 for (
const QVariant &listVar : constToList )
1914 processVariant( listVar );
1917 else if ( var.userType() == QMetaType::Type::QStringList )
1919 const auto constToStringList = var.toStringList();
1920 for (
const QString &s : constToStringList )
1922 processVariant( s );
1925 else if ( var.userType() == qMetaTypeId<QgsProperty>() )
1927 else if ( var.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
1931 const QVariant sink = fromVar.
sink;
1932 if ( sink.userType() == qMetaTypeId<QgsProperty>() )
1937 else if (
QgsMapLayer *layer = qobject_cast< QgsMapLayer * >( qvariant_cast<QObject *>( var ) ) )
1949 processVariant( val );
1951 if ( layers.isEmpty() )
1954 if (
QgsMapLayer *layer = qobject_cast< QgsMapLayer * >( qvariant_cast<QObject *>( definition->
defaultValue() ) ) )
1958 else if ( definition->
defaultValue().userType() == QMetaType::Type::QVariantList )
1960 const auto constToList = definition->
defaultValue().toList();
1961 for (
const QVariant &var : constToList )
1963 if (
QgsMapLayer *layer = qobject_cast< QgsMapLayer * >( qvariant_cast<QObject *>( var ) ) )
1969 processVariant( var );
1983 return QStringList();
1985 const QVariant val = value;
1989 std::function< void(
const QVariant &var ) > processVariant;
1990 processVariant = [&files, &context, &definition, &processVariant](
const QVariant &var ) {
1991 if ( var.userType() == QMetaType::Type::QVariantList )
1993 const auto constToList = var.toList();
1994 for (
const QVariant &listVar : constToList )
1996 processVariant( listVar );
1999 else if ( var.userType() == QMetaType::Type::QStringList )
2001 const auto constToStringList = var.toStringList();
2002 for (
const QString &s : constToStringList )
2004 processVariant( s );
2007 else if ( var.userType() == qMetaTypeId<QgsProperty>() )
2011 files << var.toString();
2015 processVariant( val );
2017 if ( files.isEmpty() )
2028 return QStringList();
2036 return QList<double>();
2044 return QList<double>();
2046 QStringList resultStringList;
2047 const QVariant val = value;
2049 if ( val.userType() == qMetaTypeId<QgsProperty>() )
2051 else if ( val.userType() == QMetaType::Type::QVariantList )
2053 const auto constToList = val.toList();
2054 for (
const QVariant &var : constToList )
2055 resultStringList << var.toString();
2058 resultStringList << val.toString();
2060 if ( ( resultStringList.isEmpty() || ( resultStringList.size() == 1 && resultStringList.at( 0 ).isEmpty() ) ) )
2062 resultStringList.clear();
2064 if ( definition->
defaultValue().userType() == QMetaType::Type::QVariantList )
2066 const auto constToList = definition->
defaultValue().toList();
2067 for (
const QVariant &var : constToList )
2068 resultStringList << var.toString();
2071 resultStringList << definition->
defaultValue().toString();
2074 if ( resultStringList.size() == 1 )
2076 resultStringList = resultStringList.at( 0 ).split(
',' );
2079 if ( resultStringList.size() < 2 )
2080 return QList< double >() << std::numeric_limits<double>::quiet_NaN() << std::numeric_limits<double>::quiet_NaN();
2082 QList< double > result;
2084 double n = resultStringList.at( 0 ).toDouble( &ok );
2088 result << std::numeric_limits<double>::quiet_NaN();
2090 n = resultStringList.at( 1 ).toDouble( &ok );
2094 result << std::numeric_limits<double>::quiet_NaN();
2102 return QStringList();
2115 return QStringList();
2123 return QStringList();
2125 QStringList resultStringList;
2126 const QVariant val = value;
2127 if ( val.isValid() )
2129 if ( val.userType() == qMetaTypeId<QgsProperty>() )
2131 else if ( val.userType() == QMetaType::Type::QVariantList )
2133 const auto constToList = val.toList();
2134 for (
const QVariant &var : constToList )
2135 resultStringList << var.toString();
2137 else if ( val.userType() == QMetaType::Type::QStringList )
2139 resultStringList = val.toStringList();
2142 resultStringList.append( val.toString().split(
';' ) );
2145 if ( ( resultStringList.isEmpty() || resultStringList.at( 0 ).isEmpty() ) )
2147 resultStringList.clear();
2151 if ( definition->
defaultValue().userType() == QMetaType::Type::QVariantList )
2153 const auto constToList = definition->
defaultValue().toList();
2154 for (
const QVariant &var : constToList )
2155 resultStringList << var.toString();
2157 else if ( definition->
defaultValue().userType() == QMetaType::Type::QStringList )
2159 resultStringList = definition->
defaultValue().toStringList();
2162 resultStringList.append( definition->
defaultValue().toString().split(
';' ) );
2166 return resultStringList;
2180 if ( layoutName.isEmpty() )
2232 QVariant val = value;
2233 if ( val.userType() == qMetaTypeId<QgsProperty>() )
2237 if ( val.userType() == QMetaType::Type::QColor )
2239 QColor
c = val.value< QColor >();
2241 if ( !colorParam->opacityEnabled() )
2249 if ( definition->
defaultValue().userType() == QMetaType::Type::QColor )
2255 if ( colorText.isEmpty() )
2258 bool containsAlpha =
false;
2261 if (
c.isValid() && !colorParam->opacityEnabled() )
2337 const QString type = map.value( u
"parameter_type"_s ).toString();
2338 const QString name = map.value( u
"name"_s ).toString();
2339 std::unique_ptr< QgsProcessingParameterDefinition > def;
2345 def = std::make_unique<QgsProcessingParameterBoolean>( name );
2347 def = std::make_unique<QgsProcessingParameterCrs>( name );
2349 def = std::make_unique<QgsProcessingParameterMapLayer>( name );
2351 def = std::make_unique<QgsProcessingParameterExtent>( name );
2353 def = std::make_unique<QgsProcessingParameterPoint>( name );
2355 def = std::make_unique<QgsProcessingParameterFile>( name );
2357 def = std::make_unique<QgsProcessingParameterMatrix>( name );
2359 def = std::make_unique<QgsProcessingParameterMultipleLayers>( name );
2361 def = std::make_unique<QgsProcessingParameterNumber>( name );
2363 def = std::make_unique<QgsProcessingParameterRange>( name );
2365 def = std::make_unique<QgsProcessingParameterRasterLayer>( name );
2367 def = std::make_unique<QgsProcessingParameterEnum>( name );
2369 def = std::make_unique<QgsProcessingParameterString>( name );
2371 def = std::make_unique<QgsProcessingParameterAuthConfig>( name );
2373 def = std::make_unique<QgsProcessingParameterExpression>( name );
2375 def = std::make_unique<QgsProcessingParameterVectorLayer>( name );
2377 def = std::make_unique<QgsProcessingParameterField>( name );
2379 def = std::make_unique<QgsProcessingParameterFeatureSource>( name );
2381 def = std::make_unique<QgsProcessingParameterFeatureSink>( name );
2383 def = std::make_unique<QgsProcessingParameterVectorDestination>( name );
2385 def = std::make_unique<QgsProcessingParameterRasterDestination>( name );
2387 def = std::make_unique<QgsProcessingParameterPointCloudDestination>( name );
2389 def = std::make_unique<QgsProcessingParameterFileDestination>( name );
2391 def = std::make_unique<QgsProcessingParameterFolderDestination>( name );
2393 def = std::make_unique<QgsProcessingParameterBand>( name );
2395 def = std::make_unique<QgsProcessingParameterMeshLayer>( name );
2397 def = std::make_unique<QgsProcessingParameterLayout>( name );
2399 def = std::make_unique<QgsProcessingParameterLayoutItem>( name );
2401 def = std::make_unique<QgsProcessingParameterColor>( name );
2403 def = std::make_unique<QgsProcessingParameterCoordinateOperation>( name );
2405 def = std::make_unique<QgsProcessingParameterPointCloudLayer>( name );
2407 def = std::make_unique<QgsProcessingParameterAnnotationLayer>( name );
2409 def = std::make_unique<QgsProcessingParameterPointCloudAttribute>( name );
2411 def = std::make_unique<QgsProcessingParameterVectorTileDestination>( name );
2416 def.reset( paramType->
create( name ) );
2422 def->fromVariantMap( map );
2423 return def.release();
2428 QString desc = name;
2429 desc.replace(
'_',
' ' );
2435 bool isOptional =
false;
2439 if ( !parseScriptCodeParameterOptions( code, isOptional, name, type, definition ) )
2444 if ( type ==
"boolean"_L1 )
2446 else if ( type ==
"crs"_L1 )
2448 else if ( type ==
"layer"_L1 )
2450 else if ( type ==
"extent"_L1 )
2452 else if ( type ==
"point"_L1 )
2454 else if ( type ==
"geometry"_L1 )
2456 else if ( type ==
"file"_L1 )
2458 else if ( type ==
"folder"_L1 )
2460 else if ( type ==
"matrix"_L1 )
2462 else if ( type ==
"multiple"_L1 )
2464 else if ( type ==
"number"_L1 )
2466 else if ( type ==
"distance"_L1 )
2468 else if ( type ==
"area"_L1 )
2470 else if ( type ==
"volume"_L1 )
2472 else if ( type ==
"duration"_L1 )
2474 else if ( type ==
"scale"_L1 )
2476 else if ( type ==
"range"_L1 )
2478 else if ( type ==
"raster"_L1 )
2480 else if ( type ==
"enum"_L1 )
2482 else if ( type ==
"string"_L1 )
2484 else if ( type ==
"authcfg"_L1 )
2486 else if ( type ==
"expression"_L1 )
2488 else if ( type ==
"field"_L1 )
2490 else if ( type ==
"vector"_L1 )
2492 else if ( type ==
"source"_L1 )
2494 else if ( type ==
"sink"_L1 )
2496 else if ( type ==
"vectordestination"_L1 )
2498 else if ( type ==
"rasterdestination"_L1 )
2500 else if ( type ==
"pointclouddestination"_L1 )
2502 else if ( type ==
"filedestination"_L1 )
2504 else if ( type ==
"folderdestination"_L1 )
2506 else if ( type ==
"band"_L1 )
2508 else if ( type ==
"mesh"_L1 )
2510 else if ( type ==
"layout"_L1 )
2512 else if ( type ==
"layoutitem"_L1 )
2514 else if ( type ==
"color"_L1 )
2516 else if ( type ==
"coordinateoperation"_L1 )
2518 else if ( type ==
"maptheme"_L1 )
2520 else if ( type ==
"datetime"_L1 )
2522 else if ( type ==
"providerconnection"_L1 )
2524 else if ( type ==
"databaseschema"_L1 )
2526 else if ( type ==
"databasetable"_L1 )
2528 else if ( type ==
"pointcloud"_L1 )
2530 else if ( type ==
"annotation"_L1 )
2532 else if ( type ==
"attribute"_L1 )
2534 else if ( type ==
"vectortiledestination"_L1 )
2540bool QgsProcessingParameters::parseScriptCodeParameterOptions(
const QString &code,
bool &isOptional, QString &name, QString &type, QString &definition )
2542 const thread_local QRegularExpression re( u
"(?:#*)(.*?)=\\s*(.*)"_s );
2543 QRegularExpressionMatch m = re.match( code );
2544 if ( !m.hasMatch() )
2547 name = m.captured( 1 );
2548 QString tokens = m.captured( 2 );
2549 if ( tokens.startsWith(
"optional"_L1, Qt::CaseInsensitive ) )
2552 tokens.remove( 0, 8 );
2559 tokens = tokens.trimmed();
2561 const thread_local QRegularExpression re2( u
"(.*?)\\s+(.*)"_s );
2562 m = re2.match( tokens );
2563 if ( !m.hasMatch() )
2565 type = tokens.toLower().trimmed();
2570 type = m.captured( 1 ).toLower().trimmed();
2571 definition = m.captured( 2 );
2585 ,
mFlags( optional ?
Qgis::ProcessingParameterFlag::Optional :
Qgis::ProcessingParameterFlag() )
2591 if ( defaultSettingsValue.isValid() )
2593 return defaultSettingsValue;
2601 if ( defaultSettingsValue.isValid() )
2603 return defaultSettingsValue;
2613 if ( settingValue.isValid() )
2615 return settingValue;
2623 if ( !input.isValid() && !
mDefault.isValid() )
2626 if ( ( input.userType() == QMetaType::Type::QString && input.toString().isEmpty() ) || ( !input.isValid() &&
mDefault.userType() == QMetaType::Type::QString &&
mDefault.toString().isEmpty() ) )
2634 if ( !value.isValid() )
2637 if ( value.userType() == qMetaTypeId<QgsProperty>() )
2650 if ( !value.isValid() )
2654 if ( value.userType() == QMetaType::Type::QVariantMap )
2656 const QVariantMap sourceMap = value.toMap();
2657 QVariantMap resultMap;
2658 for (
auto it = sourceMap.constBegin(); it != sourceMap.constEnd(); it++ )
2664 else if ( value.userType() == QMetaType::Type::QVariantList || value.userType() == QMetaType::Type::QStringList )
2666 const QVariantList sourceList = value.toList();
2667 QVariantList resultList;
2668 resultList.reserve( sourceList.size() );
2669 for (
const QVariant &v : sourceList )
2677 switch ( value.userType() )
2680 case QMetaType::Bool:
2681 case QMetaType::Char:
2682 case QMetaType::Int:
2683 case QMetaType::Double:
2684 case QMetaType::Float:
2685 case QMetaType::LongLong:
2686 case QMetaType::ULongLong:
2687 case QMetaType::UInt:
2688 case QMetaType::ULong:
2689 case QMetaType::UShort:
2696 if ( value.userType() == qMetaTypeId<QgsProperty>() )
2706 return QVariantMap( { { u
"type"_s, u
"data_defined"_s }, { u
"field"_s, prop.
field() } } );
2708 return QVariantMap( { { u
"type"_s, u
"data_defined"_s }, { u
"expression"_s, prop.
expressionString() } } );
2713 if ( value.userType() == qMetaTypeId<QgsCoordinateReferenceSystem>() )
2718 else if ( !crs.
authid().isEmpty() )
2723 else if ( value.userType() == qMetaTypeId<QgsRectangle>() )
2728 else if ( value.userType() == qMetaTypeId<QgsReferencedRectangle>() )
2733 else if ( value.userType() == qMetaTypeId< QgsGeometry>() )
2745 else if ( value.userType() == qMetaTypeId<QgsReferencedGeometry>() )
2760 else if ( value.userType() == qMetaTypeId<QgsPointXY>() )
2765 else if ( value.userType() == qMetaTypeId<QgsReferencedPointXY>() )
2770 else if ( value.userType() == qMetaTypeId<QgsProcessingFeatureSourceDefinition>() )
2777 else if ( value.userType() == qMetaTypeId<QgsProcessingRasterLayerDefinition>() )
2784 else if ( value.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
2789 else if ( value.userType() == qMetaTypeId<QColor>() )
2791 const QColor fromVar = value.value< QColor >();
2792 if ( !fromVar.isValid() )
2795 return u
"rgba( %1, %2, %3, %4 )"_s.arg( fromVar.red() ).arg( fromVar.green() ).arg( fromVar.blue() ).arg( QString::number( fromVar.alphaF(),
'f', 2 ) );
2797 else if ( value.userType() == qMetaTypeId<QDateTime>() )
2799 const QDateTime fromVar = value.toDateTime();
2800 if ( !fromVar.isValid() )
2803 return fromVar.toString( Qt::ISODate );
2805 else if ( value.userType() == qMetaTypeId<QDate>() )
2807 const QDate fromVar = value.toDate();
2808 if ( !fromVar.isValid() )
2811 return fromVar.toString( Qt::ISODate );
2813 else if ( value.userType() == qMetaTypeId<QTime>() )
2815 const QTime fromVar = value.toTime();
2816 if ( !fromVar.isValid() )
2819 return fromVar.toString( Qt::ISODate );
2826 p.insert(
name(), value );
2834 if ( value.userType() == QMetaType::QString )
2839 Q_ASSERT_X(
false,
"QgsProcessingParameterDefinition::valueAsJsonObject", u
"unsupported variant type %1"_s.arg( QMetaType::typeName( value.userType() ) ).toLocal8Bit() );
2852 if ( !value.isValid() )
2855 switch ( value.userType() )
2858 case QMetaType::Bool:
2859 case QMetaType::Char:
2860 case QMetaType::Int:
2861 case QMetaType::Double:
2862 case QMetaType::Float:
2863 case QMetaType::LongLong:
2864 case QMetaType::ULongLong:
2865 case QMetaType::UInt:
2866 case QMetaType::ULong:
2867 case QMetaType::UShort:
2868 return value.toString();
2874 if ( value.userType() == qMetaTypeId<QgsProperty>() )
2884 return u
"field:%1"_s.arg( prop.
field() );
2891 if ( value.userType() == qMetaTypeId<QgsCoordinateReferenceSystem>() )
2896 else if ( !crs.
authid().isEmpty() )
2901 else if ( value.userType() == qMetaTypeId<QgsRectangle>() )
2906 else if ( value.userType() == qMetaTypeId<QgsReferencedRectangle>() )
2911 else if ( value.userType() == qMetaTypeId< QgsGeometry>() )
2923 else if ( value.userType() == qMetaTypeId<QgsReferencedGeometry>() )
2938 else if ( value.userType() == qMetaTypeId<QgsPointXY>() )
2943 else if ( value.userType() == qMetaTypeId<QgsReferencedPointXY>() )
2948 else if ( value.userType() == qMetaTypeId<QgsProcessingFeatureSourceDefinition>() )
2953 else if ( value.userType() == qMetaTypeId<QgsProcessingRasterLayerDefinition>() )
2958 else if ( value.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
2963 else if ( value.userType() == qMetaTypeId<QColor>() )
2965 const QColor fromVar = value.value< QColor >();
2966 if ( !fromVar.isValid() )
2969 return u
"rgba( %1, %2, %3, %4 )"_s.arg( fromVar.red() ).arg( fromVar.green() ).arg( fromVar.blue() ).arg( QString::number( fromVar.alphaF(),
'f', 2 ) );
2971 else if ( value.userType() == qMetaTypeId<QDateTime>() )
2973 const QDateTime fromVar = value.toDateTime();
2974 if ( !fromVar.isValid() )
2977 return fromVar.toString( Qt::ISODate );
2979 else if ( value.userType() == qMetaTypeId<QDate>() )
2981 const QDate fromVar = value.toDate();
2982 if ( !fromVar.isValid() )
2985 return fromVar.toString( Qt::ISODate );
2987 else if ( value.userType() == qMetaTypeId<QTime>() )
2989 const QTime fromVar = value.toTime();
2990 if ( !fromVar.isValid() )
2993 return fromVar.toString( Qt::ISODate );
3000 p.insert(
name(), value );
3008 if ( value.userType() == QMetaType::QString )
3009 return value.toString();
3012 QgsDebugError( u
"unsupported variant type %1"_s.arg( QMetaType::typeName( value.userType() ) ) );
3014 return value.toString();
3020 if ( !value.isValid() )
3021 return QStringList();
3023 if ( value.userType() == QMetaType::Type::QVariantList || value.userType() == QMetaType::Type::QStringList )
3025 const QVariantList sourceList = value.toList();
3026 QStringList resultList;
3027 resultList.reserve( sourceList.size() );
3028 for (
const QVariant &v : sourceList )
3037 return QStringList();
3049 QString code = u
"##%1="_s.arg(
mName );
3051 code +=
"optional "_L1;
3052 code +=
type() +
' ';
3054 return code.trimmed();
3062 switch ( outputType )
3068 code +=
", optional=True"_L1;
3084 map.insert( u
"parameter_type"_s,
type() );
3085 map.insert( u
"name"_s,
mName );
3087 map.insert( u
"help"_s,
mHelp );
3088 map.insert( u
"default"_s,
mDefault );
3090 map.insert( u
"flags"_s,
static_cast< int >(
mFlags ) );
3097 mName = map.value( u
"name"_s ).toString();
3098 mDescription = map.value( u
"description"_s ).toString();
3099 mHelp = map.value( u
"help"_s ).toString();
3100 mDefault = map.value( u
"default"_s );
3103 mMetadata = map.value( u
"metadata"_s ).toMap();
3119 QString text = u
"<p><b>%1</b></p>"_s.arg(
description() );
3120 if ( !
help().isEmpty() )
3122 text += u
"<p>%1</p>"_s.arg(
help() );
3124 text += u
"<p>%1</p>"_s.arg( QObject::tr(
"Python identifier: ‘%1’" ).arg( u
"<i>%1</i>"_s.arg(
name() ) ) );
3153 if ( value.userType() == qMetaTypeId<QgsPointXY>() )
3159 else if ( value.userType() == qMetaTypeId<QgsReferencedPointXY>() )
3165 else if ( value.userType() == qMetaTypeId<QgsRectangle>() )
3171 else if ( value.userType() == qMetaTypeId<QgsReferencedRectangle>() )
3181 else if ( value.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
3194 return value.toString();
3200 if ( !val.isValid() )
3203 if ( val.userType() == qMetaTypeId<QgsProperty>() )
3205 return val.toBool() ? u
"True"_s : u
"False"_s;
3210 QString code = u
"##%1="_s.arg(
mName );
3212 code +=
"optional "_L1;
3213 code +=
type() +
' ';
3214 code +=
mDefault.toBool() ? u
"true"_s : u
"false"_s;
3215 return code.trimmed();
3235 if ( !input.isValid() )
3243 if ( input.userType() == qMetaTypeId<QgsCoordinateReferenceSystem>() )
3247 else if ( input.userType() == qMetaTypeId<QgsProcessingFeatureSourceDefinition>() )
3251 else if ( input.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
3256 if ( input.userType() == qMetaTypeId<QgsProperty>() )
3261 if ( input.type() == QVariant::String )
3263 const QString
string = input.toString();
3264 if (
string.compare(
"ProjectCrs"_L1, Qt::CaseInsensitive ) == 0 )
3273 if ( qobject_cast< QgsMapLayer * >( qvariant_cast<QObject *>( input ) ) )
3276 if ( input.userType() != QMetaType::Type::QString || input.toString().isEmpty() )
3284 if ( !value.isValid() )
3287 if ( value.userType() == qMetaTypeId<QgsCoordinateReferenceSystem>() )
3290 return u
"QgsCoordinateReferenceSystem()"_s;
3295 if ( value.userType() == qMetaTypeId<QgsProperty>() )
3298 if ( value.type() == QVariant::String )
3300 const QString
string = value.toString();
3301 if (
string.compare(
"ProjectCrs"_L1, Qt::CaseInsensitive ) == 0 )
3310 p.insert(
name(), value );
3320 if ( value.type() == QVariant::String )
3322 const QString
string = value.toString();
3323 if (
string.compare(
"ProjectCrs"_L1, Qt::CaseInsensitive ) == 0 )
3336 if ( value.type() == QVariant::String )
3338 const QString
string = value.toString();
3339 if (
string.compare(
"ProjectCrs"_L1, Qt::CaseInsensitive ) == 0 )
3365 return QObject::tr(
"Invalid CRS" );
3383 if ( !input.isValid() )
3391 if ( input.userType() == qMetaTypeId<QgsProperty>() )
3396 if ( qobject_cast< QgsMapLayer * >( qvariant_cast<QObject *>( input ) ) )
3401 if ( input.userType() != QMetaType::Type::QString || input.toString().isEmpty() )
3419 if ( !val.isValid() )
3422 if ( val.userType() == qMetaTypeId<QgsProperty>() )
3426 p.insert(
name(), val );
3445 for (
const QString &raster : rasters )
3447 if ( !vectors.contains( raster ) )
3451 for (
const QString &mesh : meshFilters )
3453 if ( !vectors.contains( mesh ) )
3457 for (
const QString &pointCloud : pointCloudFilters )
3459 if ( !vectors.contains( pointCloud ) )
3460 vectors << pointCloud;
3462 vectors.removeAll( QObject::tr(
"All files (*.*)" ) );
3463 std::sort( vectors.begin(), vectors.end() );
3465 return QObject::tr(
"All files (*.*)" ) + u
";;"_s + vectors.join(
";;"_L1 );
3475 QString code = u
"##%1="_s.arg(
mName );
3477 code +=
"optional "_L1;
3478 code +=
"layer "_L1;
3485 code +=
"table "_L1;
3489 code +=
"hasgeometry "_L1;
3493 code +=
"point "_L1;
3501 code +=
"polygon "_L1;
3505 code +=
"raster "_L1;
3513 code +=
"plugin "_L1;
3517 code +=
"pointcloud "_L1;
3521 code +=
"annotation "_L1;
3525 code +=
"vectortile "_L1;
3529 code +=
"tiledscene "_L1;
3538 return code.trimmed();
3544 QString def = definition;
3547 if ( def.startsWith(
"table"_L1, Qt::CaseInsensitive ) )
3553 if ( def.startsWith(
"hasgeometry"_L1, Qt::CaseInsensitive ) )
3556 def = def.mid( 12 );
3559 else if ( def.startsWith(
"point"_L1, Qt::CaseInsensitive ) )
3565 else if ( def.startsWith(
"line"_L1, Qt::CaseInsensitive ) )
3571 else if ( def.startsWith(
"polygon"_L1, Qt::CaseInsensitive ) )
3577 else if ( def.startsWith(
"raster"_L1, Qt::CaseInsensitive ) )
3583 else if ( def.startsWith(
"mesh"_L1, Qt::CaseInsensitive ) )
3589 else if ( def.startsWith(
"plugin"_L1, Qt::CaseInsensitive ) )
3595 else if ( def.startsWith(
"pointcloud"_L1, Qt::CaseInsensitive ) )
3598 def = def.mid( 11 );
3601 else if ( def.startsWith(
"annotation"_L1, Qt::CaseInsensitive ) )
3604 def = def.mid( 11 );
3607 else if ( def.startsWith(
"vectortile"_L1, Qt::CaseInsensitive ) )
3610 def = def.mid( 11 );
3613 else if ( def.startsWith(
"tiledscene"_L1, Qt::CaseInsensitive ) )
3616 def = def.mid( 11 );
3627 switch ( outputType )
3633 code +=
", optional=True"_L1;
3640 QStringList options;
3644 code += u
", types=[%1])"_s.arg( options.join(
',' ) );
3665 map.insert( u
"data_types"_s, types );
3673 const QVariantList values = map.value( u
"data_types"_s ).toList();
3674 for (
const QVariant &val : values )
3693 if ( !input.isValid() )
3701 if ( input.userType() == qMetaTypeId<QgsProcessingFeatureSourceDefinition>() )
3705 else if ( input.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
3710 if ( input.userType() == qMetaTypeId<QgsProperty>() )
3715 if ( input.userType() == qMetaTypeId<QgsRectangle>() )
3720 if ( input.userType() == qMetaTypeId< QgsGeometry>() )
3724 if ( input.userType() == qMetaTypeId<QgsReferencedRectangle>() )
3731 if ( qobject_cast< QgsMapLayer * >( qvariant_cast<QObject *>( input ) ) )
3734 if ( input.userType() != QMetaType::Type::QString || input.toString().isEmpty() )
3737 if ( variantIsValidStringForExtent( input ) )
3750bool QgsProcessingParameterExtent::variantIsValidStringForExtent(
const QVariant &value )
3752 if ( value.userType() == QMetaType::Type::QString )
3754 const thread_local QRegularExpression rx( u
"^(.*?)\\s*,\\s*(.*?)\\s*,\\s*(.*?)\\s*,\\s*(.*?)\\s*(?:\\[(.*)\\])?\\s*$"_s );
3755 const QRegularExpressionMatch match = rx.match( value.toString() );
3756 if ( match.hasMatch() )
3758 bool xMinOk =
false;
3759 ( void ) match.captured( 1 ).toDouble( &xMinOk );
3760 bool xMaxOk =
false;
3761 ( void ) match.captured( 2 ).toDouble( &xMaxOk );
3762 bool yMinOk =
false;
3763 ( void ) match.captured( 3 ).toDouble( &yMinOk );
3764 bool yMaxOk =
false;
3765 ( void ) match.captured( 4 ).toDouble( &yMaxOk );
3766 if ( xMinOk && xMaxOk && yMinOk && yMaxOk )
3775 if ( !value.isValid() )
3778 if ( value.userType() == qMetaTypeId<QgsProperty>() )
3781 if ( value.userType() == qMetaTypeId<QgsRectangle>() )
3786 else if ( value.userType() == qMetaTypeId<QgsReferencedRectangle>() )
3791 else if ( value.userType() == qMetaTypeId< QgsGeometry>() )
3796 const QString wkt = g.
asWkt();
3797 return u
"QgsGeometry.fromWkt('%1')"_s.arg( wkt );
3800 else if ( variantIsValidStringForExtent( value ) )
3806 p.insert(
name(), value );
3816 if ( variantIsValidStringForExtent( value ) )
3818 return value.toString();
3826 if ( variantIsValidStringForExtent( value ) )
3851 if ( !input.isValid() )
3859 if ( input.userType() == qMetaTypeId<QgsProperty>() )
3864 if ( input.userType() == qMetaTypeId<QgsPointXY>() )
3868 if ( input.userType() == qMetaTypeId<QgsReferencedPointXY>() )
3872 if ( input.userType() == qMetaTypeId< QgsGeometry>() )
3877 if ( input.userType() == QMetaType::Type::QString )
3879 if ( input.toString().isEmpty() )
3883 const thread_local QRegularExpression rx( u
"^\\s*\\(?\\s*(.*?)\\s*,\\s*(.*?)\\s*(?:\\[(.*)\\])?\\s*\\)?\\s*$"_s );
3885 const QRegularExpressionMatch match = rx.match( input.toString() );
3886 if ( match.hasMatch() )
3889 ( void ) match.captured( 1 ).toDouble( &xOk );
3891 ( void ) match.captured( 2 ).toDouble( &yOk );
3900 if ( !value.isValid() )
3903 if ( value.userType() == qMetaTypeId<QgsProperty>() )
3906 if ( value.userType() == qMetaTypeId<QgsPointXY>() )
3911 else if ( value.userType() == qMetaTypeId<QgsReferencedPointXY>() )
3916 else if ( value.userType() == qMetaTypeId< QgsGeometry>() )
3921 const QString wkt = g.
asWkt();
3922 return u
"QgsGeometry.fromWkt('%1')"_s.arg( wkt );
3951 if ( !input.isValid() )
3959 if ( input.userType() == qMetaTypeId<QgsProperty>() )
3966 if ( input.userType() == qMetaTypeId< QgsGeometry>() )
3971 if ( input.userType() == qMetaTypeId<QgsReferencedGeometry>() )
3976 if ( input.userType() == qMetaTypeId<QgsPointXY>() )
3981 if ( input.userType() == qMetaTypeId<QgsRectangle>() )
3986 if ( input.userType() == qMetaTypeId<QgsReferencedPointXY>() )
3991 if ( input.userType() == qMetaTypeId<QgsReferencedRectangle>() )
3996 if ( input.userType() == QMetaType::Type::QString )
3998 if ( input.toString().isEmpty() )
4003 const thread_local QRegularExpression rx( u
"^\\s*(?:CRS=(.*);)?(.*?)$"_s );
4005 const QRegularExpressionMatch match = rx.match( input.toString() );
4006 if ( match.hasMatch() )
4011 return ( anyTypeAllowed || mGeomTypes.contains(
static_cast< int >( g.
type() ) ) ) && ( mAllowMultipart || !g.
isMultipart() );
4024 if ( !crs.isValid() )
4030 if ( !value.isValid() )
4033 if ( value.userType() == qMetaTypeId<QgsProperty>() )
4036 if ( value.userType() == qMetaTypeId< QgsGeometry>() )
4043 if ( value.userType() == qMetaTypeId<QgsReferencedGeometry>() )
4050 if ( value.userType() == qMetaTypeId<QgsPointXY>() )
4057 if ( value.userType() == qMetaTypeId<QgsReferencedPointXY>() )
4064 if ( value.userType() == qMetaTypeId<QgsRectangle>() )
4071 if ( value.userType() == qMetaTypeId<QgsReferencedRectangle>() )
4083 QString code = u
"##%1="_s.arg(
mName );
4085 code +=
"optional "_L1;
4086 code +=
type() +
' ';
4088 for (
const int type : mGeomTypes )
4093 code +=
"point "_L1;
4101 code +=
"polygon "_L1;
4105 code +=
"unknown "_L1;
4111 return code.trimmed();
4116 switch ( outputType )
4122 code +=
", optional=True"_L1;
4124 if ( !mGeomTypes.empty() )
4130 return u
"PointGeometry"_s;
4133 return u
"LineGeometry"_s;
4136 return u
"PolygonGeometry"_s;
4139 return u
"UnknownGeometry"_s;
4142 return u
"NullGeometry"_s;
4147 QStringList options;
4148 options.reserve( mGeomTypes.size() );
4149 for (
const int type : mGeomTypes )
4153 code += u
", geometryTypes=[%1 ]"_s.arg( options.join(
',' ) );
4156 if ( !mAllowMultipart )
4158 code +=
", allowMultipart=False"_L1;
4173 for (
const int type : mGeomTypes )
4177 map.insert( u
"geometrytypes"_s, types );
4178 map.insert( u
"multipart"_s, mAllowMultipart );
4186 const QVariantList values = map.value( u
"geometrytypes"_s ).toList();
4187 for (
const QVariant &val : values )
4189 mGeomTypes << val.toInt();
4191 mAllowMultipart = map.value( u
"multipart"_s ).toBool();
4205 if ( value.isValid() )
4207 if ( value.userType() == qMetaTypeId< QgsGeometry>() )
4213 else if ( value.userType() == qMetaTypeId<QgsReferencedGeometry>() )
4223 else if ( value.userType() == QMetaType::QString )
4235 return QObject::tr(
"Invalid geometry" );
4255 if ( !input.isValid() )
4263 if ( input.userType() == qMetaTypeId<QgsProperty>() )
4268 const QString
string = input.toString().trimmed();
4270 if ( input.userType() != QMetaType::Type::QString ||
string.isEmpty() )
4273 switch ( mBehavior )
4277 if ( !mExtension.isEmpty() )
4279 return string.endsWith( mExtension, Qt::CaseInsensitive );
4281 else if ( !mFileFilter.isEmpty() )
4299 QString code = u
"##%1="_s.arg(
mName );
4301 code +=
"optional "_L1;
4304 return code.trimmed();
4309 switch ( outputType )
4315 code +=
", optional=True"_L1;
4317 if ( !mExtension.isEmpty() )
4318 code += u
", extension='%1'"_s.arg( mExtension );
4319 if ( !mFileFilter.isEmpty() )
4320 code += u
", fileFilter='%1'"_s.arg( mFileFilter );
4331 switch ( mBehavior )
4335 if ( !mFileFilter.isEmpty() )
4336 return mFileFilter != QObject::tr(
"All files (*.*)" ) ? mFileFilter + u
";;"_s + QObject::tr(
"All files (*.*)" ) : mFileFilter;
4337 else if ( !mExtension.isEmpty() )
4338 return QObject::tr(
"%1 files" ).arg( mExtension.toUpper() ) + u
" (*."_s + mExtension.toLower() + u
");;"_s + QObject::tr(
"All files (*.*)" );
4340 return QObject::tr(
"All files (*.*)" );
4352 mFileFilter.clear();
4362 mFileFilter = filter;
4369 map.insert( u
"behavior"_s,
static_cast< int >( mBehavior ) );
4370 map.insert( u
"extension"_s, mExtension );
4371 map.insert( u
"filefilter"_s, mFileFilter );
4379 mExtension = map.value( u
"extension"_s ).toString();
4380 mFileFilter = map.value( u
"filefilter"_s ).toString();
4397 , mFixedNumberRows( fixedNumberRows )
4408 if ( !input.isValid() )
4416 if ( input.userType() == QMetaType::Type::QString )
4418 if ( input.toString().isEmpty() )
4422 else if ( input.userType() == QMetaType::Type::QVariantList )
4424 if ( input.toList().isEmpty() )
4428 else if ( input.userType() == QMetaType::Type::Double || input.userType() == QMetaType::Type::Int )
4438 if ( !value.isValid() )
4441 if ( value.userType() == qMetaTypeId<QgsProperty>() )
4445 p.insert(
name(), value );
4453 switch ( outputType )
4459 code +=
", optional=True"_L1;
4460 code += u
", numberRows=%1"_s.arg( mNumberRows );
4461 code += u
", hasFixedNumberRows=%1"_s.arg( mFixedNumberRows ? u
"True"_s : u
"False"_s );
4464 headers.reserve( mHeaders.size() );
4465 for (
const QString &h : mHeaders )
4467 code += u
", headers=[%1]"_s.arg(
headers.join(
',' ) );
4499 return mFixedNumberRows;
4504 mFixedNumberRows = fixedNumberRows;
4510 map.insert( u
"headers"_s, mHeaders );
4511 map.insert( u
"rows"_s, mNumberRows );
4512 map.insert( u
"fixed_number_rows"_s, mFixedNumberRows );
4519 mHeaders = map.value( u
"headers"_s ).toStringList();
4520 mNumberRows = map.value( u
"rows"_s ).toInt();
4521 mFixedNumberRows = map.value( u
"fixed_number_rows"_s ).toBool();
4543 if ( !input.isValid() )
4553 if ( qobject_cast< QgsMapLayer * >( qvariant_cast<QObject *>( input ) ) )
4559 if ( input.userType() == QMetaType::Type::QString )
4561 if ( input.toString().isEmpty() )
4564 if ( mMinimumNumberInputs > 1 )
4575 else if ( input.userType() == QMetaType::Type::QVariantList )
4577 if ( input.toList().count() < mMinimumNumberInputs )
4580 if ( mMinimumNumberInputs > input.toList().count() )
4588 const auto constToList = input.toList();
4589 for (
const QVariant &v : constToList )
4591 if ( qobject_cast< QgsMapLayer * >( qvariant_cast<QObject *>( v ) ) )
4600 else if ( input.userType() == QMetaType::Type::QStringList )
4602 if ( input.toStringList().count() < mMinimumNumberInputs )
4605 if ( mMinimumNumberInputs > input.toStringList().count() )
4613 const auto constToStringList = input.toStringList();
4614 for (
const QString &v : constToStringList )
4627 if ( !value.isValid() )
4630 if ( value.userType() == qMetaTypeId<QgsProperty>() )
4636 if ( value.userType() == QMetaType::Type::QStringList )
4638 const QStringList list = value.toStringList();
4639 parts.reserve( list.count() );
4640 for (
const QString &v : list )
4643 else if ( value.userType() == QMetaType::Type::QVariantList )
4645 const QVariantList list = value.toList();
4646 parts.reserve( list.count() );
4647 for (
const QVariant &v : list )
4650 if ( !parts.isEmpty() )
4651 return parts.join(
',' ).prepend(
'[' ).append(
']' );
4656 p.insert(
name(), value );
4658 if ( !list.isEmpty() )
4661 parts.reserve( list.count() );
4666 return parts.join(
',' ).prepend(
'[' ).append(
']' );
4685 QString code = u
"##%1="_s.arg(
mName );
4687 code +=
"optional "_L1;
4688 switch ( mLayerType )
4691 code +=
"multiple raster"_L1;
4695 code +=
"multiple file"_L1;
4699 code +=
"multiple vector"_L1;
4703 if (
mDefault.userType() == QMetaType::Type::QVariantList )
4706 const auto constToList =
mDefault.toList();
4707 for (
const QVariant &var : constToList )
4709 parts << var.toString();
4711 code += parts.join(
',' );
4713 else if (
mDefault.userType() == QMetaType::Type::QStringList )
4715 code +=
mDefault.toStringList().join(
',' );
4721 return code.trimmed();
4726 switch ( outputType )
4732 code +=
", optional=True"_L1;
4736 code += u
", layerType=%1"_s.arg(
layerType );
4747 switch ( mLayerType )
4750 return QObject::tr(
"All files (*.*)" );
4790 return mMinimumNumberInputs;
4802 map.insert( u
"layer_type"_s,
static_cast< int >( mLayerType ) );
4803 map.insert( u
"min_inputs"_s, mMinimumNumberInputs );
4811 mMinimumNumberInputs = map.value( u
"min_inputs"_s ).toInt();
4817 QString
type = definition;
4819 const thread_local QRegularExpression re( u
"(.*?)\\s+(.*)"_s );
4820 const QRegularExpressionMatch m = re.match( definition );
4823 type = m.captured( 1 ).toLower().trimmed();
4824 defaultVal = m.captured( 2 );
4827 if (
type ==
"vector"_L1 )
4829 else if (
type ==
"raster"_L1 )
4831 else if (
type ==
"file"_L1 )
4846 QgsMessageLog::logMessage( QObject::tr(
"Invalid number parameter \"%1\": min value %2 is >= max value %3!" ).arg(
name ).arg( mMin ).arg( mMax ), QObject::tr(
"Processing" ) );
4857 QVariant input = value;
4858 if ( !input.isValid() )
4866 if ( input.userType() == qMetaTypeId<QgsProperty>() )
4872 const double res = input.toDouble( &ok );
4876 return !( res < mMin || res > mMax );
4881 if ( !value.isValid() )
4884 if ( value.userType() == qMetaTypeId<QgsProperty>() )
4887 return value.toString();
4894 if ( mMin > std::numeric_limits<double>::lowest() + 1 )
4895 parts << QObject::tr(
"Minimum value: %1" ).arg( mMin );
4896 if ( mMax < std::numeric_limits<double>::max() )
4897 parts << QObject::tr(
"Maximum value: %1" ).arg( mMax );
4900 const QString extra = parts.join(
"<br />"_L1 );
4901 if ( !extra.isEmpty() )
4902 text += u
"<p>%1</p>"_s.arg( extra );
4908 switch ( outputType )
4914 code +=
", optional=True"_L1;
4918 if ( mMin != std::numeric_limits<double>::lowest() + 1 )
4919 code += u
", minValue=%1"_s.arg( mMin );
4920 if ( mMax != std::numeric_limits<double>::max() )
4921 code += u
", maxValue=%1"_s.arg( mMax );
4963 map.insert( u
"min"_s, mMin );
4964 map.insert( u
"max"_s, mMax );
4965 map.insert( u
"data_type"_s,
static_cast< int >( mDataType ) );
4972 mMin = map.value( u
"min"_s ).toDouble();
4973 mMax = map.value( u
"max"_s ).toDouble();
4996 if ( !input.isValid() )
5004 if ( input.userType() == qMetaTypeId<QgsProperty>() )
5009 if ( input.userType() == QMetaType::Type::QString )
5011 const QStringList list = input.toString().split(
',' );
5012 if ( list.count() != 2 )
5015 list.at( 0 ).toDouble( &ok );
5017 list.at( 1 ).toDouble( &ok2 );
5022 else if ( input.userType() == QMetaType::Type::QVariantList )
5024 if ( input.toList().count() != 2 )
5028 input.toList().at( 0 ).toDouble( &ok );
5030 input.toList().at( 1 ).toDouble( &ok2 );
5041 if ( !value.isValid() )
5044 if ( value.userType() == qMetaTypeId<QgsProperty>() )
5048 p.insert(
name(), value );
5051 QStringList stringParts;
5052 const auto constParts = parts;
5053 for (
const double v : constParts )
5055 stringParts << QString::number( v );
5057 return stringParts.join(
',' ).prepend(
'[' ).append(
']' );
5062 switch ( outputType )
5068 code +=
", optional=True"_L1;
5093 map.insert( u
"data_type"_s,
static_cast< int >( mDataType ) );
5121 if ( !input.isValid() )
5129 if ( input.userType() == qMetaTypeId<QgsProcessingRasterLayerDefinition>() )
5135 if ( input.userType() == qMetaTypeId<QgsProperty>() )
5148 if ( qobject_cast< QgsRasterLayer * >( qvariant_cast<QObject *>( input ) ) )
5151 if ( input.userType() != QMetaType::Type::QString || input.toString().isEmpty() )
5169 if ( !val.isValid() )
5172 if ( val.userType() == qMetaTypeId<QgsProperty>() )
5175 if ( val.userType() == qMetaTypeId<QgsProcessingRasterLayerDefinition>() )
5184 layerString = layer->source();
5188 return u
"QgsProcessingRasterLayerDefinition(%1, referenceScale=%2, dpi=%3)"_s
5200 return u
"QgsProcessingRasterLayerDefinition(QgsProperty.fromExpression(%1), referenceScale=%2, dpi=%3)"_s
5211 p.insert(
name(), val );
5238 mCapabilities = capabilities;
5243 return mCapabilities;
5262 QVariant input = value;
5263 if ( !input.isValid() )
5271 if ( input.userType() == qMetaTypeId<QgsProperty>() )
5276 if ( mUsesStaticStrings )
5278 if ( input.userType() == QMetaType::Type::QVariantList )
5280 if ( !mAllowMultiple )
5283 const QVariantList values = input.toList();
5287 for (
const QVariant &val : values )
5289 if ( !mOptions.contains( val.toString() ) )
5295 else if ( input.userType() == QMetaType::Type::QStringList )
5297 if ( !mAllowMultiple )
5300 const QStringList values = input.toStringList();
5305 if ( values.count() > 1 && !mAllowMultiple )
5308 for (
const QString &val : values )
5310 if ( !mOptions.contains( val ) )
5315 else if ( input.userType() == QMetaType::Type::QString )
5317 const QStringList parts = input.toString().split(
',' );
5318 if ( parts.count() > 1 && !mAllowMultiple )
5321 const auto constParts = parts;
5322 for (
const QString &part : constParts )
5324 if ( !mOptions.contains( part ) )
5332 if ( input.userType() == QMetaType::Type::QVariantList )
5334 if ( !mAllowMultiple )
5337 const QVariantList values = input.toList();
5341 for (
const QVariant &val : values )
5344 const int res = val.toInt( &ok );
5347 else if ( res < 0 || res >= mOptions.count() )
5353 else if ( input.userType() == QMetaType::Type::QString )
5355 const QStringList parts = input.toString().split(
',' );
5356 if ( parts.count() > 1 && !mAllowMultiple )
5359 const auto constParts = parts;
5360 for (
const QString &part : constParts )
5363 const int res = part.toInt( &ok );
5366 else if ( res < 0 || res >= mOptions.count() )
5371 else if ( input.userType() == QMetaType::Type::Int || input.userType() == QMetaType::Type::Double )
5374 const int res = input.toInt( &ok );
5377 else if ( res >= 0 && res < mOptions.count() )
5387 if ( !value.isValid() )
5390 if ( value.userType() == qMetaTypeId<QgsProperty>() )
5393 if ( mUsesStaticStrings )
5395 if ( value.userType() == QMetaType::Type::QVariantList || value.userType() == QMetaType::Type::QStringList )
5398 const QStringList constList = value.toStringList();
5399 for (
const QString &val : constList )
5403 return parts.join(
',' ).prepend(
'[' ).append(
']' );
5405 else if ( value.userType() == QMetaType::Type::QString )
5408 const QStringList constList = value.toString().split(
',' );
5409 if ( constList.count() > 1 )
5411 for (
const QString &val : constList )
5415 return parts.join(
',' ).prepend(
'[' ).append(
']' );
5423 if ( value.userType() == QMetaType::Type::QVariantList )
5426 const auto constToList = value.toList();
5427 for (
const QVariant &val : constToList )
5429 parts << QString::number( static_cast< int >( val.toDouble() ) );
5431 return parts.join(
',' ).prepend(
'[' ).append(
']' );
5433 else if ( value.userType() == QMetaType::Type::QString )
5435 const QStringList parts = value.toString().split(
',' );
5436 if ( parts.count() > 1 )
5438 return parts.join(
',' ).prepend(
'[' ).append(
']' );
5442 return QString::number(
static_cast< int >( value.toDouble() ) );
5448 if ( !value.isValid() )
5451 if ( value.userType() == qMetaTypeId<QgsProperty>() )
5454 if ( mUsesStaticStrings )
5460 if ( value.userType() == QMetaType::Type::QVariantList )
5463 const QVariantList toList = value.toList();
5464 parts.reserve( toList.size() );
5465 for (
const QVariant &val : toList )
5467 parts << mOptions.value(
static_cast< int >( val.toDouble() ) );
5469 return parts.join(
',' );
5471 else if ( value.userType() == QMetaType::Type::QString )
5473 const QStringList parts = value.toString().split(
',' );
5474 QStringList comments;
5475 if ( parts.count() > 1 )
5477 for (
const QString &part : parts )
5480 const int val = part.toInt( &ok );
5482 comments << mOptions.value( val );
5484 return comments.join(
',' );
5488 return mOptions.value(
static_cast< int >( value.toDouble() ) );
5494 QString code = u
"##%1="_s.arg(
mName );
5496 code +=
"optional "_L1;
5499 if ( mAllowMultiple )
5500 code +=
"multiple "_L1;
5502 if ( mUsesStaticStrings )
5503 code +=
"static "_L1;
5505 code += mOptions.join(
';' ) +
' ';
5508 return code.trimmed();
5513 switch ( outputType )
5519 code +=
", optional=True"_L1;
5522 options.reserve( mOptions.size() );
5523 for (
const QString &o : mOptions )
5525 code += u
", options=[%1]"_s.arg(
options.join(
',' ) );
5527 code += u
", allowMultiple=%1"_s.arg( mAllowMultiple ? u
"True"_s : u
"False"_s );
5529 code += u
", usesStaticStrings=%1"_s.arg( mUsesStaticStrings ? u
"True"_s : u
"False"_s );
5545 return options().value( value.toInt() );
5560 return mAllowMultiple;
5570 return mUsesStaticStrings;
5581 map.insert( u
"options"_s, mOptions );
5582 map.insert( u
"allow_multiple"_s, mAllowMultiple );
5583 map.insert( u
"uses_static_strings"_s, mUsesStaticStrings );
5590 mOptions = map.value( u
"options"_s ).toStringList();
5591 mAllowMultiple = map.value( u
"allow_multiple"_s ).toBool();
5592 mUsesStaticStrings = map.value( u
"uses_static_strings"_s ).toBool();
5599 QString def = definition;
5601 bool multiple =
false;
5602 if ( def.startsWith(
"multiple"_L1, Qt::CaseInsensitive ) )
5608 bool staticStrings =
false;
5609 if ( def.startsWith(
"static"_L1, Qt::CaseInsensitive ) )
5611 staticStrings =
true;
5615 const thread_local QRegularExpression re( u
"(.*)\\s+(.*?)$"_s );
5616 const QRegularExpressionMatch m = re.match( def );
5617 QString values = def;
5620 values = m.captured( 1 ).trimmed();
5621 defaultVal = m.captured( 2 );
5642 if ( value.userType() == qMetaTypeId<QgsProperty>() )
5645 const QString s = value.toString();
5651 QString code = u
"##%1="_s.arg(
mName );
5653 code +=
"optional "_L1;
5654 code +=
"string "_L1;
5660 return code.trimmed();
5665 switch ( outputType )
5671 code +=
", optional=True"_L1;
5672 code += u
", multiLine=%1"_s.arg( mMultiLine ? u
"True"_s : u
"False"_s );
5695 map.insert( u
"multiline"_s, mMultiLine );
5702 mMultiLine = map.value( u
"multiline"_s ).toBool();
5708 QString def = definition;
5710 if ( def.startsWith(
"long"_L1, Qt::CaseInsensitive ) )
5716 if ( def.startsWith(
'"' ) || def.startsWith(
'\'' ) )
5718 if ( def.endsWith(
'"' ) || def.endsWith(
'\'' ) )
5722 if ( def ==
"None"_L1 )
5743 if ( !value.isValid() )
5746 const QString s = value.toString();
5752 QString code = u
"##%1="_s.arg(
mName );
5754 code +=
"optional "_L1;
5755 code +=
"authcfg "_L1;
5758 return code.trimmed();
5763 QString def = definition;
5765 if ( def.startsWith(
'"' ) || def.startsWith(
'\'' ) )
5767 if ( def.endsWith(
'"' ) || def.endsWith(
'\'' ) )
5771 if ( def ==
"None"_L1 )
5787 , mExpressionType(
type )
5797 if ( !value.isValid() )
5800 if ( value.userType() == qMetaTypeId<QgsProperty>() )
5803 const QString s = value.toString();
5809 QStringList depends;
5810 if ( !mParentLayerParameterName.isEmpty() )
5811 depends << mParentLayerParameterName;
5817 switch ( outputType )
5823 code +=
", optional=True"_L1;
5825 code += u
", parentLayerParameterName='%1'"_s.arg( mParentLayerParameterName );
5831 switch ( mExpressionType )
5834 code +=
", type=Qgis.ExpressionType.PointCloud)"_L1;
5837 code +=
", type=Qgis.ExpressionType.RasterCalculator)"_L1;
5851 return mParentLayerParameterName;
5861 return mExpressionType;
5872 map.insert( u
"parent_layer"_s, mParentLayerParameterName );
5873 map.insert( u
"expression_type"_s,
static_cast< int >( mExpressionType ) );
5880 mParentLayerParameterName = map.value( u
"parent_layer"_s ).toString();
5881 mExpressionType =
static_cast< Qgis::ExpressionType >( map.value( u
"expression_type"_s ).toInt() );
5904 if ( !var.isValid() )
5912 if ( var.userType() == qMetaTypeId<QgsProperty>() )
5925 if ( qobject_cast< QgsVectorLayer * >( qvariant_cast<QObject *>( var ) ) )
5928 if ( var.userType() != QMetaType::Type::QString || var.toString().isEmpty() )
5946 if ( !val.isValid() )
5949 if ( val.userType() == qMetaTypeId<QgsProperty>() )
5953 p.insert(
name(), val );
5970 switch ( outputType )
5976 code +=
", optional=True"_L1;
5980 QStringList options;
5983 code += u
", types=[%1]"_s.arg( options.join(
',' ) );
6017 map.insert( u
"data_types"_s, types );
6025 const QVariantList values = map.value( u
"data_types"_s ).toList();
6026 for (
const QVariant &val : values )
6051 if ( !var.isValid() )
6059 if ( var.userType() == qMetaTypeId<QgsProperty>() )
6072 if ( qobject_cast< QgsMeshLayer * >( qvariant_cast<QObject *>( var ) ) )
6075 if ( var.userType() != QMetaType::Type::QString || var.toString().isEmpty() )
6093 if ( !val.isValid() )
6096 if ( val.userType() == qMetaTypeId<QgsProperty>() )
6100 p.insert(
name(), val );
6126 const QString &
name,
6151 if ( !input.isValid() )
6159 if ( input.userType() == qMetaTypeId<QgsProperty>() )
6164 if ( input.userType() == QMetaType::Type::QVariantList || input.userType() == QMetaType::Type::QStringList )
6166 if ( !mAllowMultiple )
6172 else if ( input.userType() == QMetaType::Type::QString )
6174 if ( input.toString().isEmpty() )
6177 const QStringList parts = input.toString().split(
';' );
6178 if ( parts.count() > 1 && !mAllowMultiple )
6183 if ( input.toString().isEmpty() )
6191 if ( !value.isValid() )
6194 if ( value.userType() == qMetaTypeId<QgsProperty>() )
6197 if ( value.userType() == QMetaType::Type::QVariantList )
6200 const auto constToList = value.toList();
6201 for (
const QVariant &val : constToList )
6205 return parts.join(
',' ).prepend(
'[' ).append(
']' );
6207 else if ( value.userType() == QMetaType::Type::QStringList )
6210 const auto constToStringList = value.toStringList();
6211 for (
const QString &s : constToStringList )
6215 return parts.join(
',' ).prepend(
'[' ).append(
']' );
6223 QString code = u
"##%1="_s.arg(
mName );
6225 code +=
"optional "_L1;
6226 code +=
"field "_L1;
6228 switch ( mDataType )
6231 code +=
"numeric "_L1;
6235 code +=
"string "_L1;
6239 code +=
"datetime "_L1;
6243 code +=
"binary "_L1;
6247 code +=
"boolean "_L1;
6254 if ( mAllowMultiple )
6255 code +=
"multiple "_L1;
6257 if ( mDefaultToAllFields )
6258 code +=
"default_to_all_fields "_L1;
6260 code += mParentLayerParameterName +
' ';
6263 return code.trimmed();
6268 switch ( outputType )
6274 code +=
", optional=True"_L1;
6277 switch ( mDataType )
6280 dataType = u
"QgsProcessingParameterField.Any"_s;
6284 dataType = u
"QgsProcessingParameterField.Numeric"_s;
6288 dataType = u
"QgsProcessingParameterField.String"_s;
6292 dataType = u
"QgsProcessingParameterField.DateTime"_s;
6296 dataType = u
"QgsProcessingParameterField.Binary"_s;
6300 dataType = u
"QgsProcessingParameterField.Boolean"_s;
6303 code += u
", type=%1"_s.arg(
dataType );
6305 code += u
", parentLayerParameterName='%1'"_s.arg( mParentLayerParameterName );
6306 code += u
", allowMultiple=%1"_s.arg( mAllowMultiple ? u
"True"_s : u
"False"_s );
6310 if ( mDefaultToAllFields )
6311 code +=
", defaultToAllFields=True"_L1;
6323 QStringList depends;
6324 if ( !mParentLayerParameterName.isEmpty() )
6325 depends << mParentLayerParameterName;
6331 return mParentLayerParameterName;
6351 return mAllowMultiple;
6361 return mDefaultToAllFields;
6366 mDefaultToAllFields = enabled;
6372 map.insert( u
"parent_layer"_s, mParentLayerParameterName );
6373 map.insert( u
"data_type"_s,
static_cast< int >( mDataType ) );
6374 map.insert( u
"allow_multiple"_s, mAllowMultiple );
6375 map.insert( u
"default_to_all_fields"_s, mDefaultToAllFields );
6382 mParentLayerParameterName = map.value( u
"parent_layer"_s ).toString();
6384 mAllowMultiple = map.value( u
"allow_multiple"_s ).toBool();
6385 mDefaultToAllFields = map.value( u
"default_to_all_fields"_s ).toBool();
6395 QString def = definition;
6397 if ( def.startsWith(
"numeric "_L1, Qt::CaseInsensitive ) )
6402 else if ( def.startsWith(
"string "_L1, Qt::CaseInsensitive ) )
6407 else if ( def.startsWith(
"datetime "_L1, Qt::CaseInsensitive ) )
6412 else if ( def.startsWith(
"binary "_L1, Qt::CaseInsensitive ) )
6417 else if ( def.startsWith(
"boolean "_L1, Qt::CaseInsensitive ) )
6423 if ( def.startsWith(
"multiple"_L1, Qt::CaseInsensitive ) )
6426 def = def.mid( 8 ).trimmed();
6429 if ( def.startsWith(
"default_to_all_fields"_L1, Qt::CaseInsensitive ) )
6432 def = def.mid( 21 ).trimmed();
6435 const thread_local QRegularExpression re( u
"(.*?)\\s+(.*)$"_s );
6436 const QRegularExpressionMatch m = re.match( def );
6439 parent = m.captured( 1 ).trimmed();
6440 def = m.captured( 2 );
6463 QVariant var = input;
6464 if ( !var.isValid() )
6472 if ( var.userType() == qMetaTypeId<QgsProcessingFeatureSourceDefinition>() )
6477 else if ( var.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
6484 if ( var.userType() == qMetaTypeId<QgsProperty>() )
6496 if ( qobject_cast< QgsVectorLayer * >( qvariant_cast<QObject *>( input ) ) )
6501 if ( var.userType() != QMetaType::Type::QString || var.toString().isEmpty() )
6519 if ( !value.isValid() )
6522 if ( value.userType() == qMetaTypeId<QgsProperty>() )
6525 if ( value.userType() == qMetaTypeId<QgsProcessingFeatureSourceDefinition>() )
6528 QString geometryCheckString;
6532 geometryCheckString = u
"QgsFeatureRequest.GeometryNoCheck"_s;
6536 geometryCheckString = u
"QgsFeatureRequest.GeometrySkipInvalid"_s;
6540 geometryCheckString = u
"QgsFeatureRequest.GeometryAbortOnInvalid"_s;
6547 flags << u
"QgsProcessingFeatureSourceDefinition.FlagOverrideDefaultGeometryCheck"_s;
6549 flags << u
"QgsProcessingFeatureSourceDefinition.FlagCreateIndividualOutputPerInputFeature"_s;
6550 if ( !
flags.empty() )
6551 flagString =
flags.join(
" | "_L1 );
6558 layerString = layer->source();
6562 return u
"QgsProcessingFeatureSourceDefinition(%1, selectedFeaturesOnly=%2, featureLimit=%3%4%6, geometryCheck=%5)"_s.arg(
6566 flagString.isEmpty() ? QString() : ( u
", flags=%1"_s.arg( flagString ) ),
6567 geometryCheckString,
6580 return u
"QgsProcessingFeatureSourceDefinition(QgsProperty.fromExpression(%1), selectedFeaturesOnly=%2, featureLimit=%3%4%6, geometryCheck=%5)"_s.arg(
6584 flagString.isEmpty() ? QString() : ( u
", flags=%1"_s.arg( flagString ) ),
6585 geometryCheckString,
6595 else if (
QgsVectorLayer *layer = qobject_cast< QgsVectorLayer * >( qvariant_cast<QObject *>( value ) ) )
6600 QString layerString = value.toString();
6604 layerString = layer->providerType() !=
"ogr"_L1 && layer->providerType() !=
"gdal"_L1 && layer->providerType() !=
"mdal"_L1
6623 QString code = u
"##%1="_s.arg(
mName );
6625 code +=
"optional "_L1;
6626 code +=
"source "_L1;
6633 code +=
"point "_L1;
6641 code +=
"polygon "_L1;
6650 return code.trimmed();
6655 switch ( outputType )
6661 code +=
", optional=True"_L1;
6665 QStringList options;
6669 code += u
", types=[%1]"_s.arg( options.join(
',' ) );
6697 map.insert( u
"data_types"_s, types );
6705 const QVariantList values = map.value( u
"data_types"_s ).toList();
6706 for (
const QVariant &val : values )
6716 QString def = definition;
6719 if ( def.startsWith(
"point"_L1, Qt::CaseInsensitive ) )
6725 else if ( def.startsWith(
"line"_L1, Qt::CaseInsensitive ) )
6731 else if ( def.startsWith(
"polygon"_L1, Qt::CaseInsensitive ) )
6758 QVariant var = input;
6759 if ( !var.isValid() )
6767 if ( var.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
6773 if ( var.userType() == qMetaTypeId<QgsProperty>() )
6786 if ( var.userType() != QMetaType::Type::QString )
6789 if ( var.toString().isEmpty() )
6797 if ( !value.isValid() )
6800 if ( value.userType() == qMetaTypeId<QgsProperty>() )
6803 if ( value.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
6812 return u
"QgsProperty.fromExpression('%1')"_s.arg( fromVar.
sink.
asExpression() );
6821 QString code = u
"##%1="_s.arg(
mName );
6823 code +=
"optional "_L1;
6826 switch ( mDataType )
6829 code +=
"point "_L1;
6837 code +=
"polygon "_L1;
6841 code +=
"table "_L1;
6849 return code.trimmed();
6861 return lOriginalProvider->defaultVectorFileExtension(
hasGeometry() );
6865 return p->defaultVectorFileExtension(
hasGeometry() );
6882 switch ( outputType )
6888 code +=
", optional=True"_L1;
6892 code += u
", createByDefault=%1"_s.arg(
createByDefault() ? u
"True"_s : u
"False"_s );
6893 if ( mSupportsAppend )
6894 code +=
", supportsAppend=True"_L1;
6907 QStringList filters;
6908 for (
const QString &ext : exts )
6910 filters << QObject::tr(
"%1 files (*.%2)" ).arg( ext.toUpper(), ext.toLower() );
6912 return filters.join(
";;"_L1 ) + u
";;"_s + QObject::tr(
"All files (*.*)" );
6920 return lOriginalProvider->supportedOutputVectorLayerExtensions();
6922 return lOriginalProvider->supportedOutputTableExtensions();
6927 return p->supportedOutputVectorLayerExtensions();
6929 return p->supportedOutputTableExtensions();
6944 switch ( mDataType )
6975 map.insert( u
"data_type"_s,
static_cast< int >( mDataType ) );
6976 map.insert( u
"supports_append"_s, mSupportsAppend );
6984 mSupportsAppend = map.value( u
"supports_append"_s,
false ).toBool();
6999 QString def = definition;
7000 if ( def.startsWith(
"point"_L1, Qt::CaseInsensitive ) )
7005 else if ( def.startsWith(
"line"_L1, Qt::CaseInsensitive ) )
7010 else if ( def.startsWith(
"polygon"_L1, Qt::CaseInsensitive ) )
7015 else if ( def.startsWith(
"table"_L1, Qt::CaseInsensitive ) )
7026 return mSupportsAppend;
7045 QVariant var = input;
7046 if ( !var.isValid() )
7054 if ( var.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
7060 if ( var.userType() == qMetaTypeId<QgsProperty>() )
7073 if ( var.userType() != QMetaType::Type::QString )
7076 if ( var.toString().isEmpty() )
7084 if ( !value.isValid() )
7087 if ( value.userType() == qMetaTypeId<QgsProperty>() )
7090 if ( value.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
7099 return u
"QgsProperty.fromExpression('%1')"_s.arg( fromVar.
sink.
asExpression() );
7115 return lOriginalProvider->defaultRasterFileFormat();
7119 return p->defaultRasterFileFormat();
7131 if ( !extensions.isEmpty() )
7132 return extensions[0];
7139 QStringList filters;
7144 for (
const QPair<QString, QString> &formatAndExt : std::as_const( formatAndExtensions ) )
7146 QString format = formatAndExt.first;
7147 const QString &extension = formatAndExt.second;
7148 if ( format.isEmpty() )
7150 filters << QObject::tr(
"%1 files (*.%2)" ).arg( format.toUpper(), extension.toLower() );
7153 return filters.join(
";;"_L1 ) + u
";;"_s + QObject::tr(
"All files (*.*)" );
7159 QSet< QString > extensions;
7160 for (
const QPair<QString, QString> &formatAndExt : std::as_const( formatAndExtensions ) )
7162 extensions.insert( formatAndExt.second );
7164 return QStringList( extensions.constBegin(), extensions.constEnd() );
7171 return lOriginalProvider->supportedOutputRasterLayerFormatAndExtensions();
7175 return p->supportedOutputRasterLayerFormatAndExtensions();
7203 QVariant var = input;
7204 if ( !var.isValid() )
7212 if ( var.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
7218 if ( var.userType() == qMetaTypeId<QgsProperty>() )
7231 if ( var.userType() != QMetaType::Type::QString )
7234 if ( var.toString().isEmpty() )
7244 if ( !value.isValid() )
7247 if ( value.userType() == qMetaTypeId<QgsProperty>() )
7250 if ( value.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
7259 return u
"QgsProperty.fromExpression('%1')"_s.arg( fromVar.
sink.
asExpression() );
7268 if ( !mFileFilter.isEmpty() && mFileFilter.contains( u
"htm"_s, Qt::CaseInsensitive ) )
7280 if ( mFileFilter.isEmpty() || mFileFilter == QObject::tr(
"All files (*.*)" ) )
7284 const thread_local QRegularExpression rx( u
".*?\\(\\*\\.([a-zA-Z0-9._]+).*"_s );
7285 const QRegularExpressionMatch match = rx.match( mFileFilter );
7286 if ( !match.hasMatch() )
7289 return match.captured( 1 );
7294 switch ( outputType )
7300 code +=
", optional=True"_L1;
7304 code += u
", createByDefault=%1"_s.arg(
createByDefault() ? u
"True"_s : u
"False"_s );
7316 return (
fileFilter().isEmpty() ? QString() :
fileFilter() + u
";;"_s ) + QObject::tr(
"All files (*.*)" );
7332 map.insert( u
"file_filter"_s, mFileFilter );
7339 mFileFilter = map.value( u
"file_filter"_s ).toString();
7359 QVariant var = input;
7360 if ( !var.isValid() )
7368 if ( var.userType() == qMetaTypeId<QgsProperty>() )
7381 if ( var.userType() != QMetaType::Type::QString )
7384 if ( var.toString().isEmpty() )
7413 map.insert( u
"supports_non_file_outputs"_s, mSupportsNonFileBasedOutputs );
7414 map.insert( u
"create_by_default"_s, mCreateByDefault );
7421 mSupportsNonFileBasedOutputs = map.value( u
"supports_non_file_outputs"_s ).toBool();
7422 mCreateByDefault = map.value( u
"create_by_default"_s, u
"1"_s ).toBool();
7428 switch ( outputType )
7437 code +=
", optional=True"_L1;
7439 code += u
", createByDefault=%1"_s.arg( mCreateByDefault ? u
"True"_s : u
"False"_s );
7461 const thread_local QRegularExpression rx( u
"[.]"_s );
7462 QString sanitizedName =
name();
7463 sanitizedName.replace( rx, u
"_"_s );
7478 return lOriginalProvider->isSupportedOutputValue( value,
this, context, error );
7487 return mCreateByDefault;
7509 QVariant var = input;
7510 if ( !var.isValid() )
7518 if ( var.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
7524 if ( var.userType() == qMetaTypeId<QgsProperty>() )
7537 if ( var.userType() != QMetaType::Type::QString )
7540 if ( var.toString().isEmpty() )
7548 if ( !value.isValid() )
7551 if ( value.userType() == qMetaTypeId<QgsProperty>() )
7554 if ( value.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
7563 return u
"QgsProperty.fromExpression('%1')"_s.arg( fromVar.
sink.
asExpression() );
7572 QString code = u
"##%1="_s.arg(
mName );
7574 code +=
"optional "_L1;
7575 code +=
"vectorDestination "_L1;
7577 switch ( mDataType )
7580 code +=
"point "_L1;
7588 code +=
"polygon "_L1;
7596 return code.trimmed();
7608 return lOriginalProvider->defaultVectorFileExtension(
hasGeometry() );
7612 return p->defaultVectorFileExtension(
hasGeometry() );
7629 switch ( outputType )
7635 code +=
", optional=True"_L1;
7639 code += u
", createByDefault=%1"_s.arg(
createByDefault() ? u
"True"_s : u
"False"_s );
7652 QStringList filters;
7653 for (
const QString &ext : exts )
7655 filters << QObject::tr(
"%1 files (*.%2)" ).arg( ext.toUpper(), ext.toLower() );
7657 return filters.join(
";;"_L1 ) + u
";;"_s + QObject::tr(
"All files (*.*)" );
7665 return lOriginalProvider->supportedOutputVectorLayerExtensions();
7667 return lOriginalProvider->supportedOutputTableExtensions();
7672 return p->supportedOutputVectorLayerExtensions();
7674 return p->supportedOutputTableExtensions();
7689 switch ( mDataType )
7720 map.insert( u
"data_type"_s,
static_cast< int >( mDataType ) );
7734 QString def = definition;
7735 if ( def.startsWith(
"point"_L1, Qt::CaseInsensitive ) )
7740 else if ( def.startsWith(
"line"_L1, Qt::CaseInsensitive ) )
7745 else if ( def.startsWith(
"polygon"_L1, Qt::CaseInsensitive ) )
7769 QVariant input = value;
7770 if ( !input.isValid() )
7778 if ( input.userType() == qMetaTypeId<QgsProperty>() )
7783 if ( input.userType() == QMetaType::Type::QVariantList || input.userType() == QMetaType::Type::QStringList )
7785 if ( !mAllowMultiple )
7794 const double res = input.toInt( &ok );
7804 return mAllowMultiple;
7814 if ( !value.isValid() )
7817 if ( value.userType() == qMetaTypeId<QgsProperty>() )
7820 if ( value.userType() == QMetaType::Type::QVariantList )
7823 const QVariantList values = value.toList();
7824 for (
auto it = values.constBegin(); it != values.constEnd(); ++it )
7826 parts << QString::number( static_cast< int >( it->toDouble() ) );
7828 return parts.join(
',' ).prepend(
'[' ).append(
']' );
7830 else if ( value.userType() == QMetaType::Type::QStringList )
7833 const QStringList values = value.toStringList();
7834 for (
auto it = values.constBegin(); it != values.constEnd(); ++it )
7836 parts << QString::number( static_cast< int >( it->toDouble() ) );
7838 return parts.join(
',' ).prepend(
'[' ).append(
']' );
7841 return value.toString();
7846 QString code = u
"##%1="_s.arg(
mName );
7848 code +=
"optional "_L1;
7851 if ( mAllowMultiple )
7852 code +=
"multiple "_L1;
7854 code += mParentLayerParameterName +
' ';
7857 return code.trimmed();
7862 QStringList depends;
7863 if ( !mParentLayerParameterName.isEmpty() )
7864 depends << mParentLayerParameterName;
7870 switch ( outputType )
7876 code +=
", optional=True"_L1;
7878 code += u
", parentLayerParameterName='%1'"_s.arg( mParentLayerParameterName );
7879 code += u
", allowMultiple=%1"_s.arg( mAllowMultiple ? u
"True"_s : u
"False"_s );
7891 return mParentLayerParameterName;
7902 map.insert( u
"parent_layer"_s, mParentLayerParameterName );
7903 map.insert( u
"allow_multiple"_s, mAllowMultiple );
7910 mParentLayerParameterName = map.value( u
"parent_layer"_s ).toString();
7911 mAllowMultiple = map.value( u
"allow_multiple"_s ).toBool();
7918 QString def = definition;
7921 if ( def.startsWith(
"multiple"_L1, Qt::CaseInsensitive ) )
7924 def = def.mid( 8 ).trimmed();
7927 const thread_local QRegularExpression re( u
"(.*?)\\s+(.*)$"_s );
7928 const QRegularExpressionMatch m = re.match( def );
7931 parent = m.captured( 1 ).trimmed();
7932 def = m.captured( 2 );
7966 QStringList depends;
7967 if ( !mParentParameterName.isEmpty() )
7968 depends << mParentParameterName;
7974 switch ( outputType )
7980 code +=
", optional=True"_L1;
7982 code += u
", parentParameterName='%1'"_s.arg( mParentParameterName );
7984 if (
minimum() != std::numeric_limits<double>::lowest() + 1 )
7985 code += u
", minValue=%1"_s.arg(
minimum() );
7986 if (
maximum() != std::numeric_limits<double>::max() )
7987 code += u
", maxValue=%1"_s.arg(
maximum() );
7998 return mParentParameterName;
8009 map.insert( u
"parent"_s, mParentParameterName );
8010 map.insert( u
"default_unit"_s,
static_cast< int >( mDefaultUnit ) );
8017 mParentParameterName = map.value( u
"parent"_s ).toString();
8055 QStringList depends;
8056 if ( !mParentParameterName.isEmpty() )
8057 depends << mParentParameterName;
8063 switch ( outputType )
8069 code +=
", optional=True"_L1;
8071 code += u
", parentParameterName='%1'"_s.arg( mParentParameterName );
8074 code += u
", minValue=%1"_s.arg(
minimum() );
8075 if (
maximum() != std::numeric_limits<double>::max() )
8076 code += u
", maxValue=%1"_s.arg(
maximum() );
8087 return mParentParameterName;
8098 map.insert( u
"parent"_s, mParentParameterName );
8106 mParentParameterName = map.value( u
"parent"_s ).toString();
8144 QStringList depends;
8145 if ( !mParentParameterName.isEmpty() )
8146 depends << mParentParameterName;
8152 switch ( outputType )
8158 code +=
", optional=True"_L1;
8160 code += u
", parentParameterName='%1'"_s.arg( mParentParameterName );
8163 code += u
", minValue=%1"_s.arg(
minimum() );
8164 if (
maximum() != std::numeric_limits<double>::max() )
8165 code += u
", maxValue=%1"_s.arg(
maximum() );
8176 return mParentParameterName;
8187 map.insert( u
"parent"_s, mParentParameterName );
8195 mParentParameterName = map.value( u
"parent"_s ).toString();
8228 switch ( outputType )
8234 code +=
", optional=True"_L1;
8236 if (
minimum() != std::numeric_limits<double>::lowest() + 1 )
8237 code += u
", minValue=%1"_s.arg(
minimum() );
8238 if (
maximum() != std::numeric_limits<double>::max() )
8239 code += u
", maxValue=%1"_s.arg(
maximum() );
8251 map.insert( u
"default_unit"_s,
static_cast< int >( mDefaultUnit ) );
8291 switch ( outputType )
8297 code +=
", optional=True"_L1;
8330 if ( value.userType() == qMetaTypeId<QgsProperty>() )
8333 const QString s = value.toString();
8339 QString code = u
"##%1="_s.arg(
mName );
8341 code +=
"optional "_L1;
8342 code +=
"layout "_L1;
8345 return code.trimmed();
8350 switch ( outputType )
8356 code +=
", optional=True"_L1;
8367 QString def = definition;
8369 if ( def.startsWith(
'"' ) || def.startsWith(
'\'' ) )
8371 if ( def.endsWith(
'"' ) || def.endsWith(
'\'' ) )
8375 if ( def ==
"None"_L1 )
8404 if ( value.userType() == qMetaTypeId<QgsProperty>() )
8407 const QString s = value.toString();
8413 QString code = u
"##%1="_s.arg(
mName );
8415 code +=
"optional "_L1;
8416 code +=
"layoutitem "_L1;
8417 if ( mItemType >= 0 )
8418 code += QString::number( mItemType ) +
' ';
8420 code += mParentLayoutParameterName +
' ';
8423 return code.trimmed();
8428 switch ( outputType )
8434 code +=
", optional=True"_L1;
8436 if ( mItemType >= 0 )
8437 code += u
", itemType=%1"_s.arg( mItemType );
8439 code += u
", parentLayoutParameterName='%1'"_s.arg( mParentLayoutParameterName );
8452 map.insert( u
"parent_layout"_s, mParentLayoutParameterName );
8453 map.insert( u
"item_type"_s, mItemType );
8460 mParentLayoutParameterName = map.value( u
"parent_layout"_s ).toString();
8461 mItemType = map.value( u
"item_type"_s ).toInt();
8467 QStringList depends;
8468 if ( !mParentLayoutParameterName.isEmpty() )
8469 depends << mParentLayoutParameterName;
8476 QString def = definition;
8478 const thread_local QRegularExpression re( u
"(\\d+)?\\s*(.*?)\\s+(.*)$"_s );
8479 const QRegularExpressionMatch m = re.match( def );
8482 itemType = m.captured( 1 ).trimmed().isEmpty() ? -1 : m.captured( 1 ).trimmed().toInt();
8483 parent = m.captured( 2 ).trimmed().isEmpty() ? m.captured( 3 ).trimmed() : m.captured( 2 ).trimmed();
8484 def = !m.captured( 2 ).trimmed().isEmpty() ? m.captured( 3 ) : QString();
8497 return mParentLayoutParameterName;
8502 mParentLayoutParameterName =
name;
8534 if ( value.userType() == qMetaTypeId<QgsProperty>() )
8537 if ( value.canConvert< QColor >() && !value.value< QColor >().isValid() )
8538 return u
"QColor()"_s;
8540 if ( value.canConvert< QColor >() )
8542 const QColor
c = value.value< QColor >();
8543 if ( !mAllowOpacity ||
c.alpha() == 255 )
8544 return u
"QColor(%1, %2, %3)"_s.arg(
c.red() ).arg(
c.green() ).arg(
c.blue() );
8546 return u
"QColor(%1, %2, %3, %4)"_s.arg(
c.red() ).arg(
c.green() ).arg(
c.blue() ).arg(
c.alpha() );
8549 const QString s = value.toString();
8555 QString code = u
"##%1="_s.arg(
mName );
8557 code +=
"optional "_L1;
8558 code +=
"color "_L1;
8560 if ( mAllowOpacity )
8561 code +=
"withopacity "_L1;
8564 return code.trimmed();
8569 switch ( outputType )
8575 code +=
", optional=True"_L1;
8577 code += u
", opacityEnabled=%1"_s.arg( mAllowOpacity ? u
"True"_s : u
"False"_s );
8589 if ( !input.isValid() && (
mDefault.isValid() && ( !
mDefault.toString().isEmpty() ||
mDefault.value< QColor >().isValid() ) ) )
8592 if ( !input.isValid() )
8595 if ( input.userType() == QMetaType::Type::QColor )
8599 else if ( input.userType() == qMetaTypeId<QgsProperty>() )
8604 if ( input.userType() != QMetaType::Type::QString || input.toString().isEmpty() )
8607 bool containsAlpha =
false;
8614 map.insert( u
"opacityEnabled"_s, mAllowOpacity );
8621 mAllowOpacity = map.value( u
"opacityEnabled"_s ).toBool();
8627 return mAllowOpacity;
8632 mAllowOpacity = enabled;
8637 QString def = definition;
8639 bool allowOpacity =
false;
8640 if ( def.startsWith(
"withopacity"_L1, Qt::CaseInsensitive ) )
8642 allowOpacity =
true;
8643 def = def.mid( 12 );
8646 if ( def.startsWith(
'"' ) || def.startsWith(
'\'' ) )
8648 if ( def.endsWith(
'"' ) || def.endsWith(
'\'' ) )
8652 if ( def ==
"None"_L1 || def.isEmpty() )
8662 const QString &
name,
8667 const QVariant &staticSourceCrs,
8668 const QVariant &staticDestinationCrs,
8674 , mSourceCrs( staticSourceCrs )
8675 , mDestCrs( staticDestinationCrs )
8685 return valueAsPythonStringPrivate( value, context,
false );
8688QString QgsProcessingParameterCoordinateOperation::valueAsPythonStringPrivate(
const QVariant &value,
QgsProcessingContext &context,
bool allowNonStringValues )
const
8693 if ( allowNonStringValues && value.userType() == qMetaTypeId<QgsCoordinateReferenceSystem>() )
8696 return u
"QgsCoordinateReferenceSystem()"_s;
8701 if ( value.userType() == qMetaTypeId<QgsProperty>() )
8702 return u
"QgsProperty.fromExpression('%1')"_s.arg( value.value< QgsProperty >().asExpression() );
8704 if ( allowNonStringValues )
8707 p.insert(
name(), value );
8713 const QString s = value.toString();
8719 QString code = u
"##%1="_s.arg(
mName );
8721 code +=
"optional "_L1;
8722 code +=
"coordinateoperation "_L1;
8725 return code.trimmed();
8730 switch ( outputType )
8737 code +=
", optional=True"_L1;
8738 if ( !mSourceParameterName.isEmpty() )
8739 code += u
", sourceCrsParameterName=%1"_s.arg( valueAsPythonStringPrivate( mSourceParameterName,
c,
false ) );
8740 if ( !mDestParameterName.isEmpty() )
8741 code += u
", destinationCrsParameterName=%1"_s.arg( valueAsPythonStringPrivate( mDestParameterName,
c,
false ) );
8743 if ( mSourceCrs.isValid() )
8744 code += u
", staticSourceCrs=%1"_s.arg( valueAsPythonStringPrivate( mSourceCrs,
c,
true ) );
8745 if ( mDestCrs.isValid() )
8746 code += u
", staticDestinationCrs=%1"_s.arg( valueAsPythonStringPrivate( mDestCrs,
c,
true ) );
8748 code += u
", defaultValue=%1)"_s.arg( valueAsPythonStringPrivate(
mDefault,
c,
false ) );
8758 if ( !mSourceParameterName.isEmpty() )
8759 res << mSourceParameterName;
8760 if ( !mDestParameterName.isEmpty() )
8761 res << mDestParameterName;
8768 map.insert( u
"source_crs_parameter_name"_s, mSourceParameterName );
8769 map.insert( u
"dest_crs_parameter_name"_s, mDestParameterName );
8770 map.insert( u
"static_source_crs"_s, mSourceCrs );
8771 map.insert( u
"static_dest_crs"_s, mDestCrs );
8778 mSourceParameterName = map.value( u
"source_crs_parameter_name"_s ).toString();
8779 mDestParameterName = map.value( u
"dest_crs_parameter_name"_s ).toString();
8780 mSourceCrs = map.value( u
"static_source_crs"_s );
8781 mDestCrs = map.value( u
"static_dest_crs"_s );
8787 QString def = definition;
8789 if ( def.startsWith(
'"' ) )
8792 if ( def.endsWith(
'"' ) )
8795 else if ( def.startsWith(
'\'' ) )
8798 if ( def.endsWith(
'\'' ) )
8803 if ( def ==
"None"_L1 )
8826 if ( !input.isValid() && !
mDefault.isValid() )
8829 if ( ( input.userType() == QMetaType::Type::QString && input.toString().isEmpty() ) || ( !input.isValid() &&
mDefault.userType() == QMetaType::Type::QString &&
mDefault.toString().isEmpty() ) )
8837 if ( !value.isValid() )
8840 if ( value.userType() == qMetaTypeId<QgsProperty>() )
8848 QString code = u
"##%1="_s.arg(
mName );
8850 code +=
"optional "_L1;
8851 code +=
"maptheme "_L1;
8854 return code.trimmed();
8859 switch ( outputType )
8865 code +=
", optional=True"_L1;
8890 QString def = definition;
8891 if ( def.startsWith(
'"' ) || def.startsWith(
'\'' ) )
8893 if ( def.endsWith(
'"' ) || def.endsWith(
'\'' ) )
8917 if ( mMin.isValid() && mMax.isValid() && mMin >= mMax )
8919 QgsMessageLog::logMessage( QObject::tr(
"Invalid datetime parameter \"%1\": min value %2 is >= max value %3!" ).arg( name, mMin.toString(), mMax.toString() ), QObject::tr(
"Processing" ) );
8930 QVariant input = value;
8931 if ( !input.isValid() )
8939 if ( input.userType() == qMetaTypeId<QgsProperty>() )
8944 if ( input.userType() != QMetaType::Type::QDateTime && input.userType() != QMetaType::Type::QDate && input.userType() != QMetaType::Type::QTime && input.userType() != QMetaType::Type::QString )
8950 if ( input.userType() == QMetaType::Type::QString )
8952 const QString s = input.toString();
8956 input = QDateTime::fromString( s, Qt::ISODate );
8959 if ( !input.toDateTime().isValid() )
8960 input = QTime::fromString( s );
8962 input = input.toDateTime().time();
8968 const QDateTime res = input.toDateTime();
8969 return res.isValid() && ( res >= mMin || !mMin.isValid() ) && ( res <= mMax || !mMax.isValid() );
8973 const QTime res = input.toTime();
8974 return res.isValid() && ( res >= mMin.time() || !mMin.isValid() ) && ( res <= mMax.time() || !mMax.isValid() );
8980 if ( !value.isValid() )
8983 if ( value.userType() == qMetaTypeId<QgsProperty>() )
8986 if ( value.userType() == QMetaType::Type::QDateTime )
8988 const QDateTime dt = value.toDateTime();
8989 if ( !dt.isValid() )
8990 return u
"QDateTime()"_s;
8992 return u
"QDateTime(QDate(%1, %2, %3), QTime(%4, %5, %6))"_s.arg( dt.date().year() )
8993 .arg( dt.date().month() )
8994 .arg( dt.date().day() )
8995 .arg( dt.time().hour() )
8996 .arg( dt.time().minute() )
8997 .arg( dt.time().second() );
8999 else if ( value.userType() == QMetaType::Type::QDate )
9001 const QDate dt = value.toDate();
9002 if ( !dt.isValid() )
9003 return u
"QDate()"_s;
9005 return u
"QDate(%1, %2, %3)"_s.arg( dt.year() ).arg( dt.month() ).arg( dt.day() );
9007 else if ( value.userType() == QMetaType::Type::QTime )
9009 const QTime dt = value.toTime();
9010 if ( !dt.isValid() )
9011 return u
"QTime()"_s;
9013 return u
"QTime(%4, %5, %6)"_s.arg( dt.hour() ).arg( dt.minute() ).arg( dt.second() );
9015 return value.toString();
9022 if ( mMin.isValid() )
9023 parts << QObject::tr(
"Minimum value: %1" ).arg( mMin.toString( Qt::ISODate ) );
9024 if ( mMax.isValid() )
9025 parts << QObject::tr(
"Maximum value: %1" ).arg( mMax.toString( Qt::ISODate ) );
9027 parts << QObject::tr(
"Default value: %1" )
9030 ?
mDefault.toDateTime().toString( Qt::ISODate )
9033 const QString extra = parts.join(
"<br />"_L1 );
9034 if ( !extra.isEmpty() )
9035 text += u
"<p>%1</p>"_s.arg( extra );
9041 switch ( outputType )
9047 code +=
", optional=True"_L1;
9049 code += u
", type=%1"_s.arg(
9052 : u
"QgsProcessingParameterDateTime.Time"_s
9056 if ( mMin.isValid() )
9058 if ( mMax.isValid() )
9100 map.insert( u
"min"_s, mMin );
9101 map.insert( u
"max"_s, mMax );
9102 map.insert( u
"data_type"_s,
static_cast< int >( mDataType ) );
9109 mMin = map.value( u
"min"_s ).toDateTime();
9110 mMax = map.value( u
"max"_s ).toDateTime();
9126 if ( value.userType() == QMetaType::Type::QDateTime )
9128 const QDateTime dt = value.toDateTime();
9129 if ( !dt.isValid() )
9130 return QObject::tr(
"Invalid datetime" );
9132 return dt.toString( Qt::ISODate );
9135 else if ( value.userType() == QMetaType::Type::QDate )
9137 const QDate dt = value.toDate();
9138 if ( !dt.isValid() )
9139 return QObject::tr(
"Invalid date" );
9141 return dt.toString( Qt::ISODate );
9144 else if ( value.userType() == QMetaType::Type::QTime )
9146 const QTime dt = value.toTime();
9147 if ( !dt.isValid() )
9148 return QObject::tr(
"Invalid time" );
9150 return dt.toString( Qt::ISODate );
9153 return value.toString();
9173 if ( !input.isValid() && !
mDefault.isValid() )
9176 if ( ( input.userType() == QMetaType::Type::QString && input.toString().isEmpty() ) || ( !input.isValid() &&
mDefault.userType() == QMetaType::Type::QString &&
mDefault.toString().isEmpty() ) )
9184 if ( !value.isValid() )
9187 if ( value.userType() == qMetaTypeId<QgsProperty>() )
9195 QString code = u
"##%1="_s.arg(
mName );
9197 code +=
"optional "_L1;
9198 code +=
"providerconnection "_L1;
9199 code += mProviderId +
' ';
9202 return code.trimmed();
9207 switch ( outputType )
9213 code +=
", optional=True"_L1;
9227 map.insert( u
"provider"_s, mProviderId );
9234 mProviderId = map.value( u
"provider"_s ).toString();
9240 QString def = definition;
9242 if ( def.contains(
' ' ) )
9244 provider = def.left( def.indexOf(
' ' ) );
9245 def = def.mid( def.indexOf(
' ' ) + 1 );
9253 if ( def.startsWith(
'"' ) || def.startsWith(
'\'' ) )
9255 if ( def.endsWith(
'"' ) || def.endsWith(
'\'' ) )
9272 const QString &
name,
const QString &
description,
const QString &parentLayerParameterName,
const QVariant &
defaultValue,
bool optional
9275 , mParentConnectionParameterName( parentLayerParameterName )
9286 if ( !input.isValid() && !
mDefault.isValid() )
9289 if ( ( input.userType() == QMetaType::Type::QString && input.toString().isEmpty() ) || ( !input.isValid() &&
mDefault.userType() == QMetaType::Type::QString &&
mDefault.toString().isEmpty() ) )
9297 if ( !value.isValid() )
9300 if ( value.userType() == qMetaTypeId<QgsProperty>() )
9308 QString code = u
"##%1="_s.arg(
mName );
9310 code +=
"optional "_L1;
9311 code +=
"databaseschema "_L1;
9313 code += mParentConnectionParameterName +
' ';
9316 return code.trimmed();
9321 switch ( outputType )
9327 code +=
", optional=True"_L1;
9329 code += u
", connectionParameterName='%1'"_s.arg( mParentConnectionParameterName );
9343 QStringList depends;
9344 if ( !mParentConnectionParameterName.isEmpty() )
9345 depends << mParentConnectionParameterName;
9351 return mParentConnectionParameterName;
9356 mParentConnectionParameterName =
name;
9362 map.insert( u
"mParentConnectionParameterName"_s, mParentConnectionParameterName );
9369 mParentConnectionParameterName = map.value( u
"mParentConnectionParameterName"_s ).toString();
9376 QString def = definition;
9378 const thread_local QRegularExpression re( u
"(.*?)\\s+(.*)$"_s );
9379 const QRegularExpressionMatch m = re.match( def );
9382 parent = m.captured( 1 ).trimmed();
9383 def = m.captured( 2 );
9402 , mParentConnectionParameterName( connectionParameterName )
9403 , mParentSchemaParameterName( schemaParameterName )
9415 if ( !input.isValid() && !
mDefault.isValid() )
9418 if ( ( input.userType() == QMetaType::Type::QString && input.toString().isEmpty() ) || ( !input.isValid() &&
mDefault.userType() == QMetaType::Type::QString &&
mDefault.toString().isEmpty() ) )
9426 if ( !value.isValid() )
9429 if ( value.userType() == qMetaTypeId<QgsProperty>() )
9437 QString code = u
"##%1="_s.arg(
mName );
9439 code +=
"optional "_L1;
9440 code +=
"databasetable "_L1;
9442 code += ( mParentConnectionParameterName.isEmpty() ? u
"none"_s : mParentConnectionParameterName ) +
' ';
9443 code += ( mParentSchemaParameterName.isEmpty() ? u
"none"_s : mParentSchemaParameterName ) +
' ';
9446 return code.trimmed();
9451 switch ( outputType )
9457 code +=
", optional=True"_L1;
9459 if ( mAllowNewTableNames )
9460 code +=
", allowNewTableNames=True"_L1;
9462 code += u
", connectionParameterName='%1'"_s.arg( mParentConnectionParameterName );
9463 code += u
", schemaParameterName='%1'"_s.arg( mParentSchemaParameterName );
9477 QStringList depends;
9478 if ( !mParentConnectionParameterName.isEmpty() )
9479 depends << mParentConnectionParameterName;
9480 if ( !mParentSchemaParameterName.isEmpty() )
9481 depends << mParentSchemaParameterName;
9487 return mParentConnectionParameterName;
9492 mParentConnectionParameterName =
name;
9497 return mParentSchemaParameterName;
9502 mParentSchemaParameterName =
name;
9508 map.insert( u
"mParentConnectionParameterName"_s, mParentConnectionParameterName );
9509 map.insert( u
"mParentSchemaParameterName"_s, mParentSchemaParameterName );
9510 map.insert( u
"mAllowNewTableNames"_s, mAllowNewTableNames );
9517 mParentConnectionParameterName = map.value( u
"mParentConnectionParameterName"_s ).toString();
9518 mParentSchemaParameterName = map.value( u
"mParentSchemaParameterName"_s ).toString();
9519 mAllowNewTableNames = map.value( u
"mAllowNewTableNames"_s,
false ).toBool();
9527 QString def = definition;
9529 const thread_local QRegularExpression re( u
"(.*?)\\s+(.*+)\\b\\s*(.*)$"_s );
9530 const QRegularExpressionMatch m = re.match( def );
9533 connection = m.captured( 1 ).trimmed();
9534 if ( connection ==
"none"_L1 )
9536 schema = m.captured( 2 ).trimmed();
9537 if ( schema ==
"none"_L1 )
9539 def = m.captured( 3 );
9547 return mAllowNewTableNames;
9572 if ( !var.isValid() )
9580 if ( var.userType() == qMetaTypeId<QgsProperty>() )
9593 if ( qobject_cast< QgsPointCloudLayer * >( qvariant_cast<QObject *>( var ) ) )
9596 if ( var.userType() != QMetaType::Type::QString || var.toString().isEmpty() )
9614 if ( !val.isValid() )
9617 if ( val.userType() == qMetaTypeId<QgsProperty>() )
9621 p.insert(
name(), val );
9662 if ( !var.isValid() )
9670 if ( var.userType() == qMetaTypeId<QgsProperty>() )
9683 if ( qobject_cast< QgsAnnotationLayer * >( qvariant_cast<QObject *>( var ) ) )
9686 if ( var.userType() != QMetaType::Type::QString || var.toString().isEmpty() )
9704 if ( !val.isValid() )
9707 if ( val.userType() == qMetaTypeId<QgsProperty>() )
9711 p.insert(
name(), val );
9743 QVariant var = input;
9744 if ( !var.isValid() )
9752 if ( var.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
9758 if ( var.userType() == qMetaTypeId<QgsProperty>() )
9771 if ( var.userType() != QMetaType::Type::QString )
9774 if ( var.toString().isEmpty() )
9782 if ( !value.isValid() )
9785 if ( value.userType() == qMetaTypeId<QgsProperty>() )
9788 if ( value.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
9797 return u
"QgsProperty.fromExpression('%1')"_s.arg( fromVar.
sink.
asExpression() );
9813 return lOriginalProvider->defaultPointCloudFileExtension();
9817 return p->defaultPointCloudFileExtension();
9828 QStringList filters;
9829 for (
const QString &ext : exts )
9831 filters << QObject::tr(
"%1 files (*.%2)" ).arg( ext.toUpper(), ext.toLower() );
9833 return filters.join(
";;"_L1 ) + u
";;"_s + QObject::tr(
"All files (*.*)" );
9840 return lOriginalProvider->supportedOutputPointCloudLayerExtensions();
9844 return p->supportedOutputPointCloudLayerExtensions();
9849 return QStringList() << ext;
9887 if ( input.userType() == qMetaTypeId<QgsProperty>() )
9892 if ( input.userType() == QMetaType::Type::QVariantList || input.userType() == QMetaType::Type::QStringList )
9894 if ( !mAllowMultiple )
9900 else if ( input.userType() == QMetaType::Type::QString )
9902 if ( input.toString().isEmpty() )
9905 const QStringList parts = input.toString().split(
';' );
9906 if ( parts.count() > 1 && !mAllowMultiple )
9911 if ( input.toString().isEmpty() )
9919 if ( !value.isValid() )
9922 if ( value.userType() == qMetaTypeId<QgsProperty>() )
9925 if ( value.userType() == QMetaType::Type::QVariantList )
9928 const auto constToList = value.toList();
9929 for (
const QVariant &val : constToList )
9933 return parts.join(
',' ).prepend(
'[' ).append(
']' );
9935 else if ( value.userType() == QMetaType::Type::QStringList )
9938 const auto constToStringList = value.toStringList();
9939 for (
const QString &s : constToStringList )
9943 return parts.join(
',' ).prepend(
'[' ).append(
']' );
9951 QString code = u
"##%1="_s.arg(
mName );
9953 code +=
"optional "_L1;
9954 code +=
"attribute "_L1;
9956 if ( mAllowMultiple )
9957 code +=
"multiple "_L1;
9959 if ( mDefaultToAllAttributes )
9960 code +=
"default_to_all_attributes "_L1;
9962 code += mParentLayerParameterName +
' ';
9965 return code.trimmed();
9970 switch ( outputType )
9976 code +=
", optional=True"_L1;
9978 code += u
", parentLayerParameterName='%1'"_s.arg( mParentLayerParameterName );
9979 code += u
", allowMultiple=%1"_s.arg( mAllowMultiple ? u
"True"_s : u
"False"_s );
9983 if ( mDefaultToAllAttributes )
9984 code +=
", defaultToAllAttributes=True"_L1;
9996 QStringList depends;
9997 if ( !mParentLayerParameterName.isEmpty() )
9998 depends << mParentLayerParameterName;
10004 return mParentLayerParameterName;
10014 return mAllowMultiple;
10024 return mDefaultToAllAttributes;
10029 mDefaultToAllAttributes = enabled;
10035 map.insert( u
"parent_layer"_s, mParentLayerParameterName );
10036 map.insert( u
"allow_multiple"_s, mAllowMultiple );
10037 map.insert( u
"default_to_all_attributes"_s, mDefaultToAllAttributes );
10044 mParentLayerParameterName = map.value( u
"parent_layer"_s ).toString();
10045 mAllowMultiple = map.value( u
"allow_multiple"_s ).toBool();
10046 mDefaultToAllAttributes = map.value( u
"default_to_all_attributes"_s ).toBool();
10055 QString def = definition;
10057 if ( def.startsWith(
"multiple"_L1, Qt::CaseInsensitive ) )
10060 def = def.mid( 8 ).trimmed();
10063 if ( def.startsWith(
"default_to_all_attributes"_L1, Qt::CaseInsensitive ) )
10066 def = def.mid( 25 ).trimmed();
10069 const thread_local QRegularExpression re( u
"(.*?)\\s+(.*)$"_s );
10070 const QRegularExpressionMatch m = re.match( def );
10071 if ( m.hasMatch() )
10073 parent = m.captured( 1 ).trimmed();
10074 def = m.captured( 2 );
10100 QVariant var = input;
10101 if ( !var.isValid() )
10109 if ( var.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
10112 var = fromVar.
sink;
10115 if ( var.userType() == qMetaTypeId<QgsProperty>() )
10128 if ( var.userType() != QMetaType::Type::QString )
10131 if ( var.toString().isEmpty() )
10139 if ( !value.isValid() )
10142 if ( value.userType() == qMetaTypeId<QgsProperty>() )
10145 if ( value.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
10154 return u
"QgsProperty.fromExpression('%1')"_s.arg( fromVar.
sink.
asExpression() );
10174 QStringList filters;
10175 for (
const QString &ext : exts )
10177 filters << QObject::tr(
"%1 files (*.%2)" ).arg( ext.toUpper(), ext.toLower() );
10179 return filters.join(
";;"_L1 ) + u
";;"_s + QObject::tr(
"All files (*.*)" );
10185 return QStringList() << ext;
Provides global constants and enumerations for use throughout the application.
ProcessingSourceType
Processing data source types.
@ File
Files (i.e. non map layer sources, such as text files).
@ TiledScene
Tiled scene layers.
@ Annotation
Annotation layers.
@ Vector
Tables (i.e. vector layers with or without geometry). When used for a sink this indicates the sink ha...
@ VectorTile
Vector tile layers.
@ MapLayer
Any map layer type (raster, vector, mesh, point cloud, annotation or plugin layer).
@ VectorAnyGeometry
Any vector layer with geometry.
@ VectorPoint
Vector point layers.
@ VectorPolygon
Vector polygon layers.
@ VectorLine
Vector line layers.
@ PointCloud
Point cloud layers.
ProcessingFileParameterBehavior
Flags which dictate the behavior of QgsProcessingParameterFile.
@ File
Parameter is a single file.
@ Folder
Parameter is a folder.
ExpressionType
Expression types.
@ RasterCalculator
Raster calculator expression.
@ Qgis
Native QGIS expression.
@ PointCloud
Point cloud expression.
@ ShortString
A heavily abbreviated string, for use when a compact representation is required.
DistanceUnit
Units of distance.
@ Unknown
Unknown distance unit.
QFlags< RasterProcessingParameterCapability > RasterProcessingParameterCapabilities
Raster layer processing parameter capabilities.
ProcessingFieldParameterDataType
Processing field parameter data types.
@ String
Accepts string fields.
@ Boolean
Accepts boolean fields, since QGIS 3.34.
@ Binary
Accepts binary fields, since QGIS 3.34.
@ Numeric
Accepts numeric fields.
@ DateTime
Accepts datetime fields.
@ Unknown
Unknown areal unit.
@ Invalid
Invalid (not set) property.
@ Field
Field based property.
@ Expression
Expression based property.
TemporalUnit
Temporal units.
GeometryType
The geometry types are used to group Qgis::WkbType in a coarse way.
QFlags< ProcessingParameterFlag > ProcessingParameterFlags
Flags which dictate the behavior of Processing parameters.
@ Unknown
Unknown volume unit.
InvalidGeometryCheck
Methods for handling of features with invalid geometries.
@ NoCheck
No invalid geometry checking.
@ AbortOnInvalid
Close iterator on encountering any features with invalid geometry. This requires a slow geometry vali...
@ SkipInvalid
Skip any features with invalid geometry. This requires a slow geometry validity check for every featu...
QFlags< ProcessingFeatureSourceDefinitionFlag > ProcessingFeatureSourceDefinitionFlags
Flags which control behavior for a Processing feature source.
@ CreateIndividualOutputPerInputFeature
If set, every feature processed from this source will be placed into its own individually created out...
@ OverrideDefaultGeometryCheck
If set, the default geometry check method (as dictated by QgsProcessingContext) will be overridden fo...
WkbType
The WKB type describes the number of dimensions a geometry has.
@ Preferred
Preferred format, matching the most recent WKT ISO standard. Currently an alias to WKT2_2019,...
@ Optional
Parameter is optional.
ProcessingDateTimeParameterDataType
Processing date time parameter data types.
@ DateTime
Datetime values.
ProcessingNumberParameterType
Processing numeric parameter data types.
@ Double
Double/float values.
Represents a map layer containing a set of georeferenced annotations, e.g.
static QgsProcessingRegistry * processingRegistry()
Returns the application's processing registry, used for managing processing providers,...
Represents a coordinate reference system (CRS).
bool isValid() const
Returns whether this CRS is correctly initialized and usable.
QString userFriendlyIdentifier(Qgis::CrsIdentifierType type=Qgis::CrsIdentifierType::MediumString) const
Returns a user friendly identifier for the CRS.
QString toWkt(Qgis::CrsWktVariant variant=Qgis::CrsWktVariant::Wkt1Gdal, bool multiline=false, int indentationWidth=4) const
Returns a WKT representation of this CRS.
Custom exception class for Coordinate Reference System related exceptions.
Handles parsing and evaluation of expressions (formerly called "search strings").
bool isValid() const
Checks if this expression is valid.
An interface for objects which accept features via addFeature(s) methods.
QFlags< SinkFlag > SinkFlags
Container of fields for a vector layer.
static bool fileMatchesFilter(const QString &fileName, const QString &filter)
Returns true if the given fileName matches a file filter string.
A geometry is the spatial representation of a feature.
QgsGeometry densifyByCount(int extraNodesPerSegment) const
Returns a copy of the geometry which has been densified by adding the specified number of extra nodes...
static QgsGeometry fromRect(const QgsRectangle &rect)
Creates a new geometry from a QgsRectangle.
QString lastError() const
Returns an error string referring to the last error encountered either when this geometry was created...
Qgis::GeometryOperationResult transform(const QgsCoordinateTransform &ct, Qgis::TransformDirection direction=Qgis::TransformDirection::Forward, bool transformZ=false)
Transforms this geometry as described by the coordinate transform ct.
static Q_INVOKABLE QgsGeometry fromWkt(const QString &wkt)
Creates a new geometry from a WKT string.
QgsPointXY asPoint() const
Returns the contents of the geometry as a 2-dimensional point.
static QgsGeometry fromPointXY(const QgsPointXY &point)
Creates a new geometry from a QgsPointXY object.
bool isMultipart() const
Returns true if WKB of the geometry is of WKBMulti* type.
QgsGeometry centroid() const
Returns the center of mass of a geometry.
QgsRectangle boundingBox() const
Returns the bounding box of the geometry.
Q_INVOKABLE QString asWkt(int precision=17) const
Exports the geometry to WKT.
Base class for graphical items within a QgsLayout.
QgsMasterLayoutInterface * layoutByName(const QString &name) const
Returns the layout with a matching name, or nullptr if no matching layouts were found.
QgsLayoutItem * itemById(const QString &id) const
Returns a layout item given its id.
QgsLayoutItem * itemByUuid(const QString &uuid, bool includeTemplateUuids=false) const
Returns the layout item with matching uuid unique identifier, or nullptr if a matching item could not...
Base class for all map layer types.
virtual Q_INVOKABLE QgsRectangle extent() const
Returns the extent of the layer.
QgsCoordinateReferenceSystem crs
Interface for master layout type objects, such as print layouts and reports.
virtual QgsMasterLayoutInterface::Type layoutType() const =0
Returns the master layout type.
@ PrintLayout
Individual print layout (QgsPrintLayout).
Represents a mesh layer supporting display of data on structured or unstructured meshes.
static void logMessage(const QString &message, const QString &tag=QString(), Qgis::MessageLevel level=Qgis::MessageLevel::Warning, bool notifyUser=true, const char *file=__builtin_FILE(), const char *function=__builtin_FUNCTION(), int line=__builtin_LINE(), Qgis::StringFormat format=Qgis::StringFormat::PlainText)
Adds a message to the log instance (and creates it if necessary).
Represents a map layer supporting display of point clouds.
Print layout, a QgsLayout subclass for static or atlas-based layouts.
Details for layers to load into projects.
Contains information about the context in which a processing algorithm is executed.
QgsProcessingFeedback * feedback()
Returns the associated feedback object.
QgsExpressionContext & expressionContext()
Returns the expression context.
void addLayerToLoadOnCompletion(const QString &layer, const QgsProcessingContext::LayerDetails &details)
Adds a layer to load (by ID or datasource) into the canvas upon completion of the algorithm or model.
QgsProject * project() const
Returns the project in which the algorithm is being executed.
Base class for all parameter definitions which represent file or layer destinations,...
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonOutputType::PythonQgsProcessingAlgorithmSubclass) const override
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
virtual QString defaultFileExtension() const =0
Returns the default file extension for destination file paths associated with this parameter.
void setCreateByDefault(bool createByDefault)
Sets whether the destination should be created by default.
QVariantMap toVariantMap() const override
Saves this parameter to a QVariantMap.
bool supportsNonFileBasedOutput() const
Returns true if the destination parameter supports non filed-based outputs, such as memory layers or ...
bool createByDefault() const
Returns true if the destination should be created by default.
QString createFileFilter() const override
This method needs to be reimplemented in all classes which implement this interface and return a file...
virtual bool isSupportedOutputValue(const QVariant &value, QgsProcessingContext &context, QString &error) const
Tests whether a value is a supported value for this parameter.
virtual QString generateTemporaryDestination(const QgsProcessingContext *context=nullptr) const
Generates a temporary destination value for this parameter.
QgsProcessingProvider * originalProvider() const
Original (source) provider which this parameter has been derived from.
QgsProcessingDestinationParameter(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), bool optional=false, bool createByDefault=true)
Constructor for QgsProcessingDestinationParameter.
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
Custom exception class for processing related exceptions.
Encapsulates settings relating to a feature source input to a processing algorithm.
bool loadVariant(const QVariantMap &map)
Loads this source definition from a QVariantMap, wrapped in a QVariant.
bool selectedFeaturesOnly
true if only selected features in the source should be used by algorithms.
QgsProperty source
Source definition.
Qgis::InvalidGeometryCheck geometryCheck
Geometry check method to apply to this source.
Qgis::ProcessingFeatureSourceDefinitionFlags flags
Flags which dictate source behavior.
long long featureLimit
If set to a value > 0, places a limit on the maximum number of features which will be read from the s...
QVariant toVariant() const
Saves this source definition to a QVariantMap, wrapped in a QVariant.
QString filterExpression
Optional expression filter to use for filtering features which will be read from the source.
QgsFeatureSource subclass which proxies methods to an underlying QgsFeatureSource,...
long long featureCount() const override
Returns the number of features contained in the source, or -1 if the feature count is unknown.
Base class for providing feedback from a processing algorithm.
Base class for the definition of processing outputs.
A file output for processing algorithms.
A folder output for processing algorithms.
A HTML file output for processing algorithms.
Encapsulates settings relating to a feature sink or output raster layer for a processing algorithm.
QString format() const
Returns the format (if set).
bool loadVariant(const QVariantMap &map)
Loads this output layer definition from a QVariantMap, wrapped in a QVariant.
bool operator!=(const QgsProcessingOutputLayerDefinition &other) const
QgsProject * destinationProject
Destination project.
bool operator==(const QgsProcessingOutputLayerDefinition &other) const
QgsProperty sink
Sink/layer definition.
bool useRemapping() const
Returns true if the output uses a remapping definition.
QgsProcessingOutputLayerDefinition(const QString &sink=QString(), QgsProject *destinationProject=nullptr)
Constructor for QgsProcessingOutputLayerDefinition, accepting a static sink/layer string.
QgsRemappingSinkDefinition remappingDefinition() const
Returns the output remapping definition, if useRemapping() is true.
QVariant toVariant() const
Saves this output layer definition to a QVariantMap, wrapped in a QVariant.
QString destinationName
Name to use for sink if it's to be loaded into a destination project.
QVariantMap createOptions
Map of optional sink/layer creation options, which are passed to the underlying provider when creatin...
void setRemappingDefinition(const QgsRemappingSinkDefinition &definition)
Sets the remapping definition to use when adding features to the output layer.
A pointcloud layer output for processing algorithms.
A raster layer output for processing algorithms.
A vector layer output for processing algorithms.
A vector tile layer output for processing algorithms.
QgsProcessingParameterAnnotationLayer(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), bool optional=false)
Constructor for QgsProcessingParameterAnnotationLayer.
QVariant valueAsJsonObject(const QVariant &value, QgsProcessingContext &context) const override
Returns a version of the parameter input value, which is suitable for use in a JSON object.
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
QString valueAsPythonString(const QVariant &value, QgsProcessingContext &context) const override
Returns a string version of the parameter input value, which is suitable for use as an input paramete...
static QgsProcessingParameterAnnotationLayer * fromScriptCode(const QString &name, const QString &description, bool isOptional, const QString &definition)
Creates a new parameter using the definition from a script code.
bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
QString valueAsString(const QVariant &value, QgsProcessingContext &context, bool &ok) const override
Returns a string version of the parameter input value (if possible).
static QString typeName()
Returns the type name for the parameter class.
QgsProcessingParameterArea * clone() const override
Creates a clone of the parameter definition.
QString type() const override
Unique parameter type name.
QString parentParameterName() const
Returns the name of the parent parameter, or an empty string if this is not set.
QVariantMap toVariantMap() const override
Saves this parameter to a QVariantMap.
void setParentParameterName(const QString &parentParameterName)
Sets the name of the parent layer parameter.
Qgis::AreaUnit defaultUnit() const
Returns the default area unit for the parameter.
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
QgsProcessingParameterArea(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), const QString &parentParameterName=QString(), bool optional=false, double minValue=0, double maxValue=std::numeric_limits< double >::max())
Constructor for QgsProcessingParameterArea.
static QString typeName()
Returns the type name for the parameter class.
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonOutputType::PythonQgsProcessingAlgorithmSubclass) const override
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
QStringList dependsOnOtherParameters() const override
Returns a list of other parameter names on which this parameter is dependent (e.g.
QString userFriendlyString(const QVariant &value) const override
Returns a user-friendly string representation of the provided parameter value.
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
QgsProcessingParameterAuthConfig(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), bool optional=false)
Constructor for QgsProcessingParameterAuthConfig.
static QString typeName()
Returns the type name for the parameter class.
QString asScriptCode() const override
Returns the parameter definition encoded in a string which can be used within a Processing script.
QString valueAsPythonString(const QVariant &value, QgsProcessingContext &context) const override
Returns a string version of the parameter input value, which is suitable for use as an input paramete...
static QgsProcessingParameterAuthConfig * fromScriptCode(const QString &name, const QString &description, bool isOptional, const QString &definition)
Creates a new parameter using the definition from a script code.
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonOutputType::PythonQgsProcessingAlgorithmSubclass) const override
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
void setAllowMultiple(bool allowMultiple)
Sets whether multiple band selections are permitted.
void setParentLayerParameterName(const QString &parentLayerParameterName)
Sets the name of the parent layer parameter.
QVariantMap toVariantMap() const override
Saves this parameter to a QVariantMap.
QStringList dependsOnOtherParameters() const override
Returns a list of other parameter names on which this parameter is dependent (e.g.
QString valueAsPythonString(const QVariant &value, QgsProcessingContext &context) const override
Returns a string version of the parameter input value, which is suitable for use as an input paramete...
QString parentLayerParameterName() const
Returns the name of the parent layer parameter, or an empty string if this is not set.
QgsProcessingParameterBand(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), const QString &parentLayerParameterName=QString(), bool optional=false, bool allowMultiple=false)
Constructor for QgsProcessingParameterBand.
QString asScriptCode() const override
Returns the parameter definition encoded in a string which can be used within a Processing script.
bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
static QgsProcessingParameterBand * fromScriptCode(const QString &name, const QString &description, bool isOptional, const QString &definition)
Creates a new parameter using the definition from a script code.
static QString typeName()
Returns the type name for the parameter class.
bool allowMultiple() const
Returns whether multiple band selections are permitted.
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
QString valueAsPythonString(const QVariant &value, QgsProcessingContext &context) const override
Returns a string version of the parameter input value, which is suitable for use as an input paramete...
QString type() const override
Unique parameter type name.
static QString typeName()
Returns the type name for the parameter class.
static QgsProcessingParameterBoolean * fromScriptCode(const QString &name, const QString &description, bool isOptional, const QString &definition)
Creates a new parameter using the definition from a script code.
QgsProcessingParameterBoolean(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), bool optional=false)
Constructor for QgsProcessingParameterBoolean.
QString asScriptCode() const override
Returns the parameter definition encoded in a string which can be used within a Processing script.
A color parameter for processing algorithms.
QString valueAsPythonString(const QVariant &value, QgsProcessingContext &context) const override
Returns a string version of the parameter input value, which is suitable for use as an input paramete...
static QgsProcessingParameterColor * fromScriptCode(const QString &name, const QString &description, bool isOptional, const QString &definition)
Creates a new parameter using the definition from a script code.
bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
bool opacityEnabled() const
Returns true if the parameter allows opacity control.
void setOpacityEnabled(bool enabled)
Sets whether the parameter allows opacity control.
QgsProcessingParameterColor(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), bool opacityEnabled=true, bool optional=false)
Constructor for QgsProcessingParameterColor.
static QString typeName()
Returns the type name for the parameter class.
QVariantMap toVariantMap() const override
Saves this parameter to a QVariantMap.
QString asScriptCode() const override
Returns the parameter definition encoded in a string which can be used within a Processing script.
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonOutputType::PythonQgsProcessingAlgorithmSubclass) const override
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
static QString typeName()
Returns the type name for the parameter class.
QVariantMap toVariantMap() const override
Saves this parameter to a QVariantMap.
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonOutputType::PythonQgsProcessingAlgorithmSubclass) const override
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
QString valueAsPythonString(const QVariant &value, QgsProcessingContext &context) const override
Returns a string version of the parameter input value, which is suitable for use as an input paramete...
QString destinationCrsParameterName() const
Returns the name of the destination CRS parameter, or an empty string if this is not set.
QString asScriptCode() const override
Returns the parameter definition encoded in a string which can be used within a Processing script.
static QgsProcessingParameterCoordinateOperation * fromScriptCode(const QString &name, const QString &description, bool isOptional, const QString &definition)
Creates a new parameter using the definition from a script code.
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
QgsProcessingParameterCoordinateOperation(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), const QString &sourceCrsParameterName=QString(), const QString &destinationCrsParameterName=QString(), const QVariant &staticSourceCrs=QVariant(), const QVariant &staticDestinationCrs=QVariant(), bool optional=false)
Constructor for QgsProcessingParameterCoordinateOperation.
QStringList dependsOnOtherParameters() const override
Returns a list of other parameter names on which this parameter is dependent (e.g.
QString sourceCrsParameterName() const
Returns the name of the source CRS parameter, or an empty string if this is not set.
QgsProcessingParameterCrs(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), bool optional=false)
Constructor for QgsProcessingParameterCrs.
QString valueAsString(const QVariant &value, QgsProcessingContext &context, bool &ok) const override
Returns a string version of the parameter input value (if possible).
QString userFriendlyString(const QVariant &value) const override
Returns a user-friendly string representation of the provided parameter value.
bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
static QString typeName()
Returns the type name for the parameter class.
QString valueAsPythonString(const QVariant &value, QgsProcessingContext &context) const override
Returns a string version of the parameter input value, which is suitable for use as an input paramete...
static QgsProcessingParameterCrs * fromScriptCode(const QString &name, const QString &description, bool isOptional, const QString &definition)
Creates a new parameter using the definition from a script code.
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
QVariant valueAsJsonObject(const QVariant &value, QgsProcessingContext &context) const override
Returns a version of the parameter input value, which is suitable for use in a JSON object.
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonOutputType::PythonQgsProcessingAlgorithmSubclass) const override
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
void setParentConnectionParameterName(const QString &name)
Sets the name of the parent connection parameter.
QStringList dependsOnOtherParameters() const override
Returns a list of other parameter names on which this parameter is dependent (e.g.
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
QgsProcessingParameterDatabaseSchema(const QString &name, const QString &description, const QString &connectionParameterName=QString(), const QVariant &defaultValue=QVariant(), bool optional=false)
Constructor for QgsProcessingParameterDatabaseSchema.
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
static QgsProcessingParameterDatabaseSchema * fromScriptCode(const QString &name, const QString &description, bool isOptional, const QString &definition)
Creates a new parameter using the definition from a script code.
QString asScriptCode() const override
Returns the parameter definition encoded in a string which can be used within a Processing script.
QString valueAsPythonString(const QVariant &value, QgsProcessingContext &context) const override
Returns a string version of the parameter input value, which is suitable for use as an input paramete...
bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
QString parentConnectionParameterName() const
Returns the name of the parent connection parameter, or an empty string if this is not set.
QVariantMap toVariantMap() const override
Saves this parameter to a QVariantMap.
QgsProcessingParameterDatabaseTable(const QString &name, const QString &description, const QString &connectionParameterName=QString(), const QString &schemaParameterName=QString(), const QVariant &defaultValue=QVariant(), bool optional=false, bool allowNewTableNames=false)
Constructor for QgsProcessingParameterDatabaseTable.
void setParentSchemaParameterName(const QString &name)
Sets the name of the parent schema parameter.
QString parentConnectionParameterName() const
Returns the name of the parent connection parameter, or an empty string if this is not set.
QString parentSchemaParameterName() const
Returns the name of the parent schema parameter, or an empty string if this is not set.
QString asScriptCode() const override
Returns the parameter definition encoded in a string which can be used within a Processing script.
static QgsProcessingParameterDatabaseTable * fromScriptCode(const QString &name, const QString &description, bool isOptional, const QString &definition)
Creates a new parameter using the definition from a script code.
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
bool allowNewTableNames() const
Returns true if the parameter allows users to enter names for a new (non-existing) tables.
QString valueAsPythonString(const QVariant &value, QgsProcessingContext &context) const override
Returns a string version of the parameter input value, which is suitable for use as an input paramete...
QStringList dependsOnOtherParameters() const override
Returns a list of other parameter names on which this parameter is dependent (e.g.
void setAllowNewTableNames(bool allowed)
Sets whether the parameter allows users to enter names for a new (non-existing) tables.
QVariantMap toVariantMap() const override
Saves this parameter to a QVariantMap.
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonOutputType::PythonQgsProcessingAlgorithmSubclass) const override
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
void setParentConnectionParameterName(const QString &name)
Sets the name of the parent connection parameter.
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
QString type() const override
Unique parameter type name.
void setMaximum(const QDateTime &maximum)
Sets the maximum value acceptable by the parameter.
static QgsProcessingParameterDateTime * fromScriptCode(const QString &name, const QString &description, bool isOptional, const QString &definition)
Creates a new parameter using the definition from a script code.
QDateTime minimum() const
Returns the minimum value acceptable by the parameter.
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonOutputType::PythonQgsProcessingAlgorithmSubclass) const override
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
void setDataType(Qgis::ProcessingDateTimeParameterDataType type)
Sets the acceptable data type for the parameter.
Qgis::ProcessingDateTimeParameterDataType dataType() const
Returns the acceptable data type for the parameter.
QString toolTip() const override
Returns a formatted tooltip for use with the parameter, which gives helpful information like paramete...
void setMinimum(const QDateTime &minimum)
Sets the minimum value acceptable by the parameter.
QString valueAsPythonString(const QVariant &value, QgsProcessingContext &context) const override
Returns a string version of the parameter input value, which is suitable for use as an input paramete...
QDateTime maximum() const
Returns the maximum value acceptable by the parameter.
QVariantMap toVariantMap() const override
Saves this parameter to a QVariantMap.
QString userFriendlyString(const QVariant &value) const override
Returns a user-friendly string representation of the provided parameter value.
QgsProcessingParameterDateTime(const QString &name, const QString &description=QString(), Qgis::ProcessingDateTimeParameterDataType type=Qgis::ProcessingDateTimeParameterDataType::DateTime, const QVariant &defaultValue=QVariant(), bool optional=false, const QDateTime &minValue=QDateTime(), const QDateTime &maxValue=QDateTime())
Constructor for QgsProcessingParameterDateTime.
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
Base class for the definition of processing parameters.
QgsProcessingAlgorithm * mAlgorithm
Pointer to algorithm which owns this parameter.
QString mHelp
Parameter help.
virtual QVariant valueAsJsonObject(const QVariant &value, QgsProcessingContext &context) const
Returns a version of the parameter input value, which is suitable for use in a JSON object.
QVariant defaultValue() const
Returns the default value for the parameter.
QVariant guiDefaultValueOverride() const
Returns the default value to use in the GUI for the parameter.
QString valueAsStringPrivate(const QVariant &value, QgsProcessingContext &context, bool &ok, ValueAsStringFlags flags) const
Internal method for evaluating values as string.
QString help() const
Returns the help for the parameter.
virtual QString asScriptCode() const
Returns the parameter definition encoded in a string which can be used within a Processing script.
virtual QString toolTip() const
Returns a formatted tooltip for use with the parameter, which gives helpful information like paramete...
Qgis::ProcessingParameterFlags mFlags
Parameter flags.
virtual QString userFriendlyString(const QVariant &value) const
Returns a user-friendly string representation of the provided parameter value.
QFlags< ValueAsStringFlag > ValueAsStringFlags
virtual QStringList valueAsStringList(const QVariant &value, QgsProcessingContext &context, bool &ok) const
Returns a string list version of the parameter input value (if possible).
QgsProcessingAlgorithm * algorithm() const
Returns a pointer to the algorithm which owns this parameter.
QgsProcessingProvider * provider() const
Returns a pointer to the provider for the algorithm which owns this parameter.
@ AllowMapLayerValues
Enable map layer value handling.
QString mName
Parameter name.
virtual QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonOutputType::PythonQgsProcessingAlgorithmSubclass) const
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
QString description() const
Returns the description for the parameter.
QgsProcessingParameterDefinition(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), bool optional=false, const QString &help=QString())
Constructor for QgsProcessingParameterDefinition.
QVariant defaultValueForGui() const
Returns the default value to use for the parameter in a GUI.
friend class QgsProcessingAlgorithm
virtual QString valueAsString(const QVariant &value, QgsProcessingContext &context, bool &ok) const
Returns a string version of the parameter input value (if possible).
QVariantMap mMetadata
Freeform metadata for parameter. Mostly used by widget wrappers to customize their appearance and beh...
QString mDescription
Parameter description.
virtual QString type() const =0
Unique parameter type name.
virtual QVariantMap toVariantMap() const
Saves this parameter to a QVariantMap.
QString name() const
Returns the name of the parameter.
QVariant mDefault
Default value for parameter.
Qgis::ProcessingParameterFlags flags() const
Returns any flags associated with the parameter.
QVariant mGuiDefault
Default value for parameter in GUI.
virtual QString valueAsPythonString(const QVariant &value, QgsProcessingContext &context) const
Returns a string version of the parameter input value, which is suitable for use as an input paramete...
virtual bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const
Checks whether the specified input value is acceptable for the parameter.
QVariant defaultGuiValueFromSetting() const
Default gui value for an algorithm parameter from settings.
virtual bool fromVariantMap(const QVariantMap &map)
Restores this parameter to a QVariantMap.
virtual QString valueAsPythonComment(const QVariant &value, QgsProcessingContext &context) const
Returns a Python comment explaining a parameter value, or an empty string if no comment is required.
QVariant valueAsJsonObjectPrivate(const QVariant &value, QgsProcessingContext &context, ValueAsStringFlags flags) const
Internal method for evaluating values as JSON objects.
virtual QColor modelColor() const
Returns the color to use for the parameter in model designer windows.
void setParentParameterName(const QString &parentParameterName)
Sets the name of the parent layer parameter.
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonOutputType::PythonQgsProcessingAlgorithmSubclass) const override
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
static QString typeName()
Returns the type name for the parameter class.
QString parentParameterName() const
Returns the name of the parent parameter, or an empty string if this is not set.
QStringList dependsOnOtherParameters() const override
Returns a list of other parameter names on which this parameter is dependent (e.g.
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
QVariantMap toVariantMap() const override
Saves this parameter to a QVariantMap.
Qgis::DistanceUnit defaultUnit() const
Returns the default distance unit for the parameter.
QgsProcessingParameterDistance * clone() const override
Creates a clone of the parameter definition.
QString userFriendlyString(const QVariant &value) const override
Returns a user-friendly string representation of the provided parameter value.
QString type() const override
Unique parameter type name.
QgsProcessingParameterDistance(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), const QString &parentParameterName=QString(), bool optional=false, double minValue=std::numeric_limits< double >::lowest()+1, double maxValue=std::numeric_limits< double >::max())
Constructor for QgsProcessingParameterDistance.
Qgis::TemporalUnit defaultUnit() const
Returns the default duration unit for the parameter.
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
QString userFriendlyString(const QVariant &value) const override
Returns a user-friendly string representation of the provided parameter value.
QgsProcessingParameterDuration * clone() const override
Creates a clone of the parameter definition.
QVariantMap toVariantMap() const override
Saves this parameter to a QVariantMap.
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonOutputType::PythonQgsProcessingAlgorithmSubclass) const override
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
static QString typeName()
Returns the type name for the parameter class.
QString type() const override
Unique parameter type name.
QgsProcessingParameterDuration(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), bool optional=false, double minValue=std::numeric_limits< double >::lowest()+1, double maxValue=std::numeric_limits< double >::max())
Constructor for QgsProcessingParameterDuration.
An enum based parameter for processing algorithms, allowing for selection from predefined values.
void setUsesStaticStrings(bool usesStaticStrings)
Sets whether the parameter uses static (non-translated) string values for its enumeration choice list...
QString userFriendlyString(const QVariant &value) const override
Returns a user-friendly string representation of the provided parameter value.
static QgsProcessingParameterEnum * fromScriptCode(const QString &name, const QString &description, bool isOptional, const QString &definition)
Creates a new parameter using the definition from a script code.
QString valueAsPythonString(const QVariant &value, QgsProcessingContext &context) const override
Returns a string version of the parameter input value, which is suitable for use as an input paramete...
bool allowMultiple() const
Returns true if the parameter allows multiple selected values.
QStringList options() const
Returns the list of acceptable options for the parameter.
QgsProcessingParameterEnum(const QString &name, const QString &description=QString(), const QStringList &options=QStringList(), bool allowMultiple=false, const QVariant &defaultValue=QVariant(), bool optional=false, bool usesStaticStrings=false)
Constructor for QgsProcessingParameterEnum.
void setOptions(const QStringList &options)
Sets the list of acceptable options for the parameter.
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonOutputType::PythonQgsProcessingAlgorithmSubclass) const override
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
bool usesStaticStrings() const
Returns true if the parameter uses static (non-translated) string values for its enumeration choice l...
QString valueAsPythonComment(const QVariant &value, QgsProcessingContext &context) const override
Returns a Python comment explaining a parameter value, or an empty string if no comment is required.
void setAllowMultiple(bool allowMultiple)
Sets whether the parameter allows multiple selected values.
bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
QVariantMap toVariantMap() const override
Saves this parameter to a QVariantMap.
QString asScriptCode() const override
Returns the parameter definition encoded in a string which can be used within a Processing script.
static QString typeName()
Returns the type name for the parameter class.
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonOutputType::PythonQgsProcessingAlgorithmSubclass) const override
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
static QgsProcessingParameterExpression * fromScriptCode(const QString &name, const QString &description, bool isOptional, const QString &definition)
Creates a new parameter using the definition from a script code.
QString valueAsPythonString(const QVariant &value, QgsProcessingContext &context) const override
Returns a string version of the parameter input value, which is suitable for use as an input paramete...
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
QgsProcessingParameterExpression(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), const QString &parentLayerParameterName=QString(), bool optional=false, Qgis::ExpressionType type=Qgis::ExpressionType::Qgis)
Constructor for QgsProcessingParameterExpression.
QStringList dependsOnOtherParameters() const override
Returns a list of other parameter names on which this parameter is dependent (e.g.
void setParentLayerParameterName(const QString &parentLayerParameterName)
Sets the name of the parent layer parameter.
QVariantMap toVariantMap() const override
Saves this parameter to a QVariantMap.
QString parentLayerParameterName() const
Returns the name of the parent layer parameter, or an empty string if this is not set.
QString type() const override
Unique parameter type name.
static QString typeName()
Returns the type name for the parameter class.
Qgis::ExpressionType expressionType() const
Returns the parameter's expression type.
void setExpressionType(Qgis::ExpressionType type)
Sets the parameter's expression type.
QString valueAsPythonString(const QVariant &value, QgsProcessingContext &context) const override
Returns a string version of the parameter input value, which is suitable for use as an input paramete...
QgsProcessingParameterExtent(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), bool optional=false)
Constructor for QgsProcessingParameterExtent.
bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
static QString typeName()
Returns the type name for the parameter class.
static QgsProcessingParameterExtent * fromScriptCode(const QString &name, const QString &description, bool isOptional, const QString &definition)
Creates a new parameter using the definition from a script code.
QVariant valueAsJsonObject(const QVariant &value, QgsProcessingContext &context) const override
Returns a version of the parameter input value, which is suitable for use in a JSON object.
QString valueAsString(const QVariant &value, QgsProcessingContext &context, bool &ok) const override
Returns a string version of the parameter input value (if possible).
QgsProcessingParameterFeatureSink(const QString &name, const QString &description=QString(), Qgis::ProcessingSourceType type=Qgis::ProcessingSourceType::VectorAnyGeometry, const QVariant &defaultValue=QVariant(), bool optional=false, bool createByDefault=true, bool supportsAppend=false)
Constructor for QgsProcessingParameterFeatureSink.
QString generateTemporaryDestination(const QgsProcessingContext *context=nullptr) const override
Generates a temporary destination value for this parameter.
static QgsProcessingParameterFeatureSink * fromScriptCode(const QString &name, const QString &description, bool isOptional, const QString &definition)
Creates a new parameter using the definition from a script code.
QgsProcessingOutputDefinition * toOutputDefinition() const override
Returns a new QgsProcessingOutputDefinition corresponding to the definition of the destination parame...
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
bool hasGeometry() const
Returns true if sink is likely to include geometries.
QString type() const override
Unique parameter type name.
void setDataType(Qgis::ProcessingSourceType type)
Sets the layer type for the sinks associated with the parameter.
virtual QStringList supportedOutputVectorLayerExtensions() const
Returns a list of the vector format file extensions supported by this parameter.
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
QString valueAsPythonString(const QVariant &value, QgsProcessingContext &context) const override
Returns a string version of the parameter input value, which is suitable for use as an input paramete...
bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
void setSupportsAppend(bool supportsAppend)
Sets whether the sink supports appending features to an existing table.
QString createFileFilter() const override
This method needs to be reimplemented in all classes which implement this interface and return a file...
QString defaultFileExtension() const override
Returns the default file extension for destination file paths associated with this parameter.
bool supportsAppend() const
Returns true if the sink supports appending features to an existing table.
Qgis::ProcessingSourceType dataType() const
Returns the layer type for sinks associated with the parameter.
static QString typeName()
Returns the type name for the parameter class.
QVariantMap toVariantMap() const override
Saves this parameter to a QVariantMap.
QString asScriptCode() const override
Returns the parameter definition encoded in a string which can be used within a Processing script.
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonOutputType::PythonQgsProcessingAlgorithmSubclass) const override
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
QgsProcessingParameterFeatureSource(const QString &name, const QString &description=QString(), const QList< int > &types=QList< int >(), const QVariant &defaultValue=QVariant(), bool optional=false)
Constructor for QgsProcessingParameterFeatureSource.
QString valueAsString(const QVariant &value, QgsProcessingContext &context, bool &ok) const override
Returns a string version of the parameter input value (if possible).
QString valueAsPythonString(const QVariant &value, QgsProcessingContext &context) const override
Returns a string version of the parameter input value, which is suitable for use as an input paramete...
QString asScriptCode() const override
Returns the parameter definition encoded in a string which can be used within a Processing script.
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
QVariantMap toVariantMap() const override
Saves this parameter to a QVariantMap.
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonOutputType::PythonQgsProcessingAlgorithmSubclass) const override
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
QString createFileFilter() const override
This method needs to be reimplemented in all classes which implement this interface and return a file...
static QString typeName()
Returns the type name for the parameter class.
QString type() const override
Unique parameter type name.
static QgsProcessingParameterFeatureSource * fromScriptCode(const QString &name, const QString &description, bool isOptional, const QString &definition)
Creates a new parameter using the definition from a script code.
QVariant valueAsJsonObject(const QVariant &value, QgsProcessingContext &context) const override
Returns a version of the parameter input value, which is suitable for use in a JSON object.
QStringList dependsOnOtherParameters() const override
Returns a list of other parameter names on which this parameter is dependent (e.g.
QString parentLayerParameterName() const
Returns the name of the parent layer parameter, or an empty string if this is not set.
void setParentLayerParameterName(const QString &parentLayerParameterName)
Sets the name of the parent layer parameter.
Qgis::ProcessingFieldParameterDataType dataType() const
Returns the acceptable data type for the field.
bool allowMultiple() const
Returns whether multiple field selections are permitted.
bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
QVariantMap toVariantMap() const override
Saves this parameter to a QVariantMap.
QString type() const override
Unique parameter type name.
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonOutputType::PythonQgsProcessingAlgorithmSubclass) const override
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
bool defaultToAllFields() const
Returns whether a parameter which allows multiple selections (see allowMultiple()) should automatical...
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
static QString typeName()
Returns the type name for the parameter class.
QString valueAsPythonString(const QVariant &value, QgsProcessingContext &context) const override
Returns a string version of the parameter input value, which is suitable for use as an input paramete...
void setDataType(Qgis::ProcessingFieldParameterDataType type)
Sets the acceptable data type for the field.
void setAllowMultiple(bool allowMultiple)
Sets whether multiple field selections are permitted.
QgsProcessingParameterField(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), const QString &parentLayerParameterName=QString(), Qgis::ProcessingFieldParameterDataType type=Qgis::ProcessingFieldParameterDataType::Any, bool allowMultiple=false, bool optional=false, bool defaultToAllFields=false)
Constructor for QgsProcessingParameterField.
QString asScriptCode() const override
Returns the parameter definition encoded in a string which can be used within a Processing script.
void setDefaultToAllFields(bool enabled)
Sets whether a parameter which allows multiple selections (see allowMultiple()) should automatically ...
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
static QgsProcessingParameterField * fromScriptCode(const QString &name, const QString &description, bool isOptional, const QString &definition)
Creates a new parameter using the definition from a script code.
static QgsProcessingParameterFileDestination * fromScriptCode(const QString &name, const QString &description, bool isOptional, const QString &definition)
Creates a new parameter using the definition from a script code.
QgsProcessingOutputDefinition * toOutputDefinition() const override
Returns a new QgsProcessingOutputDefinition corresponding to the definition of the destination parame...
QString defaultFileExtension() const override
Returns the default file extension for destination file paths associated with this parameter.
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonOutputType::PythonQgsProcessingAlgorithmSubclass) const override
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
QgsProcessingParameterFileDestination(const QString &name, const QString &description=QString(), const QString &fileFilter=QString(), const QVariant &defaultValue=QVariant(), bool optional=false, bool createByDefault=true)
Constructor for QgsProcessingParameterFileDestination.
static QString typeName()
Returns the type name for the parameter class.
QString valueAsPythonString(const QVariant &value, QgsProcessingContext &context) const override
Returns a string version of the parameter input value, which is suitable for use as an input paramete...
QString fileFilter() const
Returns the file filter string for file destinations compatible with this parameter.
void setFileFilter(const QString &filter)
Sets the file filter string for file destinations compatible with this parameter.
QString createFileFilter() const override
This method needs to be reimplemented in all classes which implement this interface and return a file...
QVariantMap toVariantMap() const override
Saves this parameter to a QVariantMap.
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
QString extension() const
Returns any specified file extension for the parameter.
void setExtension(const QString &extension)
Sets a file extension for the parameter.
static QString typeName()
Returns the type name for the parameter class.
QVariantMap toVariantMap() const override
Saves this parameter to a QVariantMap.
QString asScriptCode() const override
Returns the parameter definition encoded in a string which can be used within a Processing script.
QgsProcessingParameterFile(const QString &name, const QString &description=QString(), Qgis::ProcessingFileParameterBehavior behavior=Qgis::ProcessingFileParameterBehavior::File, const QString &extension=QString(), const QVariant &defaultValue=QVariant(), bool optional=false, const QString &fileFilter=QString())
Constructor for QgsProcessingParameterFile.
void setFileFilter(const QString &filter)
Sets the file filter string for file destinations compatible with this parameter.
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonOutputType::PythonQgsProcessingAlgorithmSubclass) const override
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
QString fileFilter() const
Returns the file filter string for file destinations compatible with this parameter.
bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
QString createFileFilter() const override
This method needs to be reimplemented in all classes which implement this interface and return a file...
static QgsProcessingParameterFile * fromScriptCode(const QString &name, const QString &description, bool isOptional, const QString &definition, Qgis::ProcessingFileParameterBehavior behavior=Qgis::ProcessingFileParameterBehavior::File)
Creates a new parameter using the definition from a script code.
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
Qgis::ProcessingFileParameterBehavior behavior() const
Returns the parameter behavior (e.g.
QgsProcessingOutputDefinition * toOutputDefinition() const override
Returns a new QgsProcessingOutputDefinition corresponding to the definition of the destination parame...
static QgsProcessingParameterFolderDestination * fromScriptCode(const QString &name, const QString &description, bool isOptional, const QString &definition)
Creates a new parameter using the definition from a script code.
bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
QString defaultFileExtension() const override
Returns the default file extension for destination file paths associated with this parameter.
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
static QString typeName()
Returns the type name for the parameter class.
QgsProcessingParameterFolderDestination(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), bool optional=false, bool createByDefault=true)
Constructor for QgsProcessingParameterFolderDestination.
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
QString type() const override
Unique parameter type name.
QString valueAsPythonString(const QVariant &value, QgsProcessingContext &context) const override
Returns a string version of the parameter input value, which is suitable for use as an input paramete...
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonOutputType::PythonQgsProcessingAlgorithmSubclass) const override
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
QString asScriptCode() const override
Returns the parameter definition encoded in a string which can be used within a Processing script.
bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
bool allowMultipart() const
Returns the parameter allow multipart geometries.
QgsProcessingParameterGeometry(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), bool optional=false, const QList< int > &geometryTypes=QList< int >(), bool allowMultipart=true)
Constructor for QgsProcessingParameterGeometry.
QList< int > geometryTypes() const
Returns the parameter allowed geometries, as a list of Qgis::GeometryType values.
QVariantMap toVariantMap() const override
Saves this parameter to a QVariantMap.
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
QString userFriendlyString(const QVariant &value) const override
Returns a user-friendly string representation of the provided parameter value.
static QgsProcessingParameterGeometry * fromScriptCode(const QString &name, const QString &description, bool isOptional, const QString &definition)
Creates a new parameter using the definition from a script code.
QString type() const override
Unique parameter type name.
static QgsProcessingParameterLayoutItem * fromScriptCode(const QString &name, const QString &description, bool isOptional, const QString &definition)
Creates a new parameter using the definition from a script code.
QgsProcessingParameterLayoutItem(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), const QString &parentLayoutParameterName=QString(), int itemType=-1, bool optional=false)
Constructor for QgsProcessingParameterLayoutItem.
void setParentLayoutParameterName(const QString &name)
Sets the name of the parent layout parameter.
QString parentLayoutParameterName() const
Returns the name of the parent layout parameter, or an empty string if this is not set.
static QString typeName()
Returns the type name for the parameter class.
QVariantMap toVariantMap() const override
Saves this parameter to a QVariantMap.
int itemType() const
Returns the acceptable item type, or -1 if any item type is allowed.
void setItemType(int type)
Sets the acceptable item type, or -1 if any item type is allowed.
QString valueAsPythonString(const QVariant &value, QgsProcessingContext &context) const override
Returns a string version of the parameter input value, which is suitable for use as an input paramete...
QString asScriptCode() const override
Returns the parameter definition encoded in a string which can be used within a Processing script.
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonOutputType::PythonQgsProcessingAlgorithmSubclass) const override
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
QStringList dependsOnOtherParameters() const override
Returns a list of other parameter names on which this parameter is dependent (e.g.
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonOutputType::PythonQgsProcessingAlgorithmSubclass) const override
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
QString valueAsPythonString(const QVariant &value, QgsProcessingContext &context) const override
Returns a string version of the parameter input value, which is suitable for use as an input paramete...
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
static QgsProcessingParameterLayout * fromScriptCode(const QString &name, const QString &description, bool isOptional, const QString &definition)
Creates a new parameter using the definition from a script code.
QString asScriptCode() const override
Returns the parameter definition encoded in a string which can be used within a Processing script.
QgsProcessingParameterLayout(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), bool optional=false)
Constructor for QgsProcessingParameterLayout.
static QString typeName()
Returns the type name for the parameter class.
void setDataTypes(const QList< int > &types)
Sets the geometry types for sources acceptable by the parameter.
QgsProcessingParameterLimitedDataTypes(const QList< int > &types=QList< int >())
Constructor for QgsProcessingParameterLimitedDataTypes, with a list of acceptable data types.
QList< int > mDataTypes
List of acceptable data types for the parameter.
QList< int > dataTypes() const
Returns the geometry types for sources acceptable by the parameter.
QString asScriptCode() const override
Returns the parameter definition encoded in a string which can be used within a Processing script.
static QgsProcessingParameterMapLayer * fromScriptCode(const QString &name, const QString &description, bool isOptional, const QString &definition)
Creates a new parameter using the definition from a script code.
QVariantMap toVariantMap() const override
Saves this parameter to a QVariantMap.
QString valueAsPythonString(const QVariant &value, QgsProcessingContext &context) const override
Returns a string version of the parameter input value, which is suitable for use as an input paramete...
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
QString valueAsString(const QVariant &value, QgsProcessingContext &context, bool &ok) const override
Returns a string version of the parameter input value (if possible).
QString createFileFilter() const override
This method needs to be reimplemented in all classes which implement this interface and return a file...
QString type() const override
Unique parameter type name.
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonOutputType::PythonQgsProcessingAlgorithmSubclass) const override
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
QgsProcessingParameterMapLayer(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), bool optional=false, const QList< int > &types=QList< int >())
Constructor for QgsProcessingParameterMapLayer.
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
QVariant valueAsJsonObject(const QVariant &value, QgsProcessingContext &context) const override
Returns a version of the parameter input value, which is suitable for use in a JSON object.
bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
static QString typeName()
Returns the type name for the parameter class.
QString asScriptCode() const override
Returns the parameter definition encoded in a string which can be used within a Processing script.
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
static QgsProcessingParameterMapTheme * fromScriptCode(const QString &name, const QString &description, bool isOptional, const QString &definition)
Creates a new parameter using the definition from a script code.
QString valueAsPythonString(const QVariant &value, QgsProcessingContext &context) const override
Returns a string version of the parameter input value, which is suitable for use as an input paramete...
QgsProcessingParameterMapTheme(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), bool optional=false)
Constructor for QgsProcessingParameterMapTheme.
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
QVariantMap toVariantMap() const override
Saves this parameter to a QVariantMap.
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonOutputType::PythonQgsProcessingAlgorithmSubclass) const override
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
QStringList headers() const
Returns a list of column headers (if set).
void setHeaders(const QStringList &headers)
Sets the list of column headers.
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
void setHasFixedNumberRows(bool hasFixedNumberRows)
Sets whether the table has a fixed number of rows.
QVariantMap toVariantMap() const override
Saves this parameter to a QVariantMap.
void setNumberRows(int rows)
Sets the fixed number of rows in the table.
int numberRows() const
Returns the fixed number of rows in the table.
static QgsProcessingParameterMatrix * fromScriptCode(const QString &name, const QString &description, bool isOptional, const QString &definition)
Creates a new parameter using the definition from a script code.
QString valueAsPythonString(const QVariant &value, QgsProcessingContext &context) const override
Returns a string version of the parameter input value, which is suitable for use as an input paramete...
static QString typeName()
Returns the type name for the parameter class.
QgsProcessingParameterMatrix(const QString &name, const QString &description=QString(), int numberRows=3, bool hasFixedNumberRows=false, const QStringList &headers=QStringList(), const QVariant &defaultValue=QVariant(), bool optional=false)
Constructor for QgsProcessingParameterMatrix.
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonOutputType::PythonQgsProcessingAlgorithmSubclass) const override
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
bool hasFixedNumberRows() const
Returns whether the table has a fixed number of rows.
bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
QString valueAsString(const QVariant &value, QgsProcessingContext &context, bool &ok) const override
Returns a string version of the parameter input value (if possible).
QgsProcessingParameterMeshLayer(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), bool optional=false)
Constructor for QgsProcessingParameterMeshLayer.
QVariant valueAsJsonObject(const QVariant &value, QgsProcessingContext &context) const override
Returns a version of the parameter input value, which is suitable for use in a JSON object.
QString createFileFilter() const override
This method needs to be reimplemented in all classes which implement this interface and return a file...
QString valueAsPythonString(const QVariant &value, QgsProcessingContext &context) const override
Returns a string version of the parameter input value, which is suitable for use as an input paramete...
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
static QgsProcessingParameterMeshLayer * fromScriptCode(const QString &name, const QString &description, bool isOptional, const QString &definition)
Creates a new parameter using the definition from a script code.
static QString typeName()
Returns the type name for the parameter class.
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
QVariant valueAsJsonObject(const QVariant &value, QgsProcessingContext &context) const override
Returns a version of the parameter input value, which is suitable for use in a JSON object.
QString valueAsString(const QVariant &value, QgsProcessingContext &context, bool &ok) const override
Returns a string version of the parameter input value (if possible).
void setMinimumNumberInputs(int minimum)
Sets the minimum number of layers required for the parameter.
bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
QString asScriptCode() const override
Returns the parameter definition encoded in a string which can be used within a Processing script.
Qgis::ProcessingSourceType layerType() const
Returns the layer type for layers acceptable by the parameter.
QString valueAsPythonString(const QVariant &value, QgsProcessingContext &context) const override
Returns a string version of the parameter input value, which is suitable for use as an input paramete...
static QString typeName()
Returns the type name for the parameter class.
void setLayerType(Qgis::ProcessingSourceType type)
Sets the layer type for layers acceptable by the parameter.
QVariantMap toVariantMap() const override
Saves this parameter to a QVariantMap.
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
QString createFileFilter() const override
This method needs to be reimplemented in all classes which implement this interface and return a file...
QgsProcessingParameterMultipleLayers(const QString &name, const QString &description=QString(), Qgis::ProcessingSourceType layerType=Qgis::ProcessingSourceType::VectorAnyGeometry, const QVariant &defaultValue=QVariant(), bool optional=false)
Constructor for QgsProcessingParameterMultipleLayers.
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonOutputType::PythonQgsProcessingAlgorithmSubclass) const override
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
static QgsProcessingParameterMultipleLayers * fromScriptCode(const QString &name, const QString &description, bool isOptional, const QString &definition)
Creates a new parameter using the definition from a script code.
QString type() const override
Unique parameter type name.
int minimumNumberInputs() const
Returns the minimum number of layers required for the parameter.
double minimum() const
Returns the minimum value acceptable by the parameter.
static QgsProcessingParameterNumber * fromScriptCode(const QString &name, const QString &description, bool isOptional, const QString &definition)
Creates a new parameter using the definition from a script code.
void setMinimum(double minimum)
Sets the minimum value acceptable by the parameter.
void setMaximum(double maximum)
Sets the maximum value acceptable by the parameter.
double maximum() const
Returns the maximum value acceptable by the parameter.
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonOutputType::PythonQgsProcessingAlgorithmSubclass) const override
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
QString type() const override
Unique parameter type name.
QVariantMap toVariantMap() const override
Saves this parameter to a QVariantMap.
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
QString toolTip() const override
Returns a formatted tooltip for use with the parameter, which gives helpful information like paramete...
QString valueAsPythonString(const QVariant &value, QgsProcessingContext &context) const override
Returns a string version of the parameter input value, which is suitable for use as an input paramete...
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
Qgis::ProcessingNumberParameterType dataType() const
Returns the acceptable data type for the parameter.
static QString typeName()
Returns the type name for the parameter class.
QgsProcessingParameterNumber(const QString &name, const QString &description=QString(), Qgis::ProcessingNumberParameterType type=Qgis::ProcessingNumberParameterType::Integer, const QVariant &defaultValue=QVariant(), bool optional=false, double minValue=std::numeric_limits< double >::lowest()+1, double maxValue=std::numeric_limits< double >::max())
Constructor for QgsProcessingParameterNumber.
void setDataType(Qgis::ProcessingNumberParameterType type)
Sets the acceptable data type for the parameter.
QgsProcessingParameterPointCloudAttribute(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), const QString &parentLayerParameterName=QString(), bool allowMultiple=false, bool optional=false, bool defaultToAllAttributes=false)
Constructor for QgsProcessingParameterField.
QStringList dependsOnOtherParameters() const override
Returns a list of other parameter names on which this parameter is dependent (e.g.
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
void setDefaultToAllAttributes(bool enabled)
Sets whether a parameter which allows multiple selections (see allowMultiple()) should automatically ...
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonOutputType::PythonQgsProcessingAlgorithmSubclass) const override
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
void setParentLayerParameterName(const QString &parentLayerParameterName)
Sets the name of the parent layer parameter.
QString parentLayerParameterName() const
Returns the name of the parent layer parameter, or an empty string if this is not set.
static QgsProcessingParameterPointCloudAttribute * fromScriptCode(const QString &name, const QString &description, bool isOptional, const QString &definition)
Creates a new parameter using the definition from a script code.
static QString typeName()
Returns the type name for the parameter class.
bool allowMultiple() const
Returns whether multiple field selections are permitted.
void setAllowMultiple(bool allowMultiple)
Sets whether multiple field selections are permitted.
QString valueAsPythonString(const QVariant &value, QgsProcessingContext &context) const override
Returns a string version of the parameter input value, which is suitable for use as an input paramete...
bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
QVariantMap toVariantMap() const override
Saves this parameter to a QVariantMap.
bool defaultToAllAttributes() const
Returns whether a parameter which allows multiple selections (see allowMultiple()) should automatical...
QString asScriptCode() const override
Returns the parameter definition encoded in a string which can be used within a Processing script.
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
QString createFileFilter() const override
This method needs to be reimplemented in all classes which implement this interface and return a file...
QString valueAsPythonString(const QVariant &value, QgsProcessingContext &context) const override
Returns a string version of the parameter input value, which is suitable for use as an input paramete...
static QgsProcessingParameterPointCloudDestination * fromScriptCode(const QString &name, const QString &description, bool isOptional, const QString &definition)
Creates a new parameter using the definition from a script code.
virtual QStringList supportedOutputPointCloudLayerExtensions() const
Returns a list of the point cloud format file extensions supported for this parameter.
bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
QString defaultFileExtension() const override
Returns the default file extension for destination file paths associated with this parameter.
static QString typeName()
Returns the type name for the parameter class.
QgsProcessingParameterPointCloudDestination(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), bool optional=false, bool createByDefault=true)
Constructor for QgsProcessingParameterPointCloudDestination.
QgsProcessingOutputDefinition * toOutputDefinition() const override
Returns a new QgsProcessingOutputDefinition corresponding to the definition of the destination parame...
QString valueAsPythonString(const QVariant &value, QgsProcessingContext &context) const override
Returns a string version of the parameter input value, which is suitable for use as an input paramete...
QString valueAsString(const QVariant &value, QgsProcessingContext &context, bool &ok) const override
Returns a string version of the parameter input value (if possible).
static QgsProcessingParameterPointCloudLayer * fromScriptCode(const QString &name, const QString &description, bool isOptional, const QString &definition)
Creates a new parameter using the definition from a script code.
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
QVariant valueAsJsonObject(const QVariant &value, QgsProcessingContext &context) const override
Returns a version of the parameter input value, which is suitable for use in a JSON object.
QString createFileFilter() const override
This method needs to be reimplemented in all classes which implement this interface and return a file...
bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
static QString typeName()
Returns the type name for the parameter class.
QgsProcessingParameterPointCloudLayer(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), bool optional=false)
Constructor for QgsProcessingParameterPointCloudLayer.
bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
static QgsProcessingParameterPoint * fromScriptCode(const QString &name, const QString &description, bool isOptional, const QString &definition)
Creates a new parameter using the definition from a script code.
QgsProcessingParameterPoint(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), bool optional=false)
Constructor for QgsProcessingParameterPoint.
static QString typeName()
Returns the type name for the parameter class.
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
QString valueAsPythonString(const QVariant &value, QgsProcessingContext &context) const override
Returns a string version of the parameter input value, which is suitable for use as an input paramete...
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
QgsProcessingParameterProviderConnection(const QString &name, const QString &description, const QString &provider, const QVariant &defaultValue=QVariant(), bool optional=false)
Constructor for QgsProcessingParameterProviderConnection, for the specified provider type.
QVariantMap toVariantMap() const override
Saves this parameter to a QVariantMap.
QString asScriptCode() const override
Returns the parameter definition encoded in a string which can be used within a Processing script.
QString valueAsPythonString(const QVariant &value, QgsProcessingContext &context) const override
Returns a string version of the parameter input value, which is suitable for use as an input paramete...
bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonOutputType::PythonQgsProcessingAlgorithmSubclass) const override
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
static QgsProcessingParameterProviderConnection * fromScriptCode(const QString &name, const QString &description, bool isOptional, const QString &definition)
Creates a new parameter using the definition from a script code.
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
static QString typeName()
Returns the type name for the parameter class.
bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonOutputType::PythonQgsProcessingAlgorithmSubclass) const override
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
Qgis::ProcessingNumberParameterType dataType() const
Returns the acceptable data type for the range.
QgsProcessingParameterRange(const QString &name, const QString &description=QString(), Qgis::ProcessingNumberParameterType type=Qgis::ProcessingNumberParameterType::Integer, const QVariant &defaultValue=QVariant(), bool optional=false)
Constructor for QgsProcessingParameterRange.
QVariantMap toVariantMap() const override
Saves this parameter to a QVariantMap.
QString valueAsPythonString(const QVariant &value, QgsProcessingContext &context) const override
Returns a string version of the parameter input value, which is suitable for use as an input paramete...
void setDataType(Qgis::ProcessingNumberParameterType dataType)
Sets the acceptable data type for the range.
QString type() const override
Unique parameter type name.
static QgsProcessingParameterRange * fromScriptCode(const QString &name, const QString &description, bool isOptional, const QString &definition)
Creates a new parameter using the definition from a script code.
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
QString valueAsPythonString(const QVariant &value, QgsProcessingContext &context) const override
Returns a string version of the parameter input value, which is suitable for use as an input paramete...
QgsProcessingOutputDefinition * toOutputDefinition() const override
Returns a new QgsProcessingOutputDefinition corresponding to the definition of the destination parame...
QString createFileFilter() const override
This method needs to be reimplemented in all classes which implement this interface and return a file...
QgsProcessingParameterRasterDestination(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), bool optional=false, bool createByDefault=true)
Constructor for QgsProcessingParameterRasterDestination.
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
static QgsProcessingParameterRasterDestination * fromScriptCode(const QString &name, const QString &description, bool isOptional, const QString &definition)
Creates a new parameter using the definition from a script code.
QString defaultFileExtension() const override
Returns the default file extension for destination file paths associated with this parameter.
QString defaultFileFormat() const
Returns the default file format for destination file paths associated with this parameter.
virtual Q_DECL_DEPRECATED QStringList supportedOutputRasterLayerExtensions() const
Returns a list of the raster format file extensions supported for this parameter.
static QString typeName()
Returns the type name for the parameter class.
bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
virtual QList< QPair< QString, QString > > supportedOutputRasterLayerFormatAndExtensions() const
Returns a list of (format, file extension) supported by this provider.
Qgis::RasterProcessingParameterCapabilities parameterCapabilities() const
Returns flags containing the supported capabilities of the raster layer parameter.
QString valueAsString(const QVariant &value, QgsProcessingContext &context, bool &ok) const override
Returns a string version of the parameter input value (if possible).
QString valueAsPythonString(const QVariant &value, QgsProcessingContext &context) const override
Returns a string version of the parameter input value, which is suitable for use as an input paramete...
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
static QgsProcessingParameterRasterLayer * fromScriptCode(const QString &name, const QString &description, bool isOptional, const QString &definition)
Creates a new parameter using the definition from a script code.
QVariant valueAsJsonObject(const QVariant &value, QgsProcessingContext &context) const override
Returns a version of the parameter input value, which is suitable for use in a JSON object.
bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
static QString typeName()
Returns the type name for the parameter class.
QgsProcessingParameterRasterLayer(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), bool optional=false)
Constructor for QgsProcessingParameterRasterLayer.
QString createFileFilter() const override
This method needs to be reimplemented in all classes which implement this interface and return a file...
void setParameterCapabilities(Qgis::RasterProcessingParameterCapabilities capabilities)
Sets the supported capabilities of the raster layer parameter.
QString type() const override
Unique parameter type name.
static QString typeName()
Returns the type name for the parameter class.
static QgsProcessingParameterScale * fromScriptCode(const QString &name, const QString &description, bool isOptional, const QString &definition)
Creates a new parameter using the definition from a script code.
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonOutputType::PythonQgsProcessingAlgorithmSubclass) const override
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
QgsProcessingParameterScale * clone() const override
Creates a clone of the parameter definition.
QgsProcessingParameterScale(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), bool optional=false)
Constructor for QgsProcessingParameterScale.
static QString typeName()
Returns the type name for the parameter class.
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
void setMultiLine(bool multiLine)
Sets whether the parameter allows multiline strings.
QVariantMap toVariantMap() const override
Saves this parameter to a QVariantMap.
QString asScriptCode() const override
Returns the parameter definition encoded in a string which can be used within a Processing script.
static QgsProcessingParameterString * fromScriptCode(const QString &name, const QString &description, bool isOptional, const QString &definition)
Creates a new parameter using the definition from a script code.
bool multiLine() const
Returns true if the parameter allows multiline strings.
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
QgsProcessingParameterString(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), bool multiLine=false, bool optional=false)
Constructor for QgsProcessingParameterString.
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonOutputType::PythonQgsProcessingAlgorithmSubclass) const override
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
QString valueAsPythonString(const QVariant &value, QgsProcessingContext &context) const override
Returns a string version of the parameter input value, which is suitable for use as an input paramete...
Makes metadata of processing parameters available.
virtual QgsProcessingParameterDefinition * create(const QString &name) const =0
Creates a new parameter of this type.
virtual QColor modelColor() const
Returns the color to use for the parameter in model designer windows.
static QColor defaultModelColor()
Returns the default color for a processing parameter.
QgsProcessingParameterVectorDestination(const QString &name, const QString &description=QString(), Qgis::ProcessingSourceType type=Qgis::ProcessingSourceType::VectorAnyGeometry, const QVariant &defaultValue=QVariant(), bool optional=false, bool createByDefault=true)
Constructor for QgsProcessingParameterVectorDestination.
QString defaultFileExtension() const override
Returns the default file extension for destination file paths associated with this parameter.
QString createFileFilter() const override
This method needs to be reimplemented in all classes which implement this interface and return a file...
QString type() const override
Unique parameter type name.
QVariantMap toVariantMap() const override
Saves this parameter to a QVariantMap.
static QString typeName()
Returns the type name for the parameter class.
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
Qgis::ProcessingSourceType dataType() const
Returns the layer type for this created vector layer.
bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
QString asScriptCode() const override
Returns the parameter definition encoded in a string which can be used within a Processing script.
virtual QStringList supportedOutputVectorLayerExtensions() const
Returns a list of the vector format file extensions supported by this parameter.
bool hasGeometry() const
Returns true if the created layer is likely to include geometries.
void setDataType(Qgis::ProcessingSourceType type)
Sets the layer type for the created vector layer.
QString valueAsPythonString(const QVariant &value, QgsProcessingContext &context) const override
Returns a string version of the parameter input value, which is suitable for use as an input paramete...
static QgsProcessingParameterVectorDestination * fromScriptCode(const QString &name, const QString &description, bool isOptional, const QString &definition)
Creates a new parameter using the definition from a script code.
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
QgsProcessingOutputDefinition * toOutputDefinition() const override
Returns a new QgsProcessingOutputDefinition corresponding to the definition of the destination parame...
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonOutputType::PythonQgsProcessingAlgorithmSubclass) const override
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonOutputType::PythonQgsProcessingAlgorithmSubclass) const override
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
static QgsProcessingParameterVectorLayer * fromScriptCode(const QString &name, const QString &description, bool isOptional, const QString &definition)
Creates a new parameter using the definition from a script code.
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
QString valueAsString(const QVariant &value, QgsProcessingContext &context, bool &ok) const override
Returns a string version of the parameter input value (if possible).
QVariantMap toVariantMap() const override
Saves this parameter to a QVariantMap.
QString type() const override
Unique parameter type name.
QString createFileFilter() const override
This method needs to be reimplemented in all classes which implement this interface and return a file...
QgsProcessingParameterVectorLayer(const QString &name, const QString &description=QString(), const QList< int > &types=QList< int >(), const QVariant &defaultValue=QVariant(), bool optional=false)
Constructor for QgsProcessingParameterVectorLayer.
static QString typeName()
Returns the type name for the parameter class.
QVariant valueAsJsonObject(const QVariant &value, QgsProcessingContext &context) const override
Returns a version of the parameter input value, which is suitable for use in a JSON object.
QString valueAsPythonString(const QVariant &value, QgsProcessingContext &context) const override
Returns a string version of the parameter input value, which is suitable for use as an input paramete...
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
QgsProcessingOutputDefinition * toOutputDefinition() const override
Returns a new QgsProcessingOutputDefinition corresponding to the definition of the destination parame...
QString valueAsPythonString(const QVariant &value, QgsProcessingContext &context) const override
Returns a string version of the parameter input value, which is suitable for use as an input paramete...
QgsProcessingParameterVectorTileDestination(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), bool optional=false, bool createByDefault=true)
Constructor for QgsProcessingParameterVectorTileDestination.
bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
virtual QStringList supportedOutputVectorTileLayerExtensions() const
Returns a list of the point cloud format file extensions supported for this parameter.
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
static QgsProcessingParameterVectorTileDestination * fromScriptCode(const QString &name, const QString &description, bool isOptional, const QString &definition)
Creates a new parameter using the definition from a script code.
static QString typeName()
Returns the type name for the parameter class.
QString defaultFileExtension() const override
Returns the default file extension for destination file paths associated with this parameter.
QString createFileFilter() const override
This method needs to be reimplemented in all classes which implement this interface and return a file...
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
QString userFriendlyString(const QVariant &value) const override
Returns a user-friendly string representation of the provided parameter value.
static QString typeName()
Returns the type name for the parameter class.
QgsProcessingParameterVolume(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), const QString &parentParameterName=QString(), bool optional=false, double minValue=0, double maxValue=std::numeric_limits< double >::max())
Constructor for QgsProcessingParameterVolume.
Qgis::VolumeUnit defaultUnit() const
Returns the default volume unit for the parameter.
void setParentParameterName(const QString &parentParameterName)
Sets the name of the parent layer parameter.
QgsProcessingParameterVolume * clone() const override
Creates a clone of the parameter definition.
QVariantMap toVariantMap() const override
Saves this parameter to a QVariantMap.
QStringList dependsOnOtherParameters() const override
Returns a list of other parameter names on which this parameter is dependent (e.g.
QString parentParameterName() const
Returns the name of the parent parameter, or an empty string if this is not set.
QString type() const override
Unique parameter type name.
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonOutputType::PythonQgsProcessingAlgorithmSubclass) const override
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
static QString descriptionFromName(const QString &name)
Creates an autogenerated parameter description from a parameter name.
static int parameterAsEnum(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, const QgsProcessingContext &context)
Evaluates the parameter with matching definition to a enum value.
static double parameterAsDouble(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, const QgsProcessingContext &context)
Evaluates the parameter with matching definition to a static double value.
static QgsPointXY parameterAsPoint(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context, const QgsCoordinateReferenceSystem &crs=QgsCoordinateReferenceSystem())
Evaluates the parameter with matching definition to a point.
static QString parameterAsOutputLayer(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context)
Evaluates the parameter with matching definition to a output layer destination.
static QgsFeatureSink * parameterAsSink(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, const QgsFields &fields, Qgis::WkbType geometryType, const QgsCoordinateReferenceSystem &crs, QgsProcessingContext &context, QString &destinationIdentifier, QgsFeatureSink::SinkFlags sinkFlags=QgsFeatureSink::SinkFlags(), const QVariantMap &createOptions=QVariantMap(), const QStringList &datasourceOptions=QStringList(), const QStringList &layerOptions=QStringList())
Evaluates the parameter with matching definition to a feature sink.
static QgsPrintLayout * parameterAsLayout(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context)
Evaluates the parameter with matching definition to a print layout.
static QList< QgsMapLayer * > parameterAsLayerList(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context, QgsProcessing::LayerOptionsFlags flags=QgsProcessing::LayerOptionsFlags())
Evaluates the parameter with matching definition to a list of map layers.
static QTime parameterAsTime(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, const QgsProcessingContext &context)
Evaluates the parameter with matching definition to a static time value.
static QgsProcessingParameterDefinition * parameterFromVariantMap(const QVariantMap &map)
Creates a new QgsProcessingParameterDefinition using the configuration from a supplied variant map.
static QgsRectangle parameterAsExtent(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context, const QgsCoordinateReferenceSystem &crs=QgsCoordinateReferenceSystem())
Evaluates the parameter with matching definition to a rectangular extent.
static QgsCoordinateReferenceSystem parameterAsGeometryCrs(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context)
Returns the coordinate reference system associated with a geometry parameter value.
static QgsAnnotationLayer * parameterAsAnnotationLayer(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context)
Evaluates the parameter with matching definition to an annotation layer.
static QString parameterAsEnumString(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, const QgsProcessingContext &context)
Evaluates the parameter with matching definition to a static enum string.
static QList< double > parameterAsRange(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context)
Evaluates the parameter with matching definition to a range of values.
static QStringList parameterAsStrings(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context)
Evaluates the parameter with matching definition to a list of strings (e.g.
static QList< int > parameterAsInts(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, const QgsProcessingContext &context)
Evaluates the parameter with matching definition to a list of integer values.
static QString parameterAsConnectionName(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, const QgsProcessingContext &context)
Evaluates the parameter with matching definition to a connection name string.
static QgsProcessingFeatureSource * parameterAsSource(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context)
Evaluates the parameter with matching definition to a feature source.
static QString parameterAsFileOutput(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context)
Evaluates the parameter with matching definition to a file based output destination.
static bool parameterAsBoolean(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, const QgsProcessingContext &context)
Evaluates the parameter with matching definition to a static boolean value.
static QgsPointCloudLayer * parameterAsPointCloudLayer(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context, QgsProcessing::LayerOptionsFlags flags=QgsProcessing::LayerOptionsFlags())
Evaluates the parameter with matching definition to a point cloud layer.
static QgsCoordinateReferenceSystem parameterAsPointCrs(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context)
Returns the coordinate reference system associated with an point parameter value.
static QgsLayoutItem * parameterAsLayoutItem(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context, QgsPrintLayout *layout)
Evaluates the parameter with matching definition to a print layout item, taken from the specified lay...
static bool parameterAsBool(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, const QgsProcessingContext &context)
Evaluates the parameter with matching definition to a static boolean value.
static QString parameterAsCompatibleSourceLayerPathAndLayerName(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context, const QStringList &compatibleFormats, const QString &preferredFormat=QString("shp"), QgsProcessingFeedback *feedback=nullptr, QString *layerName=nullptr)
Evaluates the parameter with matching definition to a source vector layer file path and layer name of...
static QgsMeshLayer * parameterAsMeshLayer(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context)
Evaluates the parameter with matching definition and value to a mesh layer.
static QString parameterAsCompatibleSourceLayerPath(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context, const QStringList &compatibleFormats, const QString &preferredFormat=QString("shp"), QgsProcessingFeedback *feedback=nullptr)
Evaluates the parameter with matching definition to a source vector layer file path of compatible for...
static QgsProcessingParameterDefinition * parameterFromScriptCode(const QString &code)
Creates a new QgsProcessingParameterDefinition using the configuration from a supplied script code st...
static QColor parameterAsColor(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context)
Returns the color associated with an point parameter value, or an invalid color if the parameter was ...
static QgsVectorLayer * parameterAsVectorLayer(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context)
Evaluates the parameter with matching definition to a vector layer.
static QString parameterAsOutputFormat(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context)
Evaluates the parameter with matching definition to a output format.
static int parameterAsInt(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, const QgsProcessingContext &context)
Evaluates the parameter with matching definition to a static integer value.
static QString parameterAsDatabaseTableName(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, const QgsProcessingContext &context)
Evaluates the parameter with matching definition to a database table name.
static QString parameterAsSchema(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, const QgsProcessingContext &context)
Evaluates the parameter with matching definition to a database schema name.
static QgsGeometry parameterAsGeometry(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context, const QgsCoordinateReferenceSystem &crs=QgsCoordinateReferenceSystem())
Evaluates the parameter with matching definition to a geometry.
static QgsMapLayer * parameterAsLayer(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context, QgsProcessingUtils::LayerHint layerHint=QgsProcessingUtils::LayerHint::UnknownType, QgsProcessing::LayerOptionsFlags flags=QgsProcessing::LayerOptionsFlags())
Evaluates the parameter with matching definition to a map layer.
static QString parameterAsExpression(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, const QgsProcessingContext &context)
Evaluates the parameter with matching definition to an expression.
static QString parameterAsString(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, const QgsProcessingContext &context)
Evaluates the parameter with matching definition to a static string value.
static QgsRasterLayer * parameterAsRasterLayer(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context)
Evaluates the parameter with matching definition to a raster layer.
static QList< int > parameterAsEnums(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, const QgsProcessingContext &context)
Evaluates the parameter with matching definition to list of enum values.
static QStringList parameterAsEnumStrings(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, const QgsProcessingContext &context)
Evaluates the parameter with matching definition to list of static enum strings.
static QgsGeometry parameterAsExtentGeometry(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context, const QgsCoordinateReferenceSystem &crs=QgsCoordinateReferenceSystem())
Evaluates the parameter with matching definition to a rectangular extent, and returns a geometry cove...
static QStringList parameterAsFileList(const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context)
Evaluates the parameter with matching definition to a list of files (for QgsProcessingParameterMultip...
static bool isDynamic(const QVariantMap ¶meters, const QString &name)
Returns true if the parameter with matching name is a dynamic parameter, and must be evaluated once f...
static Q_DECL_DEPRECATED QStringList parameterAsFields(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context)
Evaluates the parameter with matching definition to a list of fields.
static QgsCoordinateReferenceSystem parameterAsExtentCrs(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context)
Returns the coordinate reference system associated with an extent parameter value.
static QDateTime parameterAsDateTime(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, const QgsProcessingContext &context)
Evaluates the parameter with matching definition to a static datetime value.
static QString parameterAsFile(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context)
Evaluates the parameter with matching definition to a file/folder name.
static QDate parameterAsDate(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, const QgsProcessingContext &context)
Evaluates the parameter with matching definition to a static date value.
static QVariantList parameterAsMatrix(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context)
Evaluates the parameter with matching definition to a matrix/table of values.
static QgsCoordinateReferenceSystem parameterAsCrs(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context)
Evaluates the parameter with matching definition to a coordinate reference system.
Abstract base class for processing providers.
virtual bool isSupportedOutputValue(const QVariant &outputValue, const QgsProcessingDestinationParameter *parameter, QgsProcessingContext &context, QString &error) const
Returns true if the specified outputValue is of a supported file format for the given destination par...
static QList< QPair< QString, QString > > supportedOutputRasterLayerFormatAndExtensionsDefault()
Returns a list of (format, file extension) supported by GDAL.
Encapsulates settings relating to a raster layer input to a processing algorithm.
double referenceScale
If set to a value > 0, sets a scale at which a raster (e.g., a WMS) should be requested or rendered.
int dpi
Indicates the resolution of the raster source (e.g., a WMS server).
QgsProperty source
Source definition.
bool loadVariant(const QVariantMap &map)
Loads this raster layer definition from a QVariantMap, wrapped in a QVariant.
QVariant toVariant() const
Saves this raster layer definition to a QVariantMap, wrapped in a QVariant.
QgsProcessingParameterType * parameterType(const QString &id) const
Returns the parameter type registered for id.
static QString stringToPythonLiteral(const QString &string)
Converts a string to a Python string literal.
static QString defaultVectorExtension()
Returns the default vector extension to use, in the absence of all other constraints (e....
static QString layerToStringIdentifier(const QgsMapLayer *layer, const QString &layerName=QString())
Returns a string representation of the source for a layer.
static QString generateTempFilename(const QString &basename, const QgsProcessingContext *context=nullptr)
Returns a temporary filename for a given file, putting it into a temporary folder (creating that fold...
static QString encodeProviderKeyAndUri(const QString &providerKey, const QString &uri)
Encodes a provider key and layer uri to a single string, for use with decodeProviderKeyAndUri().
LayerHint
Layer type hints.
@ Annotation
Annotation layer type, since QGIS 3.22.
@ Vector
Vector layer type.
@ VectorTile
Vector tile layer type, since QGIS 3.32.
@ Mesh
Mesh layer type, since QGIS 3.6.
@ Raster
Raster layer type.
@ UnknownType
Unknown layer type.
@ PointCloud
Point cloud layer type, since QGIS 3.22.
static QString defaultRasterFormat()
Returns the default raster format to use, in the absence of all other constraints (e....
static QgsProcessingFeatureSource * variantToSource(const QVariant &value, QgsProcessingContext &context, const QVariant &fallbackValue=QVariant())
Converts a variant value to a new feature source.
static QString variantToPythonLiteral(const QVariant &value)
Converts a variant to a Python literal.
static QgsCoordinateReferenceSystem variantToCrs(const QVariant &value, QgsProcessingContext &context, const QVariant &fallbackValue=QVariant())
Converts a variant value to a coordinate reference system.
static QString convertToCompatibleFormatAndLayerName(const QgsVectorLayer *layer, bool selectedFeaturesOnly, const QString &baseName, const QStringList &compatibleFormats, const QString &preferredFormat, QgsProcessingContext &context, QgsProcessingFeedback *feedback, QString &layerName, long long featureLimit=-1, const QString &filterExpression=QString())
Converts a source vector layer to a file path and layer name of a vector layer of compatible format.
static QString convertToCompatibleFormat(const QgsVectorLayer *layer, bool selectedFeaturesOnly, const QString &baseName, const QStringList &compatibleFormats, const QString &preferredFormat, QgsProcessingContext &context, QgsProcessingFeedback *feedback, long long featureLimit=-1, const QString &filterExpression=QString())
Converts a source vector layer to a file path of a vector layer of compatible format.
static QgsFeatureSink * createFeatureSink(QString &destination, QgsProcessingContext &context, const QgsFields &fields, Qgis::WkbType geometryType, const QgsCoordinateReferenceSystem &crs, const QVariantMap &createOptions=QVariantMap(), const QStringList &datasourceOptions=QStringList(), const QStringList &layerOptions=QStringList(), QgsFeatureSink::SinkFlags sinkFlags=QgsFeatureSink::SinkFlags(), QgsRemappingSinkDefinition *remappingDefinition=nullptr)
Creates a feature sink ready for adding features.
static QString defaultVectorTileExtension()
Returns the default vector tile extension to use, in the absence of all other constraints (e....
static QgsMapLayer * mapLayerFromString(const QString &string, QgsProcessingContext &context, bool allowLoadingNewLayers=true, QgsProcessingUtils::LayerHint typeHint=QgsProcessingUtils::LayerHint::UnknownType, QgsProcessing::LayerOptionsFlags flags=QgsProcessing::LayerOptionsFlags())
Interprets a string as a map layer within the supplied context.
static QString defaultPointCloudExtension()
Returns the default point cloud extension to use, in the absence of all other constraints (e....
QFlags< LayerOptionsFlag > LayerOptionsFlags
static const QString TEMPORARY_OUTPUT
Constant used to indicate that a Processing algorithm output should be a temporary layer/file.
static const QgsSettingsEntryVariant * settingsDefaultGuiParam
Settings entry default GUI parameter value (per algorithm id and parameter name).
PythonOutputType
Available Python output types.
@ PythonQgsProcessingAlgorithmSubclass
Full Python QgsProcessingAlgorithm subclass.
static QString sourceTypeToString(Qgis::ProcessingSourceType type)
Converts a source type to a string representation.
@ SkipIndexGeneration
Do not generate index when creating a layer. Makes sense only for point cloud layers.
Encapsulates a QGIS project, including sets of map layers and their styles, layouts,...
QgsAnnotationLayer * mainAnnotationLayer()
Returns the main annotation layer associated with the project.
const QgsLayoutManager * layoutManager() const
Returns the project's layout manager, which manages print layouts, atlases and reports within the pro...
A store for object properties.
QString asExpression() const
Returns an expression string representing the state of the property, or an empty string if the proper...
QString expressionString() const
Returns the expression used for the property value.
Qgis::PropertyType propertyType() const
Returns the property type.
QString valueAsString(const QgsExpressionContext &context, const QString &defaultString=QString(), bool *ok=nullptr) const
Calculates the current value of the property and interprets it as a string.
QString field() const
Returns the current field name the property references.
QVariant value(const QgsExpressionContext &context, const QVariant &defaultValue=QVariant(), bool *ok=nullptr) const
Calculates the current value of the property, including any transforms which are set for the property...
QVariant staticValue() const
Returns the current static value for the property.
static QgsProviderRegistry * instance(const QString &pluginPath=QString())
Means of accessing canonical single instance.
QString fileVectorFilters() const
Returns a file filter string for supported vector files.
QString fileRasterFilters() const
Returns a file filter string for supported raster files.
QString fileMeshFilters() const
Returns a file filter string for supported mesh files.
QString filePointCloudFilters() const
Returns a file filter string for supported point clouds.
static QStringList extensionsForFormat(const QString &format)
Returns a list of known file extensions for the given GDAL driver format.
Represents a raster layer.
A rectangle specified with double values.
QgsCoordinateReferenceSystem crs() const
Returns the associated coordinate reference system, or an invalid CRS if no reference system is set.
A QgsGeometry with associated coordinate reference system.
static QgsReferencedGeometry fromReferencedPointXY(const QgsReferencedPointXY &point)
Construct a new QgsReferencedGeometry from referenced point.
static QgsReferencedGeometry fromReferencedRect(const QgsReferencedRectangle &rectangle)
Construct a new QgsReferencedGeometry from referenced rectangle.
A QgsPointXY with associated coordinate reference system.
A QgsRectangle with associated coordinate reference system.
Defines the parameters used to remap features when creating a QgsRemappingProxyFeatureSink.
static QColor parseColorWithAlpha(const QString &colorStr, bool &containsAlpha, bool strictEval=false)
Attempts to parse a string as a color using a variety of common formats, including hex codes,...
static Q_INVOKABLE QString toAbbreviatedString(Qgis::DistanceUnit unit)
Returns a translated abbreviation representing a distance unit.
static bool isNull(const QVariant &variant, bool silenceNullWarnings=false)
Returns true if the specified variant should be considered a NULL value.
static QStringList supportedFormatExtensions(VectorFormatOptions options=SortRecommended)
Returns a list of file extensions for supported formats, e.g "shp", "gpkg".
Represents a vector layer which manages a vector based dataset.
static Q_INVOKABLE QString geometryDisplayString(Qgis::GeometryType type)
Returns a display string for a geometry type.
As part of the API refactoring and improvements which landed in the Processing API was substantially reworked from the x version This was done in order to allow much of the underlying Processing framework to be ported into c
T qgsEnumKeyToValue(const QString &key, const T &defaultValue, bool tryValueAsKey=true, bool *returnOk=nullptr)
Returns the value corresponding to the given key of an enum.
QString qgsDoubleToString(double a, int precision=17)
Returns a string representation of a double.
QString qgsEnumValueToKey(const T &value, bool *returnOk=nullptr)
Returns the value for the given key of an enum.
#define QgsDebugError(str)
QString parameterAsCompatibleSourceLayerPathInternal(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context, const QStringList &compatibleFormats, const QString &preferredFormat, QgsProcessingFeedback *feedback, QString *layerName)
QString createAllMapLayerFileFilter()