41#include <QRegularExpression>
49 map.insert( QStringLiteral(
"feature_limit" ),
featureLimit );
50 map.insert( QStringLiteral(
"flags" ),
static_cast< int >(
flags ) );
51 map.insert( QStringLiteral(
"geometry_check" ),
static_cast< int >(
geometryCheck ) );
59 featureLimit = map.value( QStringLiteral(
"feature_limit" ), -1 ).toLongLong();
60 flags =
static_cast< Flags
>( map.value( QStringLiteral(
"flags" ), 0 ).toInt() );
73 mRemappingDefinition = definition;
80 map.insert( QStringLiteral(
"create_options" ),
createOptions );
82 map.insert( QStringLiteral(
"remapping" ), QVariant::fromValue( mRemappingDefinition ) );
89 createOptions = map.value( QStringLiteral(
"create_options" ) ).toMap();
90 if ( map.contains( QStringLiteral(
"remapping" ) ) )
97 mUseRemapping =
false;
105 && mUseRemapping == other.mUseRemapping && mRemappingDefinition == other.mRemappingDefinition;
110 return !( *
this == other );
115 const QVariant val = parameters.value( name );
116 if ( val.userType() == QMetaType::type(
"QgsProperty" ) )
135 QVariant val = value;
136 if ( val.userType() == QMetaType::type(
"QgsProperty" ) )
139 if ( !val.isValid() )
148 return destParam->generateTemporaryDestination();
151 return val.toString();
167 const QVariant val = value;
168 if ( val.userType() == QMetaType::type(
"QgsProperty" ) )
171 if ( val.isValid() && !val.toString().isEmpty() )
175 return val.toString();
195 QVariant val = value;
196 if ( val.userType() == QMetaType::type(
"QgsProperty" ) )
200 const double res = val.toDouble( &ok );
206 return val.toDouble();
222 QVariant val = value;
223 if ( val.userType() == QMetaType::type(
"QgsProperty" ) )
227 double dbl = val.toDouble( &ok );
232 dbl = val.toDouble( &ok );
239 const double round = std::round( dbl );
240 if ( round > std::numeric_limits<int>::max() || round < -std::numeric_limits<int>::max() )
245 return static_cast< int >( std::round( dbl ) );
254 return QList< int >();
262 return QList< int >();
264 QList< int > resultList;
265 const QVariant val = value;
268 if ( val.userType() == QMetaType::type(
"QgsProperty" ) )
270 else if ( val.type() == QVariant::List )
272 const QVariantList list = val.toList();
273 for (
auto it = list.constBegin(); it != list.constEnd(); ++it )
274 resultList << it->toInt();
278 const QStringList parts = val.toString().split(
';' );
279 for (
auto it = parts.constBegin(); it != parts.constEnd(); ++it )
280 resultList << it->toInt();
284 if ( resultList.isEmpty() )
289 if ( definition->
defaultValue().type() == QVariant::List )
291 const QVariantList list = definition->
defaultValue().toList();
292 for (
auto it = list.constBegin(); it != list.constEnd(); ++it )
293 resultList << it->toInt();
297 const QStringList parts = definition->
defaultValue().toString().split(
';' );
298 for (
auto it = parts.constBegin(); it != parts.constEnd(); ++it )
299 resultList << it->toInt();
320 QVariant val = value;
321 if ( val.userType() == QMetaType::type(
"QgsProperty" ) )
324 QDateTime d = val.toDateTime();
325 if ( !d.isValid() && val.type() == QVariant::String )
327 d = QDateTime::fromString( val.toString() );
334 d = val.toDateTime();
336 if ( !d.isValid() && val.type() == QVariant::String )
338 d = QDateTime::fromString( val.toString() );
357 QVariant val = value;
358 if ( val.userType() == QMetaType::type(
"QgsProperty" ) )
361 QDate d = val.toDate();
362 if ( !d.isValid() && val.type() == QVariant::String )
364 d = QDate::fromString( val.toString() );
373 if ( !d.isValid() && val.type() == QVariant::String )
375 d = QDate::fromString( val.toString() );
394 QVariant val = value;
395 if ( val.userType() == QMetaType::type(
"QgsProperty" ) )
400 if ( val.type() == QVariant::DateTime )
401 d = val.toDateTime().time();
405 if ( !d.isValid() && val.type() == QVariant::String )
407 d = QTime::fromString( val.toString() );
416 if ( !d.isValid() && val.type() == QVariant::String )
418 d = QTime::fromString( val.toString() );
439 if ( enumDef && val >= enumDef->
options().size() )
459 QVariantList resultList;
460 const QVariant val = value;
461 if ( val.userType() == QMetaType::type(
"QgsProperty" ) )
463 else if ( val.type() == QVariant::List )
465 const auto constToList = val.toList();
466 for (
const QVariant &var : constToList )
469 else if ( val.type() == QVariant::String )
471 const auto constSplit = val.toString().split(
',' );
472 for (
const QString &var : constSplit )
478 if ( resultList.isEmpty() )
479 return QList< int >();
481 if ( ( !val.isValid() || !resultList.at( 0 ).isValid() ) && definition )
485 if ( definition->
defaultValue().type() == QVariant::List )
487 const auto constToList = definition->
defaultValue().toList();
488 for (
const QVariant &var : constToList )
491 else if ( definition->
defaultValue().type() == QVariant::String )
493 const auto constSplit = definition->
defaultValue().toString().split(
',' );
494 for (
const QString &var : constSplit )
503 const auto constResultList = resultList;
504 for (
const QVariant &var : constResultList )
506 const int resInt = var.toInt();
507 if ( !enumDef || resInt < enumDef->options().size() )
530 if ( enumText.isEmpty() || !enumDef->
options().contains( enumText ) )
539 return QStringList();
547 return QStringList();
549 const QVariant val = value;
551 QStringList enumValues;
553 std::function< void(
const QVariant &var ) > processVariant;
554 processVariant = [ &enumValues, &context, &definition, &processVariant ](
const QVariant & var )
556 if ( var.type() == QVariant::List )
558 const auto constToList = var.toList();
559 for (
const QVariant &listVar : constToList )
561 processVariant( listVar );
564 else if ( var.type() == QVariant::StringList )
566 const auto constToStringList = var.toStringList();
567 for (
const QString &s : constToStringList )
572 else if ( var.userType() == QMetaType::type(
"QgsProperty" ) )
576 const QStringList parts = var.toString().split(
',' );
577 for (
const QString &s : parts )
584 processVariant( val );
590 const QStringList options = enumDef->
options();
591 const QSet<QString> subtraction = QSet<QString>( enumValues.begin(), enumValues.end() ).subtract( QSet<QString>( options.begin(), options.end() ) );
593 if ( enumValues.isEmpty() || !subtraction.isEmpty() )
625 const QVariant val = value;
626 if ( val.userType() == QMetaType::type(
"QgsProperty" ) )
628 else if ( val.isValid() )
641 const QVariant val = value;
642 if ( val.userType() == QMetaType::type(
"QgsProperty" ) )
644 else if ( val.isValid() )
652 QgsProcessingContext &context, QString &destinationIdentifier, QgsFeatureSink::SinkFlags sinkFlags,
653 const QVariantMap &createOptions,
const QStringList &datasourceOptions,
const QStringList &layerOptions )
658 val = parameters.value( definition->
name() );
661 return parameterAsSink( definition, val, fields, geometryType,
crs, context, destinationIdentifier, sinkFlags, createOptions, datasourceOptions, layerOptions );
664QgsFeatureSink *
QgsProcessingParameters::parameterAsSink(
const QgsProcessingParameterDefinition *definition,
const QVariant &value,
const QgsFields &fields,
Qgis::WkbType geometryType,
const QgsCoordinateReferenceSystem &
crs,
QgsProcessingContext &context, QString &destinationIdentifier, QgsFeatureSink::SinkFlags sinkFlags,
const QVariantMap &createOptions,
const QStringList &datasourceOptions,
const QStringList &layerOptions )
666 QVariantMap options = createOptions;
667 QVariant val = value;
672 bool useRemapDefinition =
false;
673 if ( val.userType() == QMetaType::type(
"QgsProcessingOutputLayerDefinition" ) )
684 useRemapDefinition =
true;
690 if ( definition && val.userType() == QMetaType::type(
"QgsProperty" ) )
694 else if ( !val.isValid() || val.toString().isEmpty() )
710 dest = val.toString();
715 dest = destParam->generateTemporaryDestination();
718 if ( dest.isEmpty() )
721 std::unique_ptr< QgsFeatureSink > sink(
QgsProcessingUtils::createFeatureSink( dest, context, fields, geometryType,
crs, options, datasourceOptions, layerOptions, sinkFlags, useRemapDefinition ? &remapDefinition :
nullptr ) );
722 destinationIdentifier = dest;
724 if ( destinationProject )
726 if ( destName.isEmpty() && definition )
732 outputName = definition->
name();
736 return sink.release();
760 QVariant val = parameters.value( definition->
name() );
762 bool selectedFeaturesOnly =
false;
763 long long featureLimit = -1;
764 if ( val.userType() == QMetaType::type(
"QgsProcessingFeatureSourceDefinition" ) )
772 else if ( val.userType() == QMetaType::type(
"QgsProcessingOutputLayerDefinition" ) )
779 if ( val.userType() == QMetaType::type(
"QgsProperty" ) )
785 vl = qobject_cast< QgsVectorLayer * >( qvariant_cast<QObject *>( val ) );
790 if ( val.userType() == QMetaType::type(
"QgsProperty" ) )
794 else if ( !val.isValid() || val.toString().isEmpty() )
800 vl = qobject_cast< QgsVectorLayer * >( qvariant_cast<QObject *>( val ) );
806 layerRef = val.toString();
811 if ( layerRef.isEmpty() )
823 compatibleFormats, preferredFormat, context, feedback, *layerName, featureLimit );
826 compatibleFormats, preferredFormat, context, feedback, featureLimit );
836 QString *destLayer = layerName;
851 return parameterAsLayer( definition, parameters.value( definition->
name() ), context, layerHint );
859 QVariant val = value;
860 if ( val.userType() == QMetaType::type(
"QgsProperty" ) )
865 if (
QgsMapLayer *layer = qobject_cast< QgsMapLayer * >( qvariant_cast<QObject *>( val ) ) )
870 if ( val.userType() == QMetaType::type(
"QgsProcessingOutputLayerDefinition" ) )
882 if ( !val.isValid() || val.toString().isEmpty() )
888 if (
QgsMapLayer *layer = qobject_cast< QgsMapLayer * >( qvariant_cast<QObject *>( val ) ) )
893 QString layerRef = val.toString();
894 if ( layerRef.isEmpty() )
897 if ( layerRef.isEmpty() )
928 val = parameters.value( definition->
name() );
935 QVariant val = value;
939 if ( val.userType() == QMetaType::type(
"QgsProcessingOutputLayerDefinition" ) )
949 if ( definition && val.userType() == QMetaType::type(
"QgsProperty" ) )
953 else if ( definition && ( !val.isValid() || val.toString().isEmpty() ) )
960 dest = val.toString();
965 dest = destParam->generateTemporaryDestination();
968 if ( destinationProject )
971 if ( destName.isEmpty() && definition )
976 outputName = definition->
name();
997 val = parameters.value( definition->
name() );
1004 QVariant val = value;
1006 if ( val.userType() == QMetaType::type(
"QgsProcessingOutputLayerDefinition" ) )
1014 if ( definition && val.userType() == QMetaType::type(
"QgsProperty" ) )
1018 else if ( definition && ( !val.isValid() || val.toString().isEmpty() ) )
1025 dest = val.toString();
1030 dest = destParam->generateTemporaryDestination();
1050 return parameterAsCrs( definition, parameters.value( definition->
name() ), context );
1075 QVariant val = value;
1077 if ( val.userType() == QMetaType::type(
"QgsRectangle" ) )
1081 if ( val.userType() == QMetaType::type(
"QgsGeometry" ) )
1087 if ( val.userType() == QMetaType::type(
"QgsReferencedRectangle" ) )
1106 if ( val.userType() == QMetaType::type(
"QgsProcessingFeatureSourceDefinition" ) )
1112 else if ( val.userType() == QMetaType::type(
"QgsProcessingOutputLayerDefinition" ) )
1125 QgsMapLayer *layer = qobject_cast< QgsMapLayer * >( qvariant_cast<QObject *>( val ) );
1128 if ( val.userType() == QMetaType::type(
"QgsProperty" ) )
1131 rectText = val.toString();
1133 if ( rectText.isEmpty() && !layer )
1136 const QRegularExpression rx( QStringLiteral(
"^(.*?)\\s*,\\s*(.*?),\\s*(.*?),\\s*(.*?)\\s*(?:\\[(.*)\\])?\\s*$" ) );
1137 const QRegularExpressionMatch match = rx.match( rectText );
1138 if ( match.hasMatch() )
1140 bool xMinOk =
false;
1141 const double xMin = match.captured( 1 ).toDouble( &xMinOk );
1142 bool xMaxOk =
false;
1143 const double xMax = match.captured( 2 ).toDouble( &xMaxOk );
1144 bool yMinOk =
false;
1145 const double yMin = match.captured( 3 ).toDouble( &yMinOk );
1146 bool yMaxOk =
false;
1147 const double yMax = match.captured( 4 ).toDouble( &yMaxOk );
1148 if ( xMinOk && xMaxOk && yMinOk && yMaxOk )
1199 QVariant val = parameters.value( definition->
name() );
1201 if ( val.userType() == QMetaType::type(
"QgsReferencedRectangle" ) )
1207 g = g.densifyByCount( 20 );
1221 if ( val.userType() == QMetaType::type(
"QgsProcessingFeatureSourceDefinition" ) )
1227 else if ( val.userType() == QMetaType::type(
"QgsProcessingOutputLayerDefinition" ) )
1240 if ( val.userType() == QMetaType::type(
"QgsProperty" ) )
1243 rectText = val.toString();
1245 if ( !rectText.isEmpty() )
1247 const QRegularExpression rx( QStringLiteral(
"^(.*?)\\s*,\\s*(.*?),\\s*(.*?),\\s*(.*?)\\s*(?:\\[(.*)\\])?\\s*$" ) );
1248 const QRegularExpressionMatch match = rx.match( rectText );
1249 if ( match.hasMatch() )
1251 bool xMinOk =
false;
1252 const double xMin = match.captured( 1 ).toDouble( &xMinOk );
1253 bool xMaxOk =
false;
1254 const double xMax = match.captured( 2 ).toDouble( &xMaxOk );
1255 bool yMinOk =
false;
1256 const double yMin = match.captured( 3 ).toDouble( &yMinOk );
1257 bool yMaxOk =
false;
1258 const double yMax = match.captured( 4 ).toDouble( &yMaxOk );
1259 if ( xMinOk && xMaxOk && yMinOk && yMaxOk )
1285 QgsMapLayer *layer = qobject_cast< QgsMapLayer * >( qvariant_cast<QObject *>( val ) );
1314 const QVariant val = parameters.value( definition->
name() );
1320 QVariant val = value;
1321 if ( val.userType() == QMetaType::type(
"QgsReferencedRectangle" ) )
1330 if ( val.userType() == QMetaType::type(
"QgsProcessingFeatureSourceDefinition" ) )
1336 else if ( val.userType() == QMetaType::type(
"QgsProcessingOutputLayerDefinition" ) )
1348 QString valueAsString;
1349 if ( val.userType() == QMetaType::type(
"QgsProperty" ) )
1352 valueAsString = val.toString();
1354 const QRegularExpression rx( QStringLiteral(
"^(.*?)\\s*,\\s*(.*?),\\s*(.*?),\\s*(.*?)\\s*(?:\\[(.*)\\])?\\s*$" ) );
1356 const QRegularExpressionMatch match = rx.match( valueAsString );
1357 if ( match.hasMatch() )
1364 if ( val.userType() == QMetaType::type(
"QgsProcessingFeatureSourceDefinition" ) )
1370 else if ( val.userType() == QMetaType::type(
"QgsProcessingOutputLayerDefinition" ) )
1383 if (
QgsMapLayer *layer = qobject_cast< QgsMapLayer * >( qvariant_cast<QObject *>( val ) ) )
1384 return layer->crs();
1386 return layer->crs();
1388 if (
auto *lProject = context.
project() )
1389 return lProject->crs();
1407 const QVariant val = value;
1408 if ( val.userType() == QMetaType::type(
"QgsPointXY" ) )
1412 if ( val.userType() == QMetaType::type(
"QgsGeometry" ) )
1418 if ( val.userType() == QMetaType::type(
"QgsReferencedPointXY" ) )
1437 if ( pointText.isEmpty() )
1440 if ( pointText.isEmpty() )
1443 const QRegularExpression rx( QStringLiteral(
"^\\s*\\(?\\s*(.*?)\\s*,\\s*(.*?)\\s*(?:\\[(.*)\\])?\\s*\\)?\\s*$" ) );
1446 const QRegularExpressionMatch match = rx.match( valueAsString );
1447 if ( match.hasMatch() )
1450 const double x = match.captured( 1 ).toDouble( &xOk );
1452 const double y = match.captured( 2 ).toDouble( &yOk );
1480 const QVariant val = parameters.value( definition->
name() );
1486 if ( value.userType() == QMetaType::type(
"QgsReferencedPointXY" ) )
1495 const QRegularExpression rx( QStringLiteral(
"^\\s*\\(?\\s*(.*?)\\s*,\\s*(.*?)\\s*(?:\\[(.*)\\])?\\s*\\)?\\s*$" ) );
1498 const QRegularExpressionMatch match = rx.match( valueAsString );
1499 if ( match.hasMatch() )
1506 if (
auto *lProject = context.
project() )
1507 return lProject->crs();
1525 const QVariant val = value;
1526 if ( val.userType() == QMetaType::type(
"QgsGeometry" ) )
1531 if ( val.userType() == QMetaType::type(
"QgsPointXY" ) )
1536 if ( val.userType() == QMetaType::type(
"QgsRectangle" ) )
1541 if ( val.userType() == QMetaType::type(
"QgsReferencedPointXY" ) )
1559 if ( val.userType() == QMetaType::type(
"QgsReferencedRectangle" ) )
1565 g = g.densifyByCount( 20 );
1579 if ( val.userType() == QMetaType::type(
"QgsReferencedGeometry" ) )
1598 if ( valueAsString.isEmpty() )
1601 if ( valueAsString.isEmpty() )
1604 const QRegularExpression rx( QStringLiteral(
"^\\s*(?:CRS=(.*);)?(.*?)$" ) );
1606 const QRegularExpressionMatch match = rx.match( valueAsString );
1607 if ( match.hasMatch() )
1634 const QVariant val = parameters.value( definition->
name() );
1640 if ( value.userType() == QMetaType::type(
"QgsReferencedGeometry" ) )
1649 if ( value.userType() == QMetaType::type(
"QgsReferencedPointXY" ) )
1658 if ( value.userType() == QMetaType::type(
"QgsReferencedRectangle" ) )
1668 const QRegularExpression rx( QStringLiteral(
"^\\s*(?:CRS=(.*);)?(.*?)$" ) );
1671 const QRegularExpressionMatch match = rx.match( valueAsString );
1672 if ( match.hasMatch() )
1679 if (
auto *lProject = context.
project() )
1680 return lProject->crs();
1691 if ( fileText.isEmpty() )
1702 if ( fileText.isEmpty() )
1710 return QVariantList();
1718 return QVariantList();
1720 QString resultString;
1721 const QVariant val = value;
1722 if ( val.userType() == QMetaType::type(
"QgsProperty" ) )
1724 else if ( val.type() == QVariant::List )
1725 return val.toList();
1727 resultString = val.toString();
1729 if ( resultString.isEmpty() )
1732 if ( definition->
defaultValue().type() == QVariant::List )
1738 QVariantList result;
1739 const auto constSplit = resultString.split(
',' );
1742 for (
const QString &s : constSplit )
1744 number = s.toDouble( &ok );
1745 result << ( ok ? QVariant( number ) : s );
1754 return QList<QgsMapLayer *>();
1762 return QList<QgsMapLayer *>();
1764 const QVariant val = value;
1765 if (
QgsMapLayer *layer = qobject_cast< QgsMapLayer * >( qvariant_cast<QObject *>( val ) ) )
1767 return QList<QgsMapLayer *>() << layer;
1770 QList<QgsMapLayer *> layers;
1772 std::function< void(
const QVariant &var ) > processVariant;
1773 processVariant = [ &layers, &context, &definition, &processVariant ](
const QVariant & var )
1775 if ( var.type() == QVariant::List )
1777 const auto constToList = var.toList();
1778 for (
const QVariant &listVar : constToList )
1780 processVariant( listVar );
1783 else if ( var.type() == QVariant::StringList )
1785 const auto constToStringList = var.toStringList();
1786 for (
const QString &s : constToStringList )
1788 processVariant( s );
1791 else if ( var.userType() == QMetaType::type(
"QgsProperty" ) )
1793 else if ( var.userType() == QMetaType::type(
"QgsProcessingOutputLayerDefinition" ) )
1797 const QVariant sink = fromVar.
sink;
1798 if ( sink.userType() == QMetaType::type(
"QgsProperty" ) )
1803 else if (
QgsMapLayer *layer = qobject_cast< QgsMapLayer * >( qvariant_cast<QObject *>( var ) ) )
1815 processVariant( val );
1817 if ( layers.isEmpty() )
1820 if (
QgsMapLayer *layer = qobject_cast< QgsMapLayer * >( qvariant_cast<QObject *>( definition->
defaultValue() ) ) )
1824 else if ( definition->
defaultValue().type() == QVariant::List )
1826 const auto constToList = definition->
defaultValue().toList();
1827 for (
const QVariant &var : constToList )
1829 if (
QgsMapLayer *layer = qobject_cast< QgsMapLayer * >( qvariant_cast<QObject *>( var ) ) )
1835 processVariant( var );
1849 return QStringList();
1851 const QVariant val = value;
1855 std::function< void(
const QVariant &var ) > processVariant;
1856 processVariant = [ &files, &context, &definition, &processVariant ](
const QVariant & var )
1858 if ( var.type() == QVariant::List )
1860 const auto constToList = var.toList();
1861 for (
const QVariant &listVar : constToList )
1863 processVariant( listVar );
1866 else if ( var.type() == QVariant::StringList )
1868 const auto constToStringList = var.toStringList();
1869 for (
const QString &s : constToStringList )
1871 processVariant( s );
1874 else if ( var.userType() == QMetaType::type(
"QgsProperty" ) )
1878 files << var.toString();
1882 processVariant( val );
1884 if ( files.isEmpty() )
1895 return QStringList();
1903 return QList<double>();
1911 return QList<double>();
1913 QStringList resultStringList;
1914 const QVariant val = value;
1916 if ( val.userType() == QMetaType::type(
"QgsProperty" ) )
1918 else if ( val.type() == QVariant::List )
1920 const auto constToList = val.toList();
1921 for (
const QVariant &var : constToList )
1922 resultStringList << var.toString();
1925 resultStringList << val.toString();
1927 if ( ( resultStringList.isEmpty() || ( resultStringList.size() == 1 && resultStringList.at( 0 ).isEmpty() ) ) )
1929 resultStringList.clear();
1931 if ( definition->
defaultValue().type() == QVariant::List )
1933 const auto constToList = definition->
defaultValue().toList();
1934 for (
const QVariant &var : constToList )
1935 resultStringList << var.toString();
1938 resultStringList << definition->
defaultValue().toString();
1941 if ( resultStringList.size() == 1 )
1943 resultStringList = resultStringList.at( 0 ).split(
',' );
1946 if ( resultStringList.size() < 2 )
1947 return QList< double >() << std::numeric_limits<double>::quiet_NaN() << std::numeric_limits<double>::quiet_NaN() ;
1949 QList< double > result;
1951 double n = resultStringList.at( 0 ).toDouble( &ok );
1955 result << std::numeric_limits<double>::quiet_NaN() ;
1957 n = resultStringList.at( 1 ).toDouble( &ok );
1961 result << std::numeric_limits<double>::quiet_NaN() ;
1969 return QStringList();
1977 return QStringList();
1979 QStringList resultStringList;
1980 const QVariant val = value;
1981 if ( val.isValid() )
1983 if ( val.userType() == QMetaType::type(
"QgsProperty" ) )
1985 else if ( val.type() == QVariant::List )
1987 const auto constToList = val.toList();
1988 for (
const QVariant &var : constToList )
1989 resultStringList << var.toString();
1991 else if ( val.type() == QVariant::StringList )
1993 resultStringList = val.toStringList();
1996 resultStringList.append( val.toString().split(
';' ) );
1999 if ( ( resultStringList.isEmpty() || resultStringList.at( 0 ).isEmpty() ) )
2001 resultStringList.clear();
2005 if ( definition->
defaultValue().type() == QVariant::List )
2007 const auto constToList = definition->
defaultValue().toList();
2008 for (
const QVariant &var : constToList )
2009 resultStringList << var.toString();
2011 else if ( definition->
defaultValue().type() == QVariant::StringList )
2013 resultStringList = definition->
defaultValue().toStringList();
2016 resultStringList.append( definition->
defaultValue().toString().split(
';' ) );
2020 return resultStringList;
2034 if ( layoutName.isEmpty() )
2086 QVariant val = value;
2087 if ( val.userType() == QMetaType::type(
"QgsProperty" ) )
2091 if ( val.type() == QVariant::Color )
2093 QColor
c = val.value< QColor >();
2095 if ( !colorParam->opacityEnabled() )
2103 if ( definition->
defaultValue().type() == QVariant::Color )
2109 if ( colorText.isEmpty() )
2112 bool containsAlpha =
false;
2115 if (
c.isValid() && !colorParam->opacityEnabled() )
2187 const QString type = map.value( QStringLiteral(
"parameter_type" ) ).toString();
2188 const QString name = map.value( QStringLiteral(
"name" ) ).toString();
2189 std::unique_ptr< QgsProcessingParameterDefinition > def;
2262 def.reset( paramType->
create( name ) );
2268 def->fromVariantMap( map );
2269 return def.release();
2274 QString desc = name;
2275 desc.replace(
'_',
' ' );
2281 bool isOptional =
false;
2285 if ( !parseScriptCodeParameterOptions( code, isOptional, name, type, definition ) )
2290 if ( type == QLatin1String(
"boolean" ) )
2292 else if ( type == QLatin1String(
"crs" ) )
2294 else if ( type == QLatin1String(
"layer" ) )
2296 else if ( type == QLatin1String(
"extent" ) )
2298 else if ( type == QLatin1String(
"point" ) )
2300 else if ( type == QLatin1String(
"geometry" ) )
2302 else if ( type == QLatin1String(
"file" ) )
2304 else if ( type == QLatin1String(
"folder" ) )
2306 else if ( type == QLatin1String(
"matrix" ) )
2308 else if ( type == QLatin1String(
"multiple" ) )
2310 else if ( type == QLatin1String(
"number" ) )
2312 else if ( type == QLatin1String(
"distance" ) )
2314 else if ( type == QLatin1String(
"duration" ) )
2316 else if ( type == QLatin1String(
"scale" ) )
2318 else if ( type == QLatin1String(
"range" ) )
2320 else if ( type == QLatin1String(
"raster" ) )
2322 else if ( type == QLatin1String(
"enum" ) )
2324 else if ( type == QLatin1String(
"string" ) )
2326 else if ( type == QLatin1String(
"authcfg" ) )
2328 else if ( type == QLatin1String(
"expression" ) )
2330 else if ( type == QLatin1String(
"field" ) )
2332 else if ( type == QLatin1String(
"vector" ) )
2334 else if ( type == QLatin1String(
"source" ) )
2336 else if ( type == QLatin1String(
"sink" ) )
2338 else if ( type == QLatin1String(
"vectordestination" ) )
2340 else if ( type == QLatin1String(
"rasterdestination" ) )
2342 else if ( type == QLatin1String(
"pointclouddestination" ) )
2344 else if ( type == QLatin1String(
"filedestination" ) )
2346 else if ( type == QLatin1String(
"folderdestination" ) )
2348 else if ( type == QLatin1String(
"band" ) )
2350 else if ( type == QLatin1String(
"mesh" ) )
2352 else if ( type == QLatin1String(
"layout" ) )
2354 else if ( type == QLatin1String(
"layoutitem" ) )
2356 else if ( type == QLatin1String(
"color" ) )
2358 else if ( type == QLatin1String(
"coordinateoperation" ) )
2360 else if ( type == QLatin1String(
"maptheme" ) )
2362 else if ( type == QLatin1String(
"datetime" ) )
2364 else if ( type == QLatin1String(
"providerconnection" ) )
2366 else if ( type == QLatin1String(
"databaseschema" ) )
2368 else if ( type == QLatin1String(
"databasetable" ) )
2370 else if ( type == QLatin1String(
"pointcloud" ) )
2372 else if ( type == QLatin1String(
"annotation" ) )
2378bool QgsProcessingParameters::parseScriptCodeParameterOptions(
const QString &code,
bool &isOptional, QString &name, QString &type, QString &definition )
2380 const QRegularExpression re( QStringLiteral(
"(?:#*)(.*?)=\\s*(.*)" ) );
2381 QRegularExpressionMatch m = re.match( code );
2382 if ( !m.hasMatch() )
2385 name = m.captured( 1 );
2386 QString tokens = m.captured( 2 );
2387 if ( tokens.startsWith( QLatin1String(
"optional" ), Qt::CaseInsensitive ) )
2390 tokens.remove( 0, 8 );
2397 tokens = tokens.trimmed();
2399 const QRegularExpression re2( QStringLiteral(
"(.*?)\\s+(.*)" ) );
2400 m = re2.match( tokens );
2401 if ( !m.hasMatch() )
2403 type = tokens.toLower().trimmed();
2408 type = m.captured( 1 ).toLower().trimmed();
2409 definition = m.captured( 2 );
2420 , mDescription( description )
2422 , mDefault( defaultValue )
2423 , mFlags( optional ? FlagOptional : 0 )
2428 if ( !input.isValid() && !
mDefault.isValid() )
2431 if ( ( input.type() == QVariant::String && input.toString().isEmpty() )
2432 || ( !input.isValid() &&
mDefault.type() == QVariant::String &&
mDefault.toString().isEmpty() ) )
2440 if ( !value.isValid() )
2441 return QStringLiteral(
"None" );
2443 if ( value.userType() == QMetaType::type(
"QgsProperty" ) )
2444 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( value.value<
QgsProperty >().
asExpression() );
2456 if ( !value.isValid() )
2460 if ( value.type() == QVariant::Type::Map )
2462 const QVariantMap sourceMap = value.toMap();
2463 QVariantMap resultMap;
2464 for (
auto it = sourceMap.constBegin(); it != sourceMap.constEnd(); it++ )
2470 else if ( value.type() == QVariant::Type::List || value.type() == QVariant::Type::StringList )
2472 const QVariantList sourceList = value.toList();
2473 QVariantList resultList;
2474 resultList.reserve( sourceList.size() );
2475 for (
const QVariant &v : sourceList )
2483 switch ( value.userType() )
2486 case QMetaType::Bool:
2487 case QMetaType::Char:
2488 case QMetaType::Int:
2489 case QMetaType::Double:
2490 case QMetaType::Float:
2491 case QMetaType::LongLong:
2492 case QMetaType::ULongLong:
2493 case QMetaType::UInt:
2494 case QMetaType::ULong:
2495 case QMetaType::UShort:
2502 if ( value.userType() == QMetaType::type(
"QgsProperty" ) )
2512 return QVariantMap( {{QStringLiteral(
"type" ), QStringLiteral(
"data_defined" )}, {QStringLiteral(
"field" ), prop.
field() }} );
2514 return QVariantMap( {{QStringLiteral(
"type" ), QStringLiteral(
"data_defined" )}, {QStringLiteral(
"expression" ), prop.
expressionString() }} );
2519 if ( value.userType() == QMetaType::type(
"QgsCoordinateReferenceSystem" ) )
2529 else if ( value.userType() == QMetaType::type(
"QgsRectangle" ) )
2537 else if ( value.userType() == QMetaType::type(
"QgsReferencedRectangle" ) )
2546 else if ( value.userType() == QMetaType::type(
"QgsGeometry" ) )
2558 else if ( value.userType() == QMetaType::type(
"QgsReferencedGeometry" ) )
2573 else if ( value.userType() == QMetaType::type(
"QgsPointXY" ) )
2579 else if ( value.userType() == QMetaType::type(
"QgsReferencedPointXY" ) )
2586 else if ( value.userType() == QMetaType::type(
"QgsProcessingFeatureSourceDefinition" ) )
2593 else if ( value.userType() == QMetaType::type(
"QgsProcessingOutputLayerDefinition" ) )
2598 else if ( value.userType() == QMetaType::type(
"QColor" ) )
2600 const QColor fromVar = value.value< QColor >();
2601 if ( !fromVar.isValid() )
2604 return QStringLiteral(
"rgba( %1, %2, %3, %4 )" ).arg( fromVar.red() ).arg( fromVar.green() ).arg( fromVar.blue() ).arg( QString::number( fromVar.alphaF(),
'f', 2 ) );
2606 else if ( value.userType() == QMetaType::type(
"QDateTime" ) )
2608 const QDateTime fromVar = value.toDateTime();
2609 if ( !fromVar.isValid() )
2612 return fromVar.toString( Qt::ISODate );
2614 else if ( value.userType() == QMetaType::type(
"QDate" ) )
2616 const QDate fromVar = value.toDate();
2617 if ( !fromVar.isValid() )
2620 return fromVar.toString( Qt::ISODate );
2622 else if ( value.userType() == QMetaType::type(
"QTime" ) )
2624 const QTime fromVar = value.toTime();
2625 if ( !fromVar.isValid() )
2628 return fromVar.toString( Qt::ISODate );
2635 p.insert(
name(), value );
2639 if ( !source.isEmpty() )
2646 if ( value.userType() == QMetaType::QString )
2651 Q_ASSERT_X(
false,
"QgsProcessingParameterDefinition::valueAsJsonObject", QStringLiteral(
"unsupported variant type %1" ).arg(
QMetaType::typeName( value.userType() ) ).toLocal8Bit() );
2664 if ( !value.isValid() )
2667 switch ( value.userType() )
2670 case QMetaType::Bool:
2671 case QMetaType::Char:
2672 case QMetaType::Int:
2673 case QMetaType::Double:
2674 case QMetaType::Float:
2675 case QMetaType::LongLong:
2676 case QMetaType::ULongLong:
2677 case QMetaType::UInt:
2678 case QMetaType::ULong:
2679 case QMetaType::UShort:
2680 return value.toString();
2686 if ( value.userType() == QMetaType::type(
"QgsProperty" ) )
2696 return QStringLiteral(
"field:%1" ).arg( prop.
field() );
2703 if ( value.userType() == QMetaType::type(
"QgsCoordinateReferenceSystem" ) )
2713 else if ( value.userType() == QMetaType::type(
"QgsRectangle" ) )
2721 else if ( value.userType() == QMetaType::type(
"QgsReferencedRectangle" ) )
2729 else if ( value.userType() == QMetaType::type(
"QgsGeometry" ) )
2741 else if ( value.userType() == QMetaType::type(
"QgsReferencedGeometry" ) )
2756 else if ( value.userType() == QMetaType::type(
"QgsPointXY" ) )
2762 else if ( value.userType() == QMetaType::type(
"QgsReferencedPointXY" ) )
2769 else if ( value.userType() == QMetaType::type(
"QgsProcessingFeatureSourceDefinition" ) )
2774 else if ( value.userType() == QMetaType::type(
"QgsProcessingOutputLayerDefinition" ) )
2779 else if ( value.userType() == QMetaType::type(
"QColor" ) )
2781 const QColor fromVar = value.value< QColor >();
2782 if ( !fromVar.isValid() )
2785 return QStringLiteral(
"rgba( %1, %2, %3, %4 )" ).arg( fromVar.red() ).arg( fromVar.green() ).arg( fromVar.blue() ).arg( QString::number( fromVar.alphaF(),
'f', 2 ) );
2787 else if ( value.userType() == QMetaType::type(
"QDateTime" ) )
2789 const QDateTime fromVar = value.toDateTime();
2790 if ( !fromVar.isValid() )
2793 return fromVar.toString( Qt::ISODate );
2795 else if ( value.userType() == QMetaType::type(
"QDate" ) )
2797 const QDate fromVar = value.toDate();
2798 if ( !fromVar.isValid() )
2801 return fromVar.toString( Qt::ISODate );
2803 else if ( value.userType() == QMetaType::type(
"QTime" ) )
2805 const QTime fromVar = value.toTime();
2806 if ( !fromVar.isValid() )
2809 return fromVar.toString( Qt::ISODate );
2816 p.insert(
name(), value );
2820 if ( !source.isEmpty() )
2827 if ( value.userType() == QMetaType::QString )
2828 return value.toString();
2833 return value.toString();
2839 if ( !value.isValid( ) )
2840 return QStringList();
2842 if ( value.type() == QVariant::Type::List || value.type() == QVariant::Type::StringList )
2844 const QVariantList sourceList = value.toList();
2845 QStringList resultList;
2846 resultList.reserve( sourceList.size() );
2847 for (
const QVariant &v : sourceList )
2856 return QStringList();
2868 QString code = QStringLiteral(
"##%1=" ).arg(
mName );
2870 code += QLatin1String(
"optional " );
2871 code +=
type() +
' ';
2873 return code.trimmed();
2881 switch ( outputType )
2885 QString code = t->className() + QStringLiteral(
"('%1', %2" )
2888 code += QLatin1String(
", optional=True" );
2904 map.insert( QStringLiteral(
"parameter_type" ),
type() );
2905 map.insert( QStringLiteral(
"name" ),
mName );
2906 map.insert( QStringLiteral(
"description" ),
mDescription );
2907 map.insert( QStringLiteral(
"help" ),
mHelp );
2908 map.insert( QStringLiteral(
"default" ),
mDefault );
2909 map.insert( QStringLiteral(
"defaultGui" ),
mGuiDefault );
2910 map.insert( QStringLiteral(
"flags" ),
static_cast< int >(
mFlags ) );
2911 map.insert( QStringLiteral(
"metadata" ),
mMetadata );
2917 mName = map.value( QStringLiteral(
"name" ) ).toString();
2918 mDescription = map.value( QStringLiteral(
"description" ) ).toString();
2919 mHelp = map.value( QStringLiteral(
"help" ) ).toString();
2920 mDefault = map.value( QStringLiteral(
"default" ) );
2921 mGuiDefault = map.value( QStringLiteral(
"defaultGui" ) );
2922 mFlags =
static_cast< Flags
>( map.value( QStringLiteral(
"flags" ) ).toInt() );
2923 mMetadata = map.value( QStringLiteral(
"metadata" ) ).toMap();
2939 QString text = QStringLiteral(
"<p><b>%1</b></p>" ).arg(
description() );
2940 if ( !
help().isEmpty() )
2942 text += QStringLiteral(
"<p>%1</p>" ).arg(
help() );
2944 text += QStringLiteral(
"<p>%1</p>" ).arg( QObject::tr(
"Python identifier: ‘%1’" ).arg( QStringLiteral(
"<i>%1</i>" ).arg(
name() ) ) );
2959 if ( !val.isValid() )
2960 return QStringLiteral(
"None" );
2962 if ( val.userType() == QMetaType::type(
"QgsProperty" ) )
2964 return val.toBool() ? QStringLiteral(
"True" ) : QStringLiteral(
"False" );
2969 QString code = QStringLiteral(
"##%1=" ).arg(
mName );
2971 code += QLatin1String(
"optional " );
2972 code +=
type() +
' ';
2973 code +=
mDefault.toBool() ? QStringLiteral(
"true" ) : QStringLiteral(
"false" );
2974 return code.trimmed();
2995 if ( !input.isValid() )
2998 if ( input.userType() == QMetaType::type(
"QgsCoordinateReferenceSystem" ) )
3002 else if ( input.userType() == QMetaType::type(
"QgsProcessingFeatureSourceDefinition" ) )
3006 else if ( input.userType() == QMetaType::type(
"QgsProcessingOutputLayerDefinition" ) )
3011 if ( input.userType() == QMetaType::type(
"QgsProperty" ) )
3017 if ( qobject_cast< QgsMapLayer * >( qvariant_cast<QObject *>( input ) ) )
3020 if ( input.type() != QVariant::String || input.toString().isEmpty() )
3028 if ( !value.isValid() )
3029 return QStringLiteral(
"None" );
3031 if ( value.userType() == QMetaType::type(
"QgsCoordinateReferenceSystem" ) )
3034 return QStringLiteral(
"QgsCoordinateReferenceSystem()" );
3039 if ( value.userType() == QMetaType::type(
"QgsProperty" ) )
3040 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( value.value<
QgsProperty >().
asExpression() );
3043 p.insert(
name(), value );
3080 if ( !input.isValid() )
3083 if ( input.userType() == QMetaType::type(
"QgsProperty" ) )
3088 if ( qobject_cast< QgsMapLayer * >( qvariant_cast<QObject *>( input ) ) )
3093 if ( input.type() != QVariant::String || input.toString().isEmpty() )
3111 if ( !val.isValid() )
3112 return QStringLiteral(
"None" );
3114 if ( val.userType() == QMetaType::type(
"QgsProperty" ) )
3118 p.insert(
name(), val );
3138 for (
const QString &raster : rasters )
3140 if ( !vectors.contains( raster ) )
3144 for (
const QString &mesh : meshFilters )
3146 if ( !vectors.contains( mesh ) )
3150 for (
const QString &pointCloud : pointCloudFilters )
3152 if ( !vectors.contains( pointCloud ) )
3153 vectors << pointCloud;
3155 vectors.removeAll( QObject::tr(
"All files (*.*)" ) );
3156 std::sort( vectors.begin(), vectors.end() );
3158 return QObject::tr(
"All files (*.*)" ) + QStringLiteral(
";;" ) + vectors.join( QLatin1String(
";;" ) );
3168 QString code = QStringLiteral(
"##%1=" ).arg(
mName );
3170 code += QLatin1String(
"optional " );
3171 code += QLatin1String(
"layer " );
3178 code += QLatin1String(
"hasgeometry " );
3182 code += QLatin1String(
"point " );
3186 code += QLatin1String(
"line " );
3190 code += QLatin1String(
"polygon " );
3194 code += QLatin1String(
"raster " );
3198 code += QLatin1String(
"mesh " );
3202 code += QLatin1String(
"plugin " );
3206 code += QLatin1String(
"pointcloud " );
3210 code += QLatin1String(
"annotation " );
3216 return code.trimmed();
3222 QString def = definition;
3225 if ( def.startsWith( QLatin1String(
"hasgeometry" ), Qt::CaseInsensitive ) )
3228 def = def.mid( 12 );
3231 else if ( def.startsWith( QLatin1String(
"point" ), Qt::CaseInsensitive ) )
3237 else if ( def.startsWith( QLatin1String(
"line" ), Qt::CaseInsensitive ) )
3243 else if ( def.startsWith( QLatin1String(
"polygon" ), Qt::CaseInsensitive ) )
3249 else if ( def.startsWith( QLatin1String(
"raster" ), Qt::CaseInsensitive ) )
3255 else if ( def.startsWith( QLatin1String(
"mesh" ), Qt::CaseInsensitive ) )
3261 else if ( def.startsWith( QLatin1String(
"plugin" ), Qt::CaseInsensitive ) )
3267 else if ( def.startsWith( QLatin1String(
"pointcloud" ), Qt::CaseInsensitive ) )
3270 def = def.mid( 11 );
3273 else if ( def.startsWith( QLatin1String(
"annotation" ), Qt::CaseInsensitive ) )
3276 def = def.mid( 11 );
3287 switch ( outputType )
3291 QString code = QStringLiteral(
"QgsProcessingParameterMapLayer('%1', %2" )
3294 code += QLatin1String(
", optional=True" );
3301 QStringList options;
3305 code += QStringLiteral(
", types=[%1])" ).arg( options.join(
',' ) );
3309 code += QLatin1Char(
')' );
3326 map.insert( QStringLiteral(
"data_types" ), types );
3334 const QVariantList values = map.value( QStringLiteral(
"data_types" ) ).toList();
3335 for (
const QVariant &val : values )
3355 if ( !input.isValid() )
3358 if ( input.userType() == QMetaType::type(
"QgsProcessingFeatureSourceDefinition" ) )
3362 else if ( input.userType() == QMetaType::type(
"QgsProcessingOutputLayerDefinition" ) )
3367 if ( input.userType() == QMetaType::type(
"QgsProperty" ) )
3372 if ( input.userType() == QMetaType::type(
"QgsRectangle" ) )
3377 if ( input.userType() == QMetaType::type(
"QgsGeometry" ) )
3381 if ( input.userType() == QMetaType::type(
"QgsReferencedRectangle" ) )
3388 if ( qobject_cast< QgsMapLayer * >( qvariant_cast<QObject *>( input ) ) )
3391 if ( input.type() != QVariant::String || input.toString().isEmpty() )
3400 const QRegularExpression rx( QStringLiteral(
"^(.*?)\\s*,\\s*(.*?)\\s*,\\s*(.*?)\\s*,\\s*(.*?)\\s*(?:\\[(.*)\\])?\\s*$" ) );
3401 const QRegularExpressionMatch match = rx.match( input.toString() );
3402 if ( match.hasMatch() )
3404 bool xMinOk =
false;
3405 ( void )match.captured( 1 ).toDouble( &xMinOk );
3406 bool xMaxOk =
false;
3407 ( void )match.captured( 2 ).toDouble( &xMaxOk );
3408 bool yMinOk =
false;
3409 ( void )match.captured( 3 ).toDouble( &yMinOk );
3410 bool yMaxOk =
false;
3411 ( void )match.captured( 4 ).toDouble( &yMaxOk );
3412 if ( xMinOk && xMaxOk && yMinOk && yMaxOk )
3422 if ( !value.isValid() )
3423 return QStringLiteral(
"None" );
3425 if ( value.userType() == QMetaType::type(
"QgsProperty" ) )
3426 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( value.value<
QgsProperty >().
asExpression() );
3428 if ( value.userType() == QMetaType::type(
"QgsRectangle" ) )
3436 else if ( value.userType() == QMetaType::type(
"QgsReferencedRectangle" ) )
3444 else if ( value.userType() == QMetaType::type(
"QgsGeometry" ) )
3449 const QString wkt = g.
asWkt();
3450 return QStringLiteral(
"QgsGeometry.fromWkt('%1')" ).arg( wkt );
3455 p.insert(
name(), value );
3491 if ( !input.isValid() )
3494 if ( input.userType() == QMetaType::type(
"QgsProperty" ) )
3499 if ( input.userType() == QMetaType::type(
"QgsPointXY" ) )
3503 if ( input.userType() == QMetaType::type(
"QgsReferencedPointXY" ) )
3507 if ( input.userType() == QMetaType::type(
"QgsGeometry" ) )
3512 if ( input.type() == QVariant::String )
3514 if ( input.toString().isEmpty() )
3518 const QRegularExpression rx( QStringLiteral(
"^\\s*\\(?\\s*(.*?)\\s*,\\s*(.*?)\\s*(?:\\[(.*)\\])?\\s*\\)?\\s*$" ) );
3520 const QRegularExpressionMatch match = rx.match( input.toString() );
3521 if ( match.hasMatch() )
3524 ( void )match.captured( 1 ).toDouble( &xOk );
3526 ( void )match.captured( 2 ).toDouble( &yOk );
3535 if ( !value.isValid() )
3536 return QStringLiteral(
"None" );
3538 if ( value.userType() == QMetaType::type(
"QgsProperty" ) )
3539 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( value.value<
QgsProperty >().
asExpression() );
3541 if ( value.userType() == QMetaType::type(
"QgsPointXY" ) )
3547 else if ( value.userType() == QMetaType::type(
"QgsReferencedPointXY" ) )
3554 else if ( value.userType() == QMetaType::type(
"QgsGeometry" ) )
3559 const QString wkt = g.
asWkt();
3560 return QStringLiteral(
"QgsGeometry.fromWkt('%1')" ).arg( wkt );
3573 const QVariant &defaultValue,
bool optional,
const QList<int> &geometryTypes,
bool allowMultipart )
3575 mGeomTypes( geometryTypes ),
3576 mAllowMultipart( allowMultipart )
3588 if ( !input.isValid() )
3591 if ( input.userType() == QMetaType::type(
"QgsProperty" ) )
3596 const bool anyTypeAllowed = mGeomTypes.isEmpty() || mGeomTypes.contains(
static_cast< int >( Qgis::GeometryType::Unknown ) );
3598 if ( input.userType() == QMetaType::type(
"QgsGeometry" ) )
3600 return ( anyTypeAllowed || mGeomTypes.contains(
static_cast< int >( input.value<
QgsGeometry>().
type() ) ) ) &&
3601 ( mAllowMultipart || !input.value<
QgsGeometry>().isMultipart() );
3604 if ( input.userType() == QMetaType::type(
"QgsReferencedGeometry" ) )
3610 if ( input.userType() == QMetaType::type(
"QgsPointXY" ) )
3612 return anyTypeAllowed || mGeomTypes.contains(
static_cast< int >( Qgis::GeometryType::Point ) );
3615 if ( input.userType() == QMetaType::type(
"QgsRectangle" ) )
3617 return anyTypeAllowed || mGeomTypes.contains(
static_cast< int >( Qgis::GeometryType::Polygon ) );
3620 if ( input.userType() == QMetaType::type(
"QgsReferencedPointXY" ) )
3622 return anyTypeAllowed || mGeomTypes.contains(
static_cast< int >( Qgis::GeometryType::Point ) );
3625 if ( input.userType() == QMetaType::type(
"QgsReferencedRectangle" ) )
3627 return anyTypeAllowed || mGeomTypes.contains(
static_cast< int >( Qgis::GeometryType::Polygon ) );
3630 if ( input.type() == QVariant::String )
3632 if ( input.toString().isEmpty() )
3637 const QRegularExpression rx( QStringLiteral(
"^\\s*(?:CRS=(.*);)?(.*?)$" ) );
3639 const QRegularExpressionMatch match = rx.match( input.toString() );
3640 if ( match.hasMatch() )
3645 return ( anyTypeAllowed || mGeomTypes.contains(
static_cast< int >( g.
type() ) ) ) && ( mAllowMultipart || !g.
isMultipart() );
3665 if ( !value.isValid() )
3666 return QStringLiteral(
"None" );
3668 if ( value.userType() == QMetaType::type(
"QgsProperty" ) )
3671 if ( value.userType() == QMetaType::type(
"QgsGeometry" ) )
3678 if ( value.userType() == QMetaType::type(
"QgsReferencedGeometry" ) )
3685 if ( value.userType() == QMetaType::type(
"QgsPointXY" ) )
3692 if ( value.userType() == QMetaType::type(
"QgsReferencedPointXY" ) )
3699 if ( value.userType() == QMetaType::type(
"QgsRectangle" ) )
3706 if ( value.userType() == QMetaType::type(
"QgsReferencedRectangle" ) )
3718 QString code = QStringLiteral(
"##%1=" ).arg(
mName );
3720 code += QLatin1String(
"optional " );
3721 code +=
type() +
' ';
3723 for (
const int type : mGeomTypes )
3727 case Qgis::GeometryType::Point:
3728 code += QLatin1String(
"point " );
3731 case Qgis::GeometryType::Line:
3732 code += QLatin1String(
"line " );
3735 case Qgis::GeometryType::Polygon:
3736 code += QLatin1String(
"polygon " );
3740 code += QLatin1String(
"unknown " );
3746 return code.trimmed();
3751 switch ( outputType )
3755 QString code = QStringLiteral(
"QgsProcessingParameterGeometry('%1', %2" )
3758 code += QLatin1String(
", optional=True" );
3760 if ( !mGeomTypes.empty() )
3766 case Qgis::GeometryType::Point:
3767 return QStringLiteral(
"PointGeometry" );
3769 case Qgis::GeometryType::Line:
3770 return QStringLiteral(
"LineGeometry" );
3772 case Qgis::GeometryType::Polygon:
3773 return QStringLiteral(
"PolygonGeometry" );
3775 case Qgis::GeometryType::Unknown:
3776 return QStringLiteral(
"UnknownGeometry" );
3778 case Qgis::GeometryType::Null:
3779 return QStringLiteral(
"NullGeometry" );
3784 QStringList options;
3785 options.reserve( mGeomTypes.size() );
3786 for (
const int type : mGeomTypes )
3788 options << QStringLiteral(
" QgsWkbTypes.%1" ).arg( geomTypeToString(
static_cast<Qgis::GeometryType>(
type ) ) );
3790 code += QStringLiteral(
", geometryTypes=[%1 ]" ).arg( options.join(
',' ) );
3793 if ( ! mAllowMultipart )
3795 code += QLatin1String(
", allowMultipart=False" );
3810 for (
const int type : mGeomTypes )
3814 map.insert( QStringLiteral(
"geometrytypes" ), types );
3815 map.insert( QStringLiteral(
"multipart" ), mAllowMultipart );
3823 const QVariantList values = map.value( QStringLiteral(
"geometrytypes" ) ).toList();
3824 for (
const QVariant &val : values )
3826 mGeomTypes << val.toInt();
3828 mAllowMultipart = map.value( QStringLiteral(
"multipart" ) ).toBool();
3839 , mBehavior( behavior )
3840 , mExtension( fileFilter.isEmpty() ? extension : QString() )
3841 , mFileFilter( fileFilter.isEmpty() && extension.isEmpty() ? QObject::tr(
"All files (*.*)" ) : fileFilter )
3853 if ( !input.isValid() )
3856 if ( input.userType() == QMetaType::type(
"QgsProperty" ) )
3861 const QString
string = input.toString().trimmed();
3863 if ( input.type() != QVariant::String ||
string.isEmpty() )
3866 switch ( mBehavior )
3870 if ( !mExtension.isEmpty() )
3872 return string.endsWith( mExtension, Qt::CaseInsensitive );
3874 else if ( !mFileFilter.isEmpty() )
3892 QString code = QStringLiteral(
"##%1=" ).arg(
mName );
3894 code += QLatin1String(
"optional " );
3895 code += ( mBehavior ==
File ? QStringLiteral(
"file" ) : QStringLiteral(
"folder" ) ) +
' ';
3897 return code.trimmed();
3902 switch ( outputType )
3907 QString code = QStringLiteral(
"QgsProcessingParameterFile('%1', %2" )
3910 code += QLatin1String(
", optional=True" );
3911 code += QStringLiteral(
", behavior=%1" ).arg( mBehavior ==
File ? QStringLiteral(
"QgsProcessingParameterFile.File" ) : QStringLiteral(
"QgsProcessingParameterFile.Folder" ) );
3912 if ( !mExtension.isEmpty() )
3913 code += QStringLiteral(
", extension='%1'" ).arg( mExtension );
3914 if ( !mFileFilter.isEmpty() )
3915 code += QStringLiteral(
", fileFilter='%1'" ).arg( mFileFilter );
3926 switch ( mBehavior )
3930 if ( !mFileFilter.isEmpty() )
3931 return mFileFilter != QObject::tr(
"All files (*.*)" ) ? mFileFilter + QStringLiteral(
";;" ) + QObject::tr(
"All files (*.*)" ) : mFileFilter;
3932 else if ( !mExtension.isEmpty() )
3933 return QObject::tr(
"%1 files" ).arg( mExtension.toUpper() ) + QStringLiteral(
" (*." ) + mExtension.toLower() + QStringLiteral(
");;" ) + QObject::tr(
"All files (*.*)" );
3935 return QObject::tr(
"All files (*.*)" );
3947 mFileFilter.clear();
3957 mFileFilter = filter;
3964 map.insert( QStringLiteral(
"behavior" ), mBehavior );
3965 map.insert( QStringLiteral(
"extension" ), mExtension );
3966 map.insert( QStringLiteral(
"filefilter" ), mFileFilter );
3973 mBehavior =
static_cast< Behavior >( map.value( QStringLiteral(
"behavior" ) ).toInt() );
3974 mExtension = map.value( QStringLiteral(
"extension" ) ).toString();
3975 mFileFilter = map.value( QStringLiteral(
"filefilter" ) ).toString();
3986 , mHeaders( headers )
3987 , mNumberRows( numberRows )
3988 , mFixedNumberRows( fixedNumberRows )
4000 if ( !input.isValid() )
4003 if ( input.type() == QVariant::String )
4005 if ( input.toString().isEmpty() )
4009 else if ( input.type() == QVariant::List )
4011 if ( input.toList().isEmpty() )
4015 else if ( input.type() == QVariant::Double || input.type() == QVariant::Int )
4025 if ( !value.isValid() )
4026 return QStringLiteral(
"None" );
4028 if ( value.userType() == QMetaType::type(
"QgsProperty" ) )
4029 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( value.value<
QgsProperty >().
asExpression() );
4032 p.insert(
name(), value );
4040 switch ( outputType )
4044 QString code = QStringLiteral(
"QgsProcessingParameterMatrix('%1', %2" )
4047 code += QLatin1String(
", optional=True" );
4048 code += QStringLiteral(
", numberRows=%1" ).arg( mNumberRows );
4049 code += QStringLiteral(
", hasFixedNumberRows=%1" ).arg( mFixedNumberRows ? QStringLiteral(
"True" ) : QStringLiteral(
"False" ) );
4052 headers.reserve( mHeaders.size() );
4053 for (
const QString &h : mHeaders )
4055 code += QStringLiteral(
", headers=[%1]" ).arg(
headers.join(
',' ) );
4087 return mFixedNumberRows;
4092 mFixedNumberRows = fixedNumberRows;
4098 map.insert( QStringLiteral(
"headers" ), mHeaders );
4099 map.insert( QStringLiteral(
"rows" ), mNumberRows );
4100 map.insert( QStringLiteral(
"fixed_number_rows" ), mFixedNumberRows );
4107 mHeaders = map.value( QStringLiteral(
"headers" ) ).toStringList();
4108 mNumberRows = map.value( QStringLiteral(
"rows" ) ).toInt();
4109 mFixedNumberRows = map.value( QStringLiteral(
"fixed_number_rows" ) ).toBool();
4120 , mLayerType( layerType )
4132 if ( !input.isValid() )
4137 if ( qobject_cast< QgsMapLayer * >( qvariant_cast<QObject *>( input ) ) )
4143 if ( input.type() == QVariant::String )
4145 if ( input.toString().isEmpty() )
4148 if ( mMinimumNumberInputs > 1 )
4159 else if ( input.type() == QVariant::List )
4161 if ( input.toList().count() < mMinimumNumberInputs )
4164 if ( mMinimumNumberInputs > input.toList().count() )
4172 const auto constToList = input.toList();
4173 for (
const QVariant &v : constToList )
4175 if ( qobject_cast< QgsMapLayer * >( qvariant_cast<QObject *>( v ) ) )
4184 else if ( input.type() == QVariant::StringList )
4186 if ( input.toStringList().count() < mMinimumNumberInputs )
4189 if ( mMinimumNumberInputs > input.toStringList().count() )
4197 const auto constToStringList = input.toStringList();
4198 for (
const QString &v : constToStringList )
4211 if ( !value.isValid() )
4212 return QStringLiteral(
"None" );
4214 if ( value.userType() == QMetaType::type(
"QgsProperty" ) )
4215 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( value.value<
QgsProperty >().
asExpression() );
4220 if ( value.type() == QVariant::StringList )
4222 const QStringList list = value.toStringList();
4223 parts.reserve( list.count() );
4224 for (
const QString &v : list )
4227 else if ( value.type() == QVariant::List )
4229 const QVariantList list = value.toList();
4230 parts.reserve( list.count() );
4231 for (
const QVariant &v : list )
4234 if ( !parts.isEmpty() )
4235 return parts.join(
',' ).prepend(
'[' ).append(
']' );
4240 p.insert(
name(), value );
4242 if ( !list.isEmpty() )
4245 parts.reserve( list.count() );
4250 return parts.join(
',' ).prepend(
'[' ).append(
']' );
4269 QString code = QStringLiteral(
"##%1=" ).arg(
mName );
4271 code += QLatin1String(
"optional " );
4272 switch ( mLayerType )
4275 code += QLatin1String(
"multiple raster" );
4279 code += QLatin1String(
"multiple file" );
4283 code += QLatin1String(
"multiple vector" );
4287 if (
mDefault.type() == QVariant::List )
4290 const auto constToList =
mDefault.toList();
4291 for (
const QVariant &var : constToList )
4293 parts << var.toString();
4295 code += parts.join(
',' );
4297 else if (
mDefault.type() == QVariant::StringList )
4299 code +=
mDefault.toStringList().join(
',' );
4305 return code.trimmed();
4310 switch ( outputType )
4314 QString code = QStringLiteral(
"QgsProcessingParameterMultipleLayers('%1', %2" )
4317 code += QLatin1String(
", optional=True" );
4321 code += QStringLiteral(
", layerType=%1" ).arg(
layerType );
4332 switch ( mLayerType )
4335 return QObject::tr(
"All files (*.*)" );
4373 return mMinimumNumberInputs;
4385 map.insert( QStringLiteral(
"layer_type" ), mLayerType );
4386 map.insert( QStringLiteral(
"min_inputs" ), mMinimumNumberInputs );
4394 mMinimumNumberInputs = map.value( QStringLiteral(
"min_inputs" ) ).toInt();
4400 QString
type = definition;
4402 const QRegularExpression re( QStringLiteral(
"(.*?)\\s+(.*)" ) );
4403 const QRegularExpressionMatch m = re.match( definition );
4406 type = m.captured( 1 ).toLower().trimmed();
4407 defaultVal = m.captured( 2 );
4410 if (
type == QLatin1String(
"vector" ) )
4412 else if (
type == QLatin1String(
"raster" ) )
4414 else if (
type == QLatin1String(
"file" ) )
4427 QgsMessageLog::logMessage( QObject::tr(
"Invalid number parameter \"%1\": min value %2 is >= max value %3!" ).arg(
name ).arg( mMin ).arg( mMax ), QObject::tr(
"Processing" ) );
4438 QVariant input = value;
4439 if ( !input.isValid() )
4447 if ( input.userType() == QMetaType::type(
"QgsProperty" ) )
4453 const double res = input.toDouble( &ok );
4457 return !( res < mMin || res > mMax );
4462 if ( !value.isValid() )
4463 return QStringLiteral(
"None" );
4465 if ( value.userType() == QMetaType::type(
"QgsProperty" ) )
4466 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( value.value<
QgsProperty >().
asExpression() );
4468 return value.toString();
4475 if ( mMin > std::numeric_limits<double>::lowest() + 1 )
4476 parts << QObject::tr(
"Minimum value: %1" ).arg( mMin );
4477 if ( mMax < std::numeric_limits<double>::max() )
4478 parts << QObject::tr(
"Maximum value: %1" ).arg( mMax );
4480 parts << QObject::tr(
"Default value: %1" ).arg( mDataType ==
Integer ?
mDefault.toInt() :
mDefault.toDouble() );
4481 const QString extra = parts.join( QLatin1String(
"<br />" ) );
4482 if ( !extra.isEmpty() )
4483 text += QStringLiteral(
"<p>%1</p>" ).arg( extra );
4489 switch ( outputType )
4493 QString code = QStringLiteral(
"QgsProcessingParameterNumber('%1', %2" )
4496 code += QLatin1String(
", optional=True" );
4498 code += QStringLiteral(
", type=%1" ).arg( mDataType ==
Integer ? QStringLiteral(
"QgsProcessingParameterNumber.Integer" ) : QStringLiteral(
"QgsProcessingParameterNumber.Double" ) );
4500 if ( mMin != std::numeric_limits<double>::lowest() + 1 )
4501 code += QStringLiteral(
", minValue=%1" ).arg( mMin );
4502 if ( mMax != std::numeric_limits<double>::max() )
4503 code += QStringLiteral(
", maxValue=%1" ).arg( mMax );
4545 map.insert( QStringLiteral(
"min" ), mMin );
4546 map.insert( QStringLiteral(
"max" ), mMax );
4547 map.insert( QStringLiteral(
"data_type" ), mDataType );
4554 mMin = map.value( QStringLiteral(
"min" ) ).toDouble();
4555 mMax = map.value( QStringLiteral(
"max" ) ).toDouble();
4556 mDataType =
static_cast< Type >( map.value( QStringLiteral(
"data_type" ) ).toInt() );
4563 : ( definition.toLower().trimmed() == QLatin1String(
"none" ) ? QVariant() : definition ), isOptional );
4580 if ( !input.isValid() )
4583 if ( input.userType() == QMetaType::type(
"QgsProperty" ) )
4588 if ( input.type() == QVariant::String )
4590 const QStringList list = input.toString().split(
',' );
4591 if ( list.count() != 2 )
4594 list.at( 0 ).toDouble( &ok );
4596 list.at( 1 ).toDouble( &ok2 );
4601 else if ( input.type() == QVariant::List )
4603 if ( input.toList().count() != 2 )
4607 input.toList().at( 0 ).toDouble( &ok );
4609 input.toList().at( 1 ).toDouble( &ok2 );
4620 if ( !value.isValid() )
4621 return QStringLiteral(
"None" );
4623 if ( value.userType() == QMetaType::type(
"QgsProperty" ) )
4624 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( value.value<
QgsProperty >().
asExpression() );
4627 p.insert(
name(), value );
4630 QStringList stringParts;
4631 const auto constParts = parts;
4632 for (
const double v : constParts )
4634 stringParts << QString::number( v );
4636 return stringParts.join(
',' ).prepend(
'[' ).append(
']' );
4641 switch ( outputType )
4645 QString code = QStringLiteral(
"QgsProcessingParameterRange('%1', %2" )
4648 code += QLatin1String(
", optional=True" );
4650 code += QStringLiteral(
", type=%1" ).arg( mDataType ==
QgsProcessingParameterNumber::Integer ? QStringLiteral(
"QgsProcessingParameterNumber.Integer" ) : QStringLiteral(
"QgsProcessingParameterNumber.Double" ) );
4673 map.insert( QStringLiteral(
"data_type" ), mDataType );
4687 : ( definition.toLower().trimmed() == QLatin1String(
"none" ) ? QVariant() : definition ), isOptional );
4703 if ( !input.isValid() )
4706 if ( input.userType() == QMetaType::type(
"QgsProperty" ) )
4711 if ( qobject_cast< QgsRasterLayer * >( qvariant_cast<QObject *>( input ) ) )
4714 if ( input.type() != QVariant::String || input.toString().isEmpty() )
4732 if ( !val.isValid() )
4733 return QStringLiteral(
"None" );
4735 if ( val.userType() == QMetaType::type(
"QgsProperty" ) )
4739 p.insert(
name(), val );
4767 , mOptions( options )
4768 , mAllowMultiple( allowMultiple )
4769 , mUsesStaticStrings( usesStaticStrings )
4781 QVariant input = value;
4782 if ( !input.isValid() )
4790 if ( input.userType() == QMetaType::type(
"QgsProperty" ) )
4795 if ( mUsesStaticStrings )
4797 if ( input.type() == QVariant::List )
4799 if ( !mAllowMultiple )
4802 const QVariantList values = input.toList();
4806 for (
const QVariant &val : values )
4808 if ( !mOptions.contains( val.toString() ) )
4814 else if ( input.type() == QVariant::StringList )
4816 if ( !mAllowMultiple )
4819 const QStringList values = input.toStringList();
4824 if ( values.count() > 1 && !mAllowMultiple )
4827 for (
const QString &val : values )
4829 if ( !mOptions.contains( val ) )
4834 else if ( input.type() == QVariant::String )
4836 const QStringList parts = input.toString().split(
',' );
4837 if ( parts.count() > 1 && !mAllowMultiple )
4840 const auto constParts = parts;
4841 for (
const QString &part : constParts )
4843 if ( !mOptions.contains( part ) )
4851 if ( input.type() == QVariant::List )
4853 if ( !mAllowMultiple )
4856 const QVariantList values = input.toList();
4860 for (
const QVariant &val : values )
4863 const int res = val.toInt( &ok );
4866 else if ( res < 0 || res >= mOptions.count() )
4872 else if ( input.type() == QVariant::String )
4874 const QStringList parts = input.toString().split(
',' );
4875 if ( parts.count() > 1 && !mAllowMultiple )
4878 const auto constParts = parts;
4879 for (
const QString &part : constParts )
4882 const int res = part.toInt( &ok );
4885 else if ( res < 0 || res >= mOptions.count() )
4890 else if ( input.type() == QVariant::Int || input.type() == QVariant::Double )
4893 const int res = input.toInt( &ok );
4896 else if ( res >= 0 && res < mOptions.count() )
4906 if ( !value.isValid() )
4907 return QStringLiteral(
"None" );
4909 if ( value.userType() == QMetaType::type(
"QgsProperty" ) )
4910 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( value.value<
QgsProperty >().
asExpression() );
4912 if ( mUsesStaticStrings )
4914 if ( value.type() == QVariant::StringList )
4917 const QStringList constList = value.toStringList();
4918 for (
const QString &val : constList )
4922 return parts.join(
',' ).prepend(
'[' ).append(
']' );
4924 else if ( value.type() == QVariant::String )
4927 const QStringList constList = value.toString().split(
',' );
4928 if ( constList.count() > 1 )
4930 for (
const QString &val : constList )
4934 return parts.join(
',' ).prepend(
'[' ).append(
']' );
4942 if ( value.type() == QVariant::List )
4945 const auto constToList = value.toList();
4946 for (
const QVariant &val : constToList )
4948 parts << QString::number( static_cast< int >( val.toDouble() ) );
4950 return parts.join(
',' ).prepend(
'[' ).append(
']' );
4952 else if ( value.type() == QVariant::String )
4954 const QStringList parts = value.toString().split(
',' );
4955 if ( parts.count() > 1 )
4957 return parts.join(
',' ).prepend(
'[' ).append(
']' );
4961 return QString::number(
static_cast< int >( value.toDouble() ) );
4967 if ( !value.isValid() )
4970 if ( value.userType() == QMetaType::type(
"QgsProperty" ) )
4973 if ( mUsesStaticStrings )
4979 if ( value.type() == QVariant::List )
4982 const QVariantList toList = value.toList();
4983 parts.reserve( toList.size() );
4984 for (
const QVariant &val : toList )
4986 parts << mOptions.value(
static_cast< int >( val.toDouble() ) );
4988 return parts.join(
',' );
4990 else if ( value.type() == QVariant::String )
4992 const QStringList parts = value.toString().split(
',' );
4993 QStringList comments;
4994 if ( parts.count() > 1 )
4996 for (
const QString &part : parts )
4999 const int val = part.toInt( &ok );
5001 comments << mOptions.value( val );
5003 return comments.join(
',' );
5007 return mOptions.value(
static_cast< int >( value.toDouble() ) );
5013 QString code = QStringLiteral(
"##%1=" ).arg(
mName );
5015 code += QLatin1String(
"optional " );
5016 code += QLatin1String(
"enum " );
5018 if ( mAllowMultiple )
5019 code += QLatin1String(
"multiple " );
5021 if ( mUsesStaticStrings )
5022 code += QLatin1String(
"static " );
5024 code += mOptions.join(
';' ) +
' ';
5027 return code.trimmed();
5032 switch ( outputType )
5036 QString code = QStringLiteral(
"QgsProcessingParameterEnum('%1', %2" )
5039 code += QLatin1String(
", optional=True" );
5042 options.reserve( mOptions.size() );
5043 for (
const QString &o : mOptions )
5045 code += QStringLiteral(
", options=[%1]" ).arg(
options.join(
',' ) );
5047 code += QStringLiteral(
", allowMultiple=%1" ).arg( mAllowMultiple ? QStringLiteral(
"True" ) : QStringLiteral(
"False" ) );
5049 code += QStringLiteral(
", usesStaticStrings=%1" ).arg( mUsesStaticStrings ? QStringLiteral(
"True" ) : QStringLiteral(
"False" ) );
5072 return mAllowMultiple;
5082 return mUsesStaticStrings;
5093 map.insert( QStringLiteral(
"options" ), mOptions );
5094 map.insert( QStringLiteral(
"allow_multiple" ), mAllowMultiple );
5095 map.insert( QStringLiteral(
"uses_static_strings" ), mUsesStaticStrings );
5102 mOptions = map.value( QStringLiteral(
"options" ) ).toStringList();
5103 mAllowMultiple = map.value( QStringLiteral(
"allow_multiple" ) ).toBool();
5104 mUsesStaticStrings = map.value( QStringLiteral(
"uses_static_strings" ) ).toBool();
5111 QString def = definition;
5113 bool multiple =
false;
5114 if ( def.startsWith( QLatin1String(
"multiple" ), Qt::CaseInsensitive ) )
5120 bool staticStrings =
false;
5121 if ( def.startsWith( QLatin1String(
"static" ), Qt::CaseInsensitive ) )
5123 staticStrings =
true;
5127 const QRegularExpression re( QStringLiteral(
"(.*)\\s+(.*?)$" ) );
5128 const QRegularExpressionMatch m = re.match( def );
5129 QString values = def;
5132 values = m.captured( 1 ).trimmed();
5133 defaultVal = m.captured( 2 );
5141 , mMultiLine( multiLine )
5154 return QStringLiteral(
"None" );
5156 if ( value.userType() == QMetaType::type(
"QgsProperty" ) )
5157 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( value.value<
QgsProperty >().
asExpression() );
5159 const QString s = value.toString();
5165 QString code = QStringLiteral(
"##%1=" ).arg(
mName );
5167 code += QLatin1String(
"optional " );
5168 code += QLatin1String(
"string " );
5171 code += QLatin1String(
"long " );
5174 return code.trimmed();
5179 switch ( outputType )
5183 QString code = QStringLiteral(
"QgsProcessingParameterString('%1', %2" )
5186 code += QLatin1String(
", optional=True" );
5187 code += QStringLiteral(
", multiLine=%1" ).arg( mMultiLine ? QStringLiteral(
"True" ) : QStringLiteral(
"False" ) );
5210 map.insert( QStringLiteral(
"multiline" ), mMultiLine );
5217 mMultiLine = map.value( QStringLiteral(
"multiline" ) ).toBool();
5223 QString def = definition;
5225 if ( def.startsWith( QLatin1String(
"long" ), Qt::CaseInsensitive ) )
5231 if ( def.startsWith(
'"' ) || def.startsWith(
'\'' ) )
5233 if ( def.endsWith(
'"' ) || def.endsWith(
'\'' ) )
5237 if ( def == QLatin1String(
"None" ) )
5260 if ( !value.isValid() )
5261 return QStringLiteral(
"None" );
5263 const QString s = value.toString();
5269 QString code = QStringLiteral(
"##%1=" ).arg(
mName );
5271 code += QLatin1String(
"optional " );
5272 code += QLatin1String(
"authcfg " );
5275 return code.trimmed();
5280 QString def = definition;
5282 if ( def.startsWith(
'"' ) || def.startsWith(
'\'' ) )
5284 if ( def.endsWith(
'"' ) || def.endsWith(
'\'' ) )
5288 if ( def == QLatin1String(
"None" ) )
5301 , mParentLayerParameterName( parentLayerParameterName )
5313 if ( !value.isValid() )
5314 return QStringLiteral(
"None" );
5316 if ( value.userType() == QMetaType::type(
"QgsProperty" ) )
5317 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( value.value<
QgsProperty >().
asExpression() );
5319 const QString s = value.toString();
5325 QStringList depends;
5326 if ( !mParentLayerParameterName.isEmpty() )
5327 depends << mParentLayerParameterName;
5333 switch ( outputType )
5337 QString code = QStringLiteral(
"QgsProcessingParameterExpression('%1', %2" )
5340 code += QLatin1String(
", optional=True" );
5342 code += QStringLiteral(
", parentLayerParameterName='%1'" ).arg( mParentLayerParameterName );
5354 return mParentLayerParameterName;
5365 map.insert( QStringLiteral(
"parent_layer" ), mParentLayerParameterName );
5372 mParentLayerParameterName = map.value( QStringLiteral(
"parent_layer" ) ).toString();
5400 if ( var.userType() == QMetaType::type(
"QgsProperty" ) )
5413 if ( qobject_cast< QgsVectorLayer * >( qvariant_cast<QObject *>( var ) ) )
5416 if ( var.type() != QVariant::String || var.toString().isEmpty() )
5434 if ( !val.isValid() )
5435 return QStringLiteral(
"None" );
5437 if ( val.userType() == QMetaType::type(
"QgsProperty" ) )
5441 p.insert(
name(), val );
5459 switch ( outputType )
5463 QString code = QStringLiteral(
"QgsProcessingParameterVectorLayer('%1', %2" )
5466 code += QLatin1String(
", optional=True" );
5470 QStringList options;
5473 code += QStringLiteral(
", types=[%1]" ).arg( options.join(
',' ) );
5507 map.insert( QStringLiteral(
"data_types" ), types );
5515 const QVariantList values = map.value( QStringLiteral(
"data_types" ) ).toList();
5516 for (
const QVariant &val : values )
5529 const QVariant &defaultValue,
bool optional )
5547 if ( var.userType() == QMetaType::type(
"QgsProperty" ) )
5560 if ( qobject_cast< QgsMeshLayer * >( qvariant_cast<QObject *>( var ) ) )
5563 if ( var.type() != QVariant::String || var.toString().isEmpty() )
5581 if ( !val.isValid() )
5582 return QStringLiteral(
"None" );
5584 if ( val.userType() == QMetaType::type(
"QgsProperty" ) )
5588 p.insert(
name(), val );
5616 , mParentLayerParameterName( parentLayerParameterName )
5618 , mAllowMultiple( allowMultiple )
5619 , mDefaultToAllFields( defaultToAllFields )
5632 if ( !input.isValid() )
5635 if ( input.userType() == QMetaType::type(
"QgsProperty" ) )
5640 if ( input.type() == QVariant::List || input.type() == QVariant::StringList )
5642 if ( !mAllowMultiple )
5648 else if ( input.type() == QVariant::String )
5650 if ( input.toString().isEmpty() )
5653 const QStringList parts = input.toString().split(
';' );
5654 if ( parts.count() > 1 && !mAllowMultiple )
5659 if ( input.toString().isEmpty() )
5667 if ( !value.isValid() )
5668 return QStringLiteral(
"None" );
5670 if ( value.userType() == QMetaType::type(
"QgsProperty" ) )
5671 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( value.value<
QgsProperty >().
asExpression() );
5673 if ( value.type() == QVariant::List )
5676 const auto constToList = value.toList();
5677 for (
const QVariant &val : constToList )
5681 return parts.join(
',' ).prepend(
'[' ).append(
']' );
5683 else if ( value.type() == QVariant::StringList )
5686 const auto constToStringList = value.toStringList();
5687 for (
const QString &s : constToStringList )
5691 return parts.join(
',' ).prepend(
'[' ).append(
']' );
5699 QString code = QStringLiteral(
"##%1=" ).arg(
mName );
5701 code += QLatin1String(
"optional " );
5702 code += QLatin1String(
"field " );
5704 switch ( mDataType )
5707 code += QLatin1String(
"numeric " );
5711 code += QLatin1String(
"string " );
5715 code += QLatin1String(
"datetime " );
5722 if ( mAllowMultiple )
5723 code += QLatin1String(
"multiple " );
5725 if ( mDefaultToAllFields )
5726 code += QLatin1String(
"default_to_all_fields " );
5728 code += mParentLayerParameterName +
' ';
5731 return code.trimmed();
5736 switch ( outputType )
5740 QString code = QStringLiteral(
"QgsProcessingParameterField('%1', %2" )
5743 code += QLatin1String(
", optional=True" );
5746 switch ( mDataType )
5749 dataType = QStringLiteral(
"QgsProcessingParameterField.Any" );
5753 dataType = QStringLiteral(
"QgsProcessingParameterField.Numeric" );
5757 dataType = QStringLiteral(
"QgsProcessingParameterField.String" );
5761 dataType = QStringLiteral(
"QgsProcessingParameterField.DateTime" );
5764 code += QStringLiteral(
", type=%1" ).arg(
dataType );
5766 code += QStringLiteral(
", parentLayerParameterName='%1'" ).arg( mParentLayerParameterName );
5767 code += QStringLiteral(
", allowMultiple=%1" ).arg( mAllowMultiple ? QStringLiteral(
"True" ) : QStringLiteral(
"False" ) );
5771 if ( mDefaultToAllFields )
5772 code += QLatin1String(
", defaultToAllFields=True" );
5784 QStringList depends;
5785 if ( !mParentLayerParameterName.isEmpty() )
5786 depends << mParentLayerParameterName;
5792 return mParentLayerParameterName;
5812 return mAllowMultiple;
5822 return mDefaultToAllFields;
5827 mDefaultToAllFields = enabled;
5833 map.insert( QStringLiteral(
"parent_layer" ), mParentLayerParameterName );
5834 map.insert( QStringLiteral(
"data_type" ), mDataType );
5835 map.insert( QStringLiteral(
"allow_multiple" ), mAllowMultiple );
5836 map.insert( QStringLiteral(
"default_to_all_fields" ), mDefaultToAllFields );
5843 mParentLayerParameterName = map.value( QStringLiteral(
"parent_layer" ) ).toString();
5844 mDataType =
static_cast< DataType >( map.value( QStringLiteral(
"data_type" ) ).toInt() );
5845 mAllowMultiple = map.value( QStringLiteral(
"allow_multiple" ) ).toBool();
5846 mDefaultToAllFields = map.value( QStringLiteral(
"default_to_all_fields" ) ).toBool();
5856 QString def = definition;
5858 if ( def.startsWith( QLatin1String(
"numeric " ), Qt::CaseInsensitive ) )
5863 else if ( def.startsWith( QLatin1String(
"string " ), Qt::CaseInsensitive ) )
5868 else if ( def.startsWith( QLatin1String(
"datetime " ), Qt::CaseInsensitive ) )
5874 if ( def.startsWith( QLatin1String(
"multiple" ), Qt::CaseInsensitive ) )
5877 def = def.mid( 8 ).trimmed();
5880 if ( def.startsWith( QLatin1String(
"default_to_all_fields" ), Qt::CaseInsensitive ) )
5883 def = def.mid( 21 ).trimmed();
5886 const QRegularExpression re( QStringLiteral(
"(.*?)\\s+(.*)$" ) );
5887 const QRegularExpressionMatch m = re.match( def );
5890 parent = m.captured( 1 ).trimmed();
5891 def = m.captured( 2 );
5916 QVariant var = input;
5917 if ( !var.isValid() )
5920 if ( var.userType() == QMetaType::type(
"QgsProcessingFeatureSourceDefinition" ) )
5925 else if ( var.userType() == QMetaType::type(
"QgsProcessingOutputLayerDefinition" ) )
5932 if ( var.userType() == QMetaType::type(
"QgsProperty" ) )
5944 if ( qobject_cast< QgsVectorLayer * >( qvariant_cast<QObject *>( input ) ) )
5949 if ( var.type() != QVariant::String || var.toString().isEmpty() )
5967 if ( !value.isValid() )
5968 return QStringLiteral(
"None" );
5970 if ( value.userType() == QMetaType::type(
"QgsProperty" ) )
5973 if ( value.userType() == QMetaType::type(
"QgsProcessingFeatureSourceDefinition" ) )
5976 QString geometryCheckString;
5980 geometryCheckString = QStringLiteral(
"QgsFeatureRequest.GeometryNoCheck" );
5984 geometryCheckString = QStringLiteral(
"QgsFeatureRequest.GeometrySkipInvalid" );
5988 geometryCheckString = QStringLiteral(
"QgsFeatureRequest.GeometryAbortOnInvalid" );
5994 if ( fromVar.
flags & QgsProcessingFeatureSourceDefinition::Flag::FlagOverrideDefaultGeometryCheck )
5995 flags << QStringLiteral(
"QgsProcessingFeatureSourceDefinition.FlagOverrideDefaultGeometryCheck" );
5996 if ( fromVar.
flags & QgsProcessingFeatureSourceDefinition::Flag::FlagCreateIndividualOutputPerInputFeature )
5997 flags << QStringLiteral(
"QgsProcessingFeatureSourceDefinition.FlagCreateIndividualOutputPerInputFeature" );
5998 if ( !
flags.empty() )
5999 flagString =
flags.join( QLatin1String(
" | " ) );
6006 layerString = layer->source();
6013 flagString.isEmpty() ? QString() : ( QStringLiteral(
", flags=%1" ).arg( flagString ) ),
6014 geometryCheckString );
6025 return QStringLiteral(
"QgsProcessingFeatureSourceDefinition(QgsProperty.fromExpression(%1), selectedFeaturesOnly=%2, featureLimit=%3%4, geometryCheck=%5)" )
6029 flagString.isEmpty() ? QString() : ( QStringLiteral(
", flags=%1" ).arg( flagString ) ),
6030 geometryCheckString );
6038 else if (
QgsVectorLayer *layer = qobject_cast< QgsVectorLayer * >( qvariant_cast<QObject *>( value ) ) )
6043 QString layerString = value.toString();
6047 layerString = layer->providerType() != QLatin1String(
"ogr" ) && layer->providerType() != QLatin1String(
"gdal" ) && layer->providerType() != QLatin1String(
"mdal" ) ?
QgsProcessingUtils::encodeProviderKeyAndUri( layer->providerType(), layer->source() ) : layer->source();
6064 QString code = QStringLiteral(
"##%1=" ).arg(
mName );
6066 code += QLatin1String(
"optional " );
6067 code += QLatin1String(
"source " );
6074 code += QLatin1String(
"point " );
6078 code += QLatin1String(
"line " );
6082 code += QLatin1String(
"polygon " );
6089 return code.trimmed();
6094 switch ( outputType )
6098 QString code = QStringLiteral(
"QgsProcessingParameterFeatureSource('%1', %2" )
6101 code += QLatin1String(
", optional=True" );
6105 QStringList options;
6109 code += QStringLiteral(
", types=[%1]" ).arg( options.join(
',' ) );
6126 : mDataTypes( types )
6139 map.insert( QStringLiteral(
"data_types" ), types );
6147 const QVariantList values = map.value( QStringLiteral(
"data_types" ) ).toList();
6148 for (
const QVariant &val : values )
6158 QString def = definition;
6161 if ( def.startsWith( QLatin1String(
"point" ), Qt::CaseInsensitive ) )
6167 else if ( def.startsWith( QLatin1String(
"line" ), Qt::CaseInsensitive ) )
6173 else if ( def.startsWith( QLatin1String(
"polygon" ), Qt::CaseInsensitive ) )
6188 , mSupportsAppend( supportsAppend )
6199 QVariant var = input;
6200 if ( !var.isValid() )
6203 if ( var.userType() == QMetaType::type(
"QgsProcessingOutputLayerDefinition" ) )
6209 if ( var.userType() == QMetaType::type(
"QgsProperty" ) )
6222 if ( var.type() != QVariant::String )
6225 if ( var.toString().isEmpty() )
6233 if ( !value.isValid() )
6234 return QStringLiteral(
"None" );
6236 if ( value.userType() == QMetaType::type(
"QgsProperty" ) )
6237 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( value.value<
QgsProperty >().
asExpression() );
6239 if ( value.userType() == QMetaType::type(
"QgsProcessingOutputLayerDefinition" ) )
6248 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( fromVar.
sink.
asExpression() );
6257 QString code = QStringLiteral(
"##%1=" ).arg(
mName );
6259 code += QLatin1String(
"optional " );
6260 code += QLatin1String(
"sink " );
6262 switch ( mDataType )
6265 code += QLatin1String(
"point " );
6269 code += QLatin1String(
"line " );
6273 code += QLatin1String(
"polygon " );
6277 code += QLatin1String(
"table " );
6285 return code.trimmed();
6297 return lOriginalProvider->defaultVectorFileExtension(
hasGeometry() );
6301 return p->defaultVectorFileExtension(
hasGeometry() );
6311 return QStringLiteral(
"dbf" );
6318 switch ( outputType )
6322 QString code = QStringLiteral(
"QgsProcessingParameterFeatureSink('%1', %2" )
6325 code += QLatin1String(
", optional=True" );
6329 code += QStringLiteral(
", createByDefault=%1" ).arg(
createByDefault() ? QStringLiteral(
"True" ) : QStringLiteral(
"False" ) );
6330 if ( mSupportsAppend )
6331 code += QLatin1String(
", supportsAppend=True" );
6344 QStringList filters;
6345 for (
const QString &ext : exts )
6347 filters << QObject::tr(
"%1 files (*.%2)" ).arg( ext.toUpper(), ext.toLower() );
6349 return filters.join( QLatin1String(
";;" ) ) + QStringLiteral(
";;" ) + QObject::tr(
"All files (*.*)" );
6358 return lOriginalProvider->supportedOutputVectorLayerExtensions();
6360 return lOriginalProvider->supportedOutputTableExtensions();
6365 return p->supportedOutputVectorLayerExtensions();
6367 return p->supportedOutputTableExtensions();
6382 switch ( mDataType )
6411 map.insert( QStringLiteral(
"data_type" ), mDataType );
6412 map.insert( QStringLiteral(
"supports_append" ), mSupportsAppend );
6420 mSupportsAppend = map.value( QStringLiteral(
"supports_append" ), false ).toBool();
6427 return QStringLiteral(
"memory:%1" ).arg(
description() );
6435 QString def = definition;
6436 if ( def.startsWith( QLatin1String(
"point" ), Qt::CaseInsensitive ) )
6441 else if ( def.startsWith( QLatin1String(
"line" ), Qt::CaseInsensitive ) )
6446 else if ( def.startsWith( QLatin1String(
"polygon" ), Qt::CaseInsensitive ) )
6451 else if ( def.startsWith( QLatin1String(
"table" ), Qt::CaseInsensitive ) )
6462 return mSupportsAppend;
6482 QVariant var = input;
6483 if ( !var.isValid() )
6486 if ( var.userType() == QMetaType::type(
"QgsProcessingOutputLayerDefinition" ) )
6492 if ( var.userType() == QMetaType::type(
"QgsProperty" ) )
6505 if ( var.type() != QVariant::String )
6508 if ( var.toString().isEmpty() )
6516 if ( !value.isValid() )
6517 return QStringLiteral(
"None" );
6519 if ( value.userType() == QMetaType::type(
"QgsProperty" ) )
6520 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( value.value<
QgsProperty >().
asExpression() );
6522 if ( value.userType() == QMetaType::type(
"QgsProcessingOutputLayerDefinition" ) )
6531 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( fromVar.
sink.
asExpression() );
6547 return lOriginalProvider->defaultRasterFileExtension();
6551 return p->defaultRasterFileExtension();
6562 QStringList filters;
6563 for (
const QString &ext : exts )
6565 filters << QObject::tr(
"%1 files (*.%2)" ).arg( ext.toUpper(), ext.toLower() );
6567 return filters.join( QLatin1String(
";;" ) ) + QStringLiteral(
";;" ) + QObject::tr(
"All files (*.*)" );
6574 return lOriginalProvider->supportedOutputRasterLayerExtensions();
6578 return p->supportedOutputRasterLayerExtensions();
6594 , mFileFilter( fileFilter.isEmpty() ? QObject::tr(
"All files (*.*)" ) : fileFilter )
6606 QVariant var = input;
6607 if ( !var.isValid() )
6610 if ( var.userType() == QMetaType::type(
"QgsProcessingOutputLayerDefinition" ) )
6616 if ( var.userType() == QMetaType::type(
"QgsProperty" ) )
6629 if ( var.type() != QVariant::String )
6632 if ( var.toString().isEmpty() )
6642 if ( !value.isValid() )
6643 return QStringLiteral(
"None" );
6645 if ( value.userType() == QMetaType::type(
"QgsProperty" ) )
6646 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( value.value<
QgsProperty >().
asExpression() );
6648 if ( value.userType() == QMetaType::type(
"QgsProcessingOutputLayerDefinition" ) )
6657 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( fromVar.
sink.
asExpression() );
6666 if ( !mFileFilter.isEmpty() && mFileFilter.contains( QStringLiteral(
"htm" ), Qt::CaseInsensitive ) )
6678 if ( mFileFilter.isEmpty() || mFileFilter == QObject::tr(
"All files (*.*)" ) )
6679 return QStringLiteral(
"file" );
6682 const QRegularExpression rx( QStringLiteral(
".*?\\(\\*\\.([a-zA-Z0-9._]+).*" ) );
6683 const QRegularExpressionMatch match = rx.match( mFileFilter );
6684 if ( !match.hasMatch() )
6685 return QStringLiteral(
"file" );
6687 return match.captured( 1 );
6692 switch ( outputType )
6696 QString code = QStringLiteral(
"QgsProcessingParameterFileDestination('%1', %2" )
6699 code += QLatin1String(
", optional=True" );
6703 code += QStringLiteral(
", createByDefault=%1" ).arg(
createByDefault() ? QStringLiteral(
"True" ) : QStringLiteral(
"False" ) );
6715 return (
fileFilter().isEmpty() ? QString() :
fileFilter() + QStringLiteral(
";;" ) ) + QObject::tr(
"All files (*.*)" );
6731 map.insert( QStringLiteral(
"file_filter" ), mFileFilter );
6738 mFileFilter = map.value( QStringLiteral(
"file_filter" ) ).toString();
6759 QVariant var = input;
6760 if ( !var.isValid() )
6763 if ( var.userType() == QMetaType::type(
"QgsProperty" ) )
6776 if ( var.type() != QVariant::String )
6779 if ( var.toString().isEmpty() )
6802 , mCreateByDefault( createByDefault )
6810 map.insert( QStringLiteral(
"supports_non_file_outputs" ), mSupportsNonFileBasedOutputs );
6811 map.insert( QStringLiteral(
"create_by_default" ), mCreateByDefault );
6818 mSupportsNonFileBasedOutputs = map.value( QStringLiteral(
"supports_non_file_outputs" ) ).toBool();
6819 mCreateByDefault = map.value( QStringLiteral(
"create_by_default" ), QStringLiteral(
"1" ) ).toBool();
6825 switch ( outputType )
6832 QString code = t->className() + QStringLiteral(
"('%1', %2" )
6835 code += QLatin1String(
", optional=True" );
6837 code += QStringLiteral(
", createByDefault=%1" ).arg( mCreateByDefault ? QStringLiteral(
"True" ) : QStringLiteral(
"False" ) );
6852 return QObject::tr(
"Default extension" ) + QStringLiteral(
" (*." ) +
defaultFileExtension() +
')';
6859 const QRegularExpression rx( QStringLiteral(
"[.]" ) );
6860 QString sanitizedName =
name();
6861 sanitizedName.replace( rx, QStringLiteral(
"_" ) );
6876 return lOriginalProvider->isSupportedOutputValue( value,
this, context, error );
6885 return mCreateByDefault;
6907 QVariant var = input;
6908 if ( !var.isValid() )
6911 if ( var.userType() == QMetaType::type(
"QgsProcessingOutputLayerDefinition" ) )
6917 if ( var.userType() == QMetaType::type(
"QgsProperty" ) )
6930 if ( var.type() != QVariant::String )
6933 if ( var.toString().isEmpty() )
6941 if ( !value.isValid() )
6942 return QStringLiteral(
"None" );
6944 if ( value.userType() == QMetaType::type(
"QgsProperty" ) )
6945 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( value.value<
QgsProperty >().
asExpression() );
6947 if ( value.userType() == QMetaType::type(
"QgsProcessingOutputLayerDefinition" ) )
6956 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( fromVar.
sink.
asExpression() );
6965 QString code = QStringLiteral(
"##%1=" ).arg(
mName );
6967 code += QLatin1String(
"optional " );
6968 code += QLatin1String(
"vectorDestination " );
6970 switch ( mDataType )
6973 code += QLatin1String(
"point " );
6977 code += QLatin1String(
"line " );
6981 code += QLatin1String(
"polygon " );
6989 return code.trimmed();
7001 return lOriginalProvider->defaultVectorFileExtension(
hasGeometry() );
7005 return p->defaultVectorFileExtension(
hasGeometry() );
7015 return QStringLiteral(
"dbf" );
7022 switch ( outputType )
7026 QString code = QStringLiteral(
"QgsProcessingParameterVectorDestination('%1', %2" )
7029 code += QLatin1String(
", optional=True" );
7033 code += QStringLiteral(
", createByDefault=%1" ).arg(
createByDefault() ? QStringLiteral(
"True" ) : QStringLiteral(
"False" ) );
7046 QStringList filters;
7047 for (
const QString &ext : exts )
7049 filters << QObject::tr(
"%1 files (*.%2)" ).arg( ext.toUpper(), ext.toLower() );
7051 return filters.join( QLatin1String(
";;" ) ) + QStringLiteral(
";;" ) + QObject::tr(
"All files (*.*)" );
7059 return lOriginalProvider->supportedOutputVectorLayerExtensions();
7061 return lOriginalProvider->supportedOutputTableExtensions();
7066 return p->supportedOutputVectorLayerExtensions();
7068 return p->supportedOutputTableExtensions();
7083 switch ( mDataType )
7112 map.insert( QStringLiteral(
"data_type" ), mDataType );
7126 QString def = definition;
7127 if ( def.startsWith( QLatin1String(
"point" ), Qt::CaseInsensitive ) )
7132 else if ( def.startsWith( QLatin1String(
"line" ), Qt::CaseInsensitive ) )
7137 else if ( def.startsWith( QLatin1String(
"polygon" ), Qt::CaseInsensitive ) )
7148 , mParentLayerParameterName( parentLayerParameterName )
7149 , mAllowMultiple( allowMultiple )
7161 if ( !input.isValid() )
7164 if ( input.userType() == QMetaType::type(
"QgsProperty" ) )
7169 if ( input.type() == QVariant::List || input.type() == QVariant::StringList )
7171 if ( !mAllowMultiple )
7180 const double res = input.toInt( &ok );
7190 return mAllowMultiple;
7200 if ( !value.isValid() )
7201 return QStringLiteral(
"None" );
7203 if ( value.userType() == QMetaType::type(
"QgsProperty" ) )
7204 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( value.value<
QgsProperty >().
asExpression() );
7206 if ( value.type() == QVariant::List )
7209 const QVariantList values = value.toList();
7210 for (
auto it = values.constBegin(); it != values.constEnd(); ++it )
7212 parts << QString::number( static_cast< int >( it->toDouble() ) );
7214 return parts.join(
',' ).prepend(
'[' ).append(
']' );
7216 else if ( value.type() == QVariant::StringList )
7219 const QStringList values = value.toStringList();
7220 for (
auto it = values.constBegin(); it != values.constEnd(); ++it )
7222 parts << QString::number( static_cast< int >( it->toDouble() ) );
7224 return parts.join(
',' ).prepend(
'[' ).append(
']' );
7227 return value.toString();
7232 QString code = QStringLiteral(
"##%1=" ).arg(
mName );
7234 code += QLatin1String(
"optional " );
7235 code += QLatin1String(
"band " );
7237 if ( mAllowMultiple )
7238 code += QLatin1String(
"multiple " );
7240 code += mParentLayerParameterName +
' ';
7243 return code.trimmed();
7248 QStringList depends;
7249 if ( !mParentLayerParameterName.isEmpty() )
7250 depends << mParentLayerParameterName;
7256 switch ( outputType )
7260 QString code = QStringLiteral(
"QgsProcessingParameterBand('%1', %2" )
7263 code += QLatin1String(
", optional=True" );
7265 code += QStringLiteral(
", parentLayerParameterName='%1'" ).arg( mParentLayerParameterName );
7266 code += QStringLiteral(
", allowMultiple=%1" ).arg( mAllowMultiple ? QStringLiteral(
"True" ) : QStringLiteral(
"False" ) );
7278 return mParentLayerParameterName;
7289 map.insert( QStringLiteral(
"parent_layer" ), mParentLayerParameterName );
7290 map.insert( QStringLiteral(
"allow_multiple" ), mAllowMultiple );
7297 mParentLayerParameterName = map.value( QStringLiteral(
"parent_layer" ) ).toString();
7298 mAllowMultiple = map.value( QStringLiteral(
"allow_multiple" ) ).toBool();
7305 QString def = definition;
7308 if ( def.startsWith( QLatin1String(
"multiple" ), Qt::CaseInsensitive ) )
7311 def = def.mid( 8 ).trimmed();
7314 const QRegularExpression re( QStringLiteral(
"(.*?)\\s+(.*)$" ) );
7315 const QRegularExpressionMatch m = re.match( def );
7318 parent = m.captured( 1 ).trimmed();
7319 def = m.captured( 2 );
7336 , mParentParameterName( parentParameterName )
7353 QStringList depends;
7354 if ( !mParentParameterName.isEmpty() )
7355 depends << mParentParameterName;
7361 switch ( outputType )
7365 QString code = QStringLiteral(
"QgsProcessingParameterDistance('%1', %2" )
7368 code += QLatin1String(
", optional=True" );
7370 code += QStringLiteral(
", parentParameterName='%1'" ).arg( mParentParameterName );
7372 if (
minimum() != std::numeric_limits<double>::lowest() + 1 )
7373 code += QStringLiteral(
", minValue=%1" ).arg(
minimum() );
7374 if (
maximum() != std::numeric_limits<double>::max() )
7375 code += QStringLiteral(
", maxValue=%1" ).arg(
maximum() );
7386 return mParentParameterName;
7397 map.insert( QStringLiteral(
"parent" ), mParentParameterName );
7398 map.insert( QStringLiteral(
"default_unit" ),
static_cast< int >( mDefaultUnit ) );
7405 mParentParameterName = map.value( QStringLiteral(
"parent" ) ).toString();
7406 mDefaultUnit =
static_cast< Qgis::DistanceUnit>( map.value( QStringLiteral(
"default_unit" ),
static_cast< int >( Qgis::DistanceUnit::Unknown ) ).toInt() );
7432 switch ( outputType )
7436 QString code = QStringLiteral(
"QgsProcessingParameterDuration('%1', %2" )
7439 code += QLatin1String(
", optional=True" );
7441 if (
minimum() != std::numeric_limits<double>::lowest() + 1 )
7442 code += QStringLiteral(
", minValue=%1" ).arg(
minimum() );
7443 if (
maximum() != std::numeric_limits<double>::max() )
7444 code += QStringLiteral(
", maxValue=%1" ).arg(
maximum() );
7456 map.insert( QStringLiteral(
"default_unit" ),
static_cast< int >( mDefaultUnit ) );
7463 mDefaultUnit =
static_cast< Qgis::TemporalUnit>( map.value( QStringLiteral(
"default_unit" ),
static_cast< int >( Qgis::TemporalUnit::Days ) ).toInt() );
7490 switch ( outputType )
7494 QString code = QStringLiteral(
"QgsProcessingParameterScale('%1', %2" )
7497 code += QLatin1String(
", optional=True" );
7509 : ( definition.toLower().trimmed() == QLatin1String(
"none" ) ? QVariant() : definition ), isOptional );
7529 return QStringLiteral(
"None" );
7531 if ( value.userType() == QMetaType::type(
"QgsProperty" ) )
7532 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( value.value<
QgsProperty >().
asExpression() );
7534 const QString s = value.toString();
7540 QString code = QStringLiteral(
"##%1=" ).arg(
mName );
7542 code += QLatin1String(
"optional " );
7543 code += QLatin1String(
"layout " );
7546 return code.trimmed();
7551 switch ( outputType )
7555 QString code = QStringLiteral(
"QgsProcessingParameterLayout('%1', %2" )
7558 code += QLatin1String(
", optional=True" );
7569 QString def = definition;
7571 if ( def.startsWith(
'"' ) || def.startsWith(
'\'' ) )
7573 if ( def.endsWith(
'"' ) || def.endsWith(
'\'' ) )
7577 if ( def == QLatin1String(
"None" ) )
7590 , mParentLayoutParameterName( parentLayoutParameterName )
7591 , mItemType( itemType )
7604 return QStringLiteral(
"None" );
7606 if ( value.userType() == QMetaType::type(
"QgsProperty" ) )
7607 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( value.value<
QgsProperty >().
asExpression() );
7609 const QString s = value.toString();
7615 QString code = QStringLiteral(
"##%1=" ).arg(
mName );
7617 code += QLatin1String(
"optional " );
7618 code += QLatin1String(
"layoutitem " );
7619 if ( mItemType >= 0 )
7620 code += QString::number( mItemType ) +
' ';
7622 code += mParentLayoutParameterName +
' ';
7625 return code.trimmed();
7630 switch ( outputType )
7634 QString code = QStringLiteral(
"QgsProcessingParameterLayoutItem('%1', %2" )
7637 code += QLatin1String(
", optional=True" );
7639 if ( mItemType >= 0 )
7640 code += QStringLiteral(
", itemType=%1" ).arg( mItemType );
7642 code += QStringLiteral(
", parentLayoutParameterName='%1'" ).arg( mParentLayoutParameterName );
7655 map.insert( QStringLiteral(
"parent_layout" ), mParentLayoutParameterName );
7656 map.insert( QStringLiteral(
"item_type" ), mItemType );
7663 mParentLayoutParameterName = map.value( QStringLiteral(
"parent_layout" ) ).toString();
7664 mItemType = map.value( QStringLiteral(
"item_type" ) ).toInt();
7670 QStringList depends;
7671 if ( !mParentLayoutParameterName.isEmpty() )
7672 depends << mParentLayoutParameterName;
7679 QString def = definition;
7681 const QRegularExpression re( QStringLiteral(
"(\\d+)?\\s*(.*?)\\s+(.*)$" ) );
7682 const QRegularExpressionMatch m = re.match( def );
7685 itemType = m.captured( 1 ).trimmed().isEmpty() ? -1 : m.captured( 1 ).trimmed().toInt();
7686 parent = m.captured( 2 ).trimmed().isEmpty() ? m.captured( 3 ).trimmed() : m.captured( 2 ).trimmed();
7687 def = !m.captured( 2 ).trimmed().isEmpty() ? m.captured( 3 ) : QString();
7700 return mParentLayoutParameterName;
7705 mParentLayoutParameterName =
name;
7724 , mAllowOpacity( opacityEnabled )
7737 return QStringLiteral(
"None" );
7739 if ( value.userType() == QMetaType::type(
"QgsProperty" ) )
7740 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( value.value<
QgsProperty >().
asExpression() );
7742 if ( value.canConvert< QColor >() && !value.value< QColor >().isValid() )
7743 return QStringLiteral(
"QColor()" );
7745 if ( value.canConvert< QColor >() )
7747 const QColor
c = value.value< QColor >();
7748 if ( !mAllowOpacity ||
c.alpha() == 255 )
7749 return QStringLiteral(
"QColor(%1, %2, %3)" ).arg(
c.red() ).arg(
c.green() ).arg(
c.blue() );
7751 return QStringLiteral(
"QColor(%1, %2, %3, %4)" ).arg(
c.red() ).arg(
c.green() ).arg(
c.blue() ).arg(
c.alpha() );
7754 const QString s = value.toString();
7760 QString code = QStringLiteral(
"##%1=" ).arg(
mName );
7762 code += QLatin1String(
"optional " );
7763 code += QLatin1String(
"color " );
7765 if ( mAllowOpacity )
7766 code += QLatin1String(
"withopacity " );
7769 return code.trimmed();
7774 switch ( outputType )
7778 QString code = QStringLiteral(
"QgsProcessingParameterColor('%1', %2" )
7781 code += QLatin1String(
", optional=True" );
7783 code += QStringLiteral(
", opacityEnabled=%1" ).arg( mAllowOpacity ? QStringLiteral(
"True" ) : QStringLiteral(
"False" ) );
7795 if ( !input.isValid() && (
mDefault.isValid() && ( !
mDefault.toString().isEmpty() ||
mDefault.value< QColor >().isValid() ) ) )
7798 if ( !input.isValid() )
7801 if ( input.type() == QVariant::Color )
7805 else if ( input.userType() == QMetaType::type(
"QgsProperty" ) )
7810 if ( input.type() != QVariant::String || input.toString().isEmpty() )
7813 bool containsAlpha =
false;
7820 map.insert( QStringLiteral(
"opacityEnabled" ), mAllowOpacity );
7827 mAllowOpacity = map.value( QStringLiteral(
"opacityEnabled" ) ).toBool();
7833 return mAllowOpacity;
7838 mAllowOpacity = enabled;
7843 QString def = definition;
7845 bool allowOpacity =
false;
7846 if ( def.startsWith( QLatin1String(
"withopacity" ), Qt::CaseInsensitive ) )
7848 allowOpacity =
true;
7849 def = def.mid( 12 );
7852 if ( def.startsWith(
'"' ) || def.startsWith(
'\'' ) )
7854 if ( def.endsWith(
'"' ) || def.endsWith(
'\'' ) )
7858 if ( def == QLatin1String(
"None" ) )
7869 , mSourceParameterName( sourceCrsParameterName )
7870 , mDestParameterName( destinationCrsParameterName )
7871 , mSourceCrs( staticSourceCrs )
7872 , mDestCrs( staticDestinationCrs )
7885 return QStringLiteral(
"None" );
7887 if ( value.userType() == QMetaType::type(
"QgsCoordinateReferenceSystem" ) )
7890 return QStringLiteral(
"QgsCoordinateReferenceSystem()" );
7895 if ( value.userType() == QMetaType::type(
"QgsProperty" ) )
7896 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( value.value<
QgsProperty >().
asExpression() );
7899 p.insert(
name(), value );
7904 const QString s = value.toString();
7910 QString code = QStringLiteral(
"##%1=" ).arg(
mName );
7912 code += QLatin1String(
"optional " );
7913 code += QLatin1String(
"coordinateoperation " );
7916 return code.trimmed();
7921 switch ( outputType )
7926 QString code = QStringLiteral(
"QgsProcessingParameterCoordinateOperation('%1', %2" )
7929 code += QLatin1String(
", optional=True" );
7930 if ( !mSourceParameterName.isEmpty() )
7931 code += QStringLiteral(
", sourceCrsParameterName=%1" ).arg(
valueAsPythonString( mSourceParameterName,
c ) );
7932 if ( !mDestParameterName.isEmpty() )
7933 code += QStringLiteral(
", destinationCrsParameterName=%1" ).arg(
valueAsPythonString( mDestParameterName,
c ) );
7935 if ( mSourceCrs.isValid() )
7937 if ( mDestCrs.isValid() )
7938 code += QStringLiteral(
", staticDestinationCrs=%1" ).arg(
valueAsPythonString( mDestCrs,
c ) );
7950 if ( !mSourceParameterName.isEmpty() )
7951 res << mSourceParameterName;
7952 if ( !mDestParameterName.isEmpty() )
7953 res << mDestParameterName;
7960 map.insert( QStringLiteral(
"source_crs_parameter_name" ), mSourceParameterName );
7961 map.insert( QStringLiteral(
"dest_crs_parameter_name" ), mDestParameterName );
7962 map.insert( QStringLiteral(
"static_source_crs" ), mSourceCrs );
7963 map.insert( QStringLiteral(
"static_dest_crs" ), mDestCrs );
7970 mSourceParameterName = map.value( QStringLiteral(
"source_crs_parameter_name" ) ).toString();
7971 mDestParameterName = map.value( QStringLiteral(
"dest_crs_parameter_name" ) ).toString();
7972 mSourceCrs = map.value( QStringLiteral(
"static_source_crs" ) );
7973 mDestCrs = map.value( QStringLiteral(
"static_dest_crs" ) );
7979 QString def = definition;
7981 if ( def.startsWith(
'"' ) || def.startsWith(
'\'' ) )
7983 if ( def.endsWith(
'"' ) || def.endsWith(
'\'' ) )
7987 if ( def == QLatin1String(
"None" ) )
8012 if ( !input.isValid() && !
mDefault.isValid() )
8015 if ( ( input.type() == QVariant::String && input.toString().isEmpty() )
8016 || ( !input.isValid() &&
mDefault.type() == QVariant::String &&
mDefault.toString().isEmpty() ) )
8024 if ( !value.isValid() )
8025 return QStringLiteral(
"None" );
8027 if ( value.userType() == QMetaType::type(
"QgsProperty" ) )
8028 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( value.value<
QgsProperty >().
asExpression() );
8035 QString code = QStringLiteral(
"##%1=" ).arg(
mName );
8037 code += QLatin1String(
"optional " );
8038 code += QLatin1String(
"maptheme " );
8041 return code.trimmed();
8046 switch ( outputType )
8050 QString code = QStringLiteral(
"QgsProcessingParameterMapTheme('%1', %2" )
8053 code += QLatin1String(
", optional=True" );
8078 QString def = definition;
8079 if ( def.startsWith(
'"' ) || def.startsWith(
'\'' ) )
8081 if ( def.endsWith(
'"' ) || def.endsWith(
'\'' ) )
8103 if ( mMin.isValid() && mMax.isValid() && mMin >= mMax )
8105 QgsMessageLog::logMessage( QObject::tr(
"Invalid datetime parameter \"%1\": min value %2 is >= max value %3!" ).arg(
name, mMin.toString(), mMax.toString() ), QObject::tr(
"Processing" ) );
8116 QVariant input = value;
8117 if ( !input.isValid() )
8125 if ( input.userType() == QMetaType::type(
"QgsProperty" ) )
8130 if ( input.type() != QVariant::DateTime && input.type() != QVariant::Date && input.type() != QVariant::Time && input.type() != QVariant::String )
8133 if ( ( input.type() == QVariant::DateTime || input.type() == QVariant::Date ) && mDataType ==
Time )
8136 if ( input.type() == QVariant::String )
8138 const QString s = input.toString();
8142 input = QDateTime::fromString( s, Qt::ISODate );
8143 if ( mDataType ==
Time )
8145 if ( !input.toDateTime().isValid() )
8146 input = QTime::fromString( s );
8148 input = input.toDateTime().time();
8152 if ( mDataType !=
Time )
8154 const QDateTime res = input.toDateTime();
8155 return res.isValid() && ( res >= mMin || !mMin.isValid() ) && ( res <= mMax || !mMax.isValid() );
8159 const QTime res = input.toTime();
8160 return res.isValid() && ( res >= mMin.time() || !mMin.isValid() ) && ( res <= mMax.time() || !mMax.isValid() );
8166 if ( !value.isValid() )
8167 return QStringLiteral(
"None" );
8169 if ( value.userType() == QMetaType::type(
"QgsProperty" ) )
8170 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( value.value<
QgsProperty >().
asExpression() );
8172 if ( value.type() == QVariant::DateTime )
8174 const QDateTime dt = value.toDateTime();
8175 if ( !dt.isValid() )
8176 return QStringLiteral(
"QDateTime()" );
8178 return QStringLiteral(
"QDateTime(QDate(%1, %2, %3), QTime(%4, %5, %6))" ).arg( dt.date().year() )
8179 .arg( dt.date().month() )
8180 .arg( dt.date().day() )
8181 .arg( dt.time().hour() )
8182 .arg( dt.time().minute() )
8183 .arg( dt.time().second() );
8185 else if ( value.type() == QVariant::Date )
8187 const QDate dt = value.toDate();
8188 if ( !dt.isValid() )
8189 return QStringLiteral(
"QDate()" );
8191 return QStringLiteral(
"QDate(%1, %2, %3)" ).arg( dt.year() )
8195 else if ( value.type() == QVariant::Time )
8197 const QTime dt = value.toTime();
8198 if ( !dt.isValid() )
8199 return QStringLiteral(
"QTime()" );
8201 return QStringLiteral(
"QTime(%4, %5, %6)" )
8204 .arg( dt.second() );
8206 return value.toString();
8213 if ( mMin.isValid() )
8214 parts << QObject::tr(
"Minimum value: %1" ).arg( mMin.toString( Qt::ISODate ) );
8215 if ( mMax.isValid() )
8216 parts << QObject::tr(
"Maximum value: %1" ).arg( mMax.toString( Qt::ISODate ) );
8218 parts << QObject::tr(
"Default value: %1" ).arg( mDataType ==
DateTime ?
mDefault.toDateTime().toString( Qt::ISODate ) :
8219 ( mDataType ==
Date ?
mDefault.toDate().toString( Qt::ISODate ) :
mDefault.toTime( ).toString() ) );
8220 const QString extra = parts.join( QLatin1String(
"<br />" ) );
8221 if ( !extra.isEmpty() )
8222 text += QStringLiteral(
"<p>%1</p>" ).arg( extra );
8228 switch ( outputType )
8232 QString code = QStringLiteral(
"QgsProcessingParameterDateTime('%1', %2" )
8235 code += QLatin1String(
", optional=True" );
8237 code += QStringLiteral(
", type=%1" ).arg( mDataType ==
DateTime ? QStringLiteral(
"QgsProcessingParameterDateTime.DateTime" )
8238 : mDataType ==
Date ? QStringLiteral(
"QgsProcessingParameterDateTime.Date" )
8239 : QStringLiteral(
"QgsProcessingParameterDateTime.Time" ) );
8242 if ( mMin.isValid() )
8244 if ( mMax.isValid() )
8286 map.insert( QStringLiteral(
"min" ), mMin );
8287 map.insert( QStringLiteral(
"max" ), mMax );
8288 map.insert( QStringLiteral(
"data_type" ), mDataType );
8295 mMin = map.value( QStringLiteral(
"min" ) ).toDateTime();
8296 mMax = map.value( QStringLiteral(
"max" ) ).toDateTime();
8297 mDataType =
static_cast< Type >( map.value( QStringLiteral(
"data_type" ) ).toInt() );
8304 : ( definition.toLower().trimmed() == QLatin1String(
"none" ) ? QVariant() : definition ), isOptional );
8315 , mProviderId( provider )
8328 if ( !input.isValid() && !
mDefault.isValid() )
8331 if ( ( input.type() == QVariant::String && input.toString().isEmpty() )
8332 || ( !input.isValid() &&
mDefault.type() == QVariant::String &&
mDefault.toString().isEmpty() ) )
8340 if ( !value.isValid() )
8341 return QStringLiteral(
"None" );
8343 if ( value.userType() == QMetaType::type(
"QgsProperty" ) )
8344 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( value.value<
QgsProperty >().
asExpression() );
8351 QString code = QStringLiteral(
"##%1=" ).arg(
mName );
8353 code += QLatin1String(
"optional " );
8354 code += QLatin1String(
"providerconnection " );
8355 code += mProviderId +
' ';
8358 return code.trimmed();
8363 switch ( outputType )
8367 QString code = QStringLiteral(
"QgsProcessingParameterProviderConnection('%1', %2, '%3'" )
8370 code += QLatin1String(
", optional=True" );
8384 map.insert( QStringLiteral(
"provider" ), mProviderId );
8391 mProviderId = map.value( QStringLiteral(
"provider" ) ).toString();
8397 QString def = definition;
8399 if ( def.contains(
' ' ) )
8401 provider = def.left( def.indexOf(
' ' ) );
8402 def = def.mid( def.indexOf(
' ' ) + 1 );
8410 if ( def.startsWith(
'"' ) || def.startsWith(
'\'' ) )
8412 if ( def.endsWith(
'"' ) || def.endsWith(
'\'' ) )
8430 , mParentConnectionParameterName( parentLayerParameterName )
8443 if ( !input.isValid() && !
mDefault.isValid() )
8446 if ( ( input.type() == QVariant::String && input.toString().isEmpty() )
8447 || ( !input.isValid() &&
mDefault.type() == QVariant::String &&
mDefault.toString().isEmpty() ) )
8455 if ( !value.isValid() )
8456 return QStringLiteral(
"None" );
8458 if ( value.userType() == QMetaType::type(
"QgsProperty" ) )
8459 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( value.value<
QgsProperty >().
asExpression() );
8466 QString code = QStringLiteral(
"##%1=" ).arg(
mName );
8468 code += QLatin1String(
"optional " );
8469 code += QLatin1String(
"databaseschema " );
8471 code += mParentConnectionParameterName +
' ';
8474 return code.trimmed();
8479 switch ( outputType )
8483 QString code = QStringLiteral(
"QgsProcessingParameterDatabaseSchema('%1', %2" )
8486 code += QLatin1String(
", optional=True" );
8488 code += QStringLiteral(
", connectionParameterName='%1'" ).arg( mParentConnectionParameterName );
8502 QStringList depends;
8503 if ( !mParentConnectionParameterName.isEmpty() )
8504 depends << mParentConnectionParameterName;
8510 return mParentConnectionParameterName;
8515 mParentConnectionParameterName =
name;
8521 map.insert( QStringLiteral(
"mParentConnectionParameterName" ), mParentConnectionParameterName );
8528 mParentConnectionParameterName = map.value( QStringLiteral(
"mParentConnectionParameterName" ) ).toString();
8535 QString def = definition;
8537 const QRegularExpression re( QStringLiteral(
"(.*?)\\s+(.*)$" ) );
8538 const QRegularExpressionMatch m = re.match( def );
8541 parent = m.captured( 1 ).trimmed();
8542 def = m.captured( 2 );
8558 const QString &connectionParameterName,
8559 const QString &schemaParameterName,
8560 const QVariant &defaultValue,
bool optional,
bool allowNewTableNames )
8562 , mParentConnectionParameterName( connectionParameterName )
8563 , mParentSchemaParameterName( schemaParameterName )
8564 , mAllowNewTableNames( allowNewTableNames )
8577 if ( !input.isValid() && !
mDefault.isValid() )
8580 if ( ( input.type() == QVariant::String && input.toString().isEmpty() )
8581 || ( !input.isValid() &&
mDefault.type() == QVariant::String &&
mDefault.toString().isEmpty() ) )
8589 if ( !value.isValid() )
8590 return QStringLiteral(
"None" );
8592 if ( value.userType() == QMetaType::type(
"QgsProperty" ) )
8593 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( value.value<
QgsProperty >().
asExpression() );
8600 QString code = QStringLiteral(
"##%1=" ).arg(
mName );
8602 code += QLatin1String(
"optional " );
8603 code += QLatin1String(
"databasetable " );
8605 code += ( mParentConnectionParameterName.isEmpty() ? QStringLiteral(
"none" ) : mParentConnectionParameterName ) +
' ';
8606 code += ( mParentSchemaParameterName.isEmpty() ? QStringLiteral(
"none" ) : mParentSchemaParameterName ) +
' ';
8609 return code.trimmed();
8614 switch ( outputType )
8618 QString code = QStringLiteral(
"QgsProcessingParameterDatabaseTable('%1', %2" )
8621 code += QLatin1String(
", optional=True" );
8623 if ( mAllowNewTableNames )
8624 code += QLatin1String(
", allowNewTableNames=True" );
8626 code += QStringLiteral(
", connectionParameterName='%1'" ).arg( mParentConnectionParameterName );
8627 code += QStringLiteral(
", schemaParameterName='%1'" ).arg( mParentSchemaParameterName );
8641 QStringList depends;
8642 if ( !mParentConnectionParameterName.isEmpty() )
8643 depends << mParentConnectionParameterName;
8644 if ( !mParentSchemaParameterName.isEmpty() )
8645 depends << mParentSchemaParameterName;
8651 return mParentConnectionParameterName;
8656 mParentConnectionParameterName =
name;
8661 return mParentSchemaParameterName;
8666 mParentSchemaParameterName =
name;
8672 map.insert( QStringLiteral(
"mParentConnectionParameterName" ), mParentConnectionParameterName );
8673 map.insert( QStringLiteral(
"mParentSchemaParameterName" ), mParentSchemaParameterName );
8674 map.insert( QStringLiteral(
"mAllowNewTableNames" ), mAllowNewTableNames );
8681 mParentConnectionParameterName = map.value( QStringLiteral(
"mParentConnectionParameterName" ) ).toString();
8682 mParentSchemaParameterName = map.value( QStringLiteral(
"mParentSchemaParameterName" ) ).toString();
8683 mAllowNewTableNames = map.value( QStringLiteral(
"mAllowNewTableNames" ),
false ).toBool();
8691 QString def = definition;
8693 const QRegularExpression re( QStringLiteral(
"(.*?)\\s+(.*+)\\b\\s*(.*)$" ) );
8694 const QRegularExpressionMatch m = re.match( def );
8697 connection = m.captured( 1 ).trimmed();
8698 if ( connection == QLatin1String(
"none" ) )
8700 schema = m.captured( 2 ).trimmed();
8701 if ( schema == QLatin1String(
"none" ) )
8703 def = m.captured( 3 );
8711 return mAllowNewTableNames;
8724 const QVariant &defaultValue,
bool optional )
8741 if ( var.userType() == QMetaType::type(
"QgsProperty" ) )
8754 if ( qobject_cast< QgsPointCloudLayer * >( qvariant_cast<QObject *>( var ) ) )
8757 if ( var.type() != QVariant::String || var.toString().isEmpty() )
8775 if ( !val.isValid() )
8776 return QStringLiteral(
"None" );
8778 if ( val.userType() == QMetaType::type(
"QgsProperty" ) )
8782 p.insert(
name(), val );
8813 const QVariant &defaultValue,
bool optional )
8830 if ( var.userType() == QMetaType::type(
"QgsProperty" ) )
8843 if ( qobject_cast< QgsAnnotationLayer * >( qvariant_cast<QObject *>( var ) ) )
8846 if ( var.type() != QVariant::String || var.toString().isEmpty() )
8864 if ( !val.isValid() )
8865 return QStringLiteral(
"None" );
8867 if ( val.userType() == QMetaType::type(
"QgsProperty" ) )
8871 p.insert(
name(), val );
8904 QVariant var = input;
8905 if ( !var.isValid() )
8908 if ( var.userType() == QMetaType::type(
"QgsProcessingOutputLayerDefinition" ) )
8914 if ( var.userType() == QMetaType::type(
"QgsProperty" ) )
8927 if ( var.type() != QVariant::String )
8930 if ( var.toString().isEmpty() )
8938 if ( !value.isValid() )
8939 return QStringLiteral(
"None" );
8941 if ( value.userType() == QMetaType::type(
"QgsProperty" ) )
8942 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( value.value<
QgsProperty >().
asExpression() );
8944 if ( value.userType() == QMetaType::type(
"QgsProcessingOutputLayerDefinition" ) )
8953 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( fromVar.
sink.
asExpression() );
8969 return lOriginalProvider->defaultPointCloudFileExtension();
8973 return p->defaultPointCloudFileExtension();
8984 QStringList filters;
8985 for (
const QString &ext : exts )
8987 filters << QObject::tr(
"%1 files (*.%2)" ).arg( ext.toUpper(), ext.toLower() );
8989 return filters.join( QLatin1String(
";;" ) ) + QStringLiteral(
";;" ) + QObject::tr(
"All files (*.*)" );
8996 return lOriginalProvider->supportedOutputPointCloudLayerExtensions();
9000 return p->supportedOutputPointCloudLayerExtensions();
9005 return QStringList() << QObject::tr(
"%1 files (*.%2)" ).arg( ext.toUpper(), ext.toLower() );
DistanceUnit
Units of distance.
TemporalUnit
Temporal units.
GeometryType
The geometry types are used to group Qgis::WkbType in a coarse way.
WkbType
The WKB type describes the number of dimensions a geometry has.
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,...
This class represents a coordinate reference system (CRS).
bool isValid() const
Returns whether this CRS is correctly initialized and usable.
@ WKT_PREFERRED
Preferred format, matching the most recent WKT ISO standard. Currently an alias to WKT2_2019,...
QString toWkt(WktVariant variant=WKT1_GDAL, bool multiline=false, int indentationWidth=4) const
Returns a WKT representation of this CRS.
Custom exception class for Coordinate Reference System related exceptions.
Class for parsing and evaluation of expressions (formerly called "search strings").
bool isValid() const
Checks if this expression is valid.
InvalidGeometryCheck
Handling of features with invalid geometries.
@ GeometryNoCheck
No invalid geometry checking.
@ GeometryAbortOnInvalid
Close iterator on encountering any features with invalid geometry. This requires a slow geometry vali...
@ GeometrySkipInvalid
Skip any features with invalid geometry. This requires a slow geometry validity check for every featu...
An interface for objects which accept features via addFeature(s) methods.
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...
Qgis::GeometryOperationResult transform(const QgsCoordinateTransform &ct, Qgis::TransformDirection direction=Qgis::TransformDirection::Forward, bool transformZ=false) SIP_THROW(QgsCsException)
Transforms this geometry as described by the coordinate transform ct.
static QgsGeometry fromRect(const QgsRectangle &rect) SIP_HOLDGIL
Creates a new geometry from a QgsRectangle.
bool isMultipart() const SIP_HOLDGIL
Returns true if WKB of the geometry is of WKBMulti* type.
QgsPointXY asPoint() const
Returns the contents of the geometry as a 2-dimensional point.
static QgsGeometry fromPointXY(const QgsPointXY &point) SIP_HOLDGIL
Creates a new geometry from a QgsPointXY object.
QgsGeometry centroid() const
Returns the center of mass of a geometry.
QString lastError() const SIP_HOLDGIL
Returns an error string referring to the last error encountered either when this geometry was created...
static QgsGeometry fromWkt(const QString &wkt)
Creates a new geometry from a WKT string.
QgsRectangle boundingBox() const
Returns the bounding box of the geometry.
QString asWkt(int precision=17) const
Exports the geometry to WKT.
Base class for graphical items within a QgsLayout.
QgsMasterLayoutInterface * layoutByName(const QString &name) const
Returns the layout with a matching name, or nullptr if no matching layouts were found.
QgsLayoutItem * itemById(const QString &id) const
Returns a layout item given its id.
QgsLayoutItem * itemByUuid(const QString &uuid, bool includeTemplateUuids=false) const
Returns the layout item with matching uuid unique identifier, or nullptr if a matching item could not...
Base class for all map layer types.
virtual QgsRectangle extent() const
Returns the extent of the layer.
QString source() const
Returns the source for the layer.
QgsCoordinateReferenceSystem crs
QString id() const
Returns the layer's unique ID, which is used to access this layer from QgsProject.
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)
Adds a message to the log instance (and creates it if necessary).
Represents a map layer supporting display of point clouds.
A class to represent a 2D point.
Print layout, a QgsLayout subclass for static or atlas-based layouts.
Abstract base class for processing algorithms.
QgsProcessingProvider * provider() const
Returns the provider to which this algorithm belongs.
Details for layers to load into projects.
Contains information about the context in which a processing algorithm is executed.
QgsExpressionContext & expressionContext()
Returns the expression context.
void addLayerToLoadOnCompletion(const QString &layer, const QgsProcessingContext::LayerDetails &details)
Adds a layer to load (by ID or datasource) into the canvas upon completion of the algorithm or model.
QgsProject * project() const
Returns the project in which the algorithm is being executed.
Base class for all parameter definitions which represent file or layer destinations,...
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.
virtual QString generateTemporaryDestination() const
Generates a temporary destination value for this parameter.
bool supportsNonFileBasedOutput() const
Returns true if the destination parameter supports non filed-based outputs, such as memory layers or ...
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonQgsProcessingAlgorithmSubclass) const override
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
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.
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.
Flags flags
Flags which dictate source behavior.
bool selectedFeaturesOnly
true if only selected features in the source should be used by algorithms.
QgsFeatureRequest::InvalidGeometryCheck geometryCheck
Geometry check method to apply to this source.
QgsProperty source
Source definition.
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.
QgsFeatureSource subclass which proxies methods to an underlying QgsFeatureSource,...
Base class for providing feedback from a processing algorithm.
Base class for the definition of processing outputs.
A file output for processing algorithms.
A folder output for processing algorithms.
A HTML file output for processing algorithms.
Encapsulates settings relating to a feature sink or output raster layer for a processing algorithm.
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.
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.
An annotation layer parameter 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.
A string parameter for authentication configuration ID values.
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.
A raster band parameter for Processing algorithms.
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::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.
A boolean parameter for processing algorithms.
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.
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonQgsProcessingAlgorithmSubclass) const override
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
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.
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
A coordinate operation parameter for processing algorithms, for selection between available coordinat...
static QString typeName()
Returns the type name for the parameter class.
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...
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.
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::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.
A coordinate reference system parameter for processing algorithms.
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).
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.
A database schema parameter for processing algorithms, allowing users to select from existing schemas...
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 asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::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.
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.
A database table name parameter for processing algorithms, allowing users to select from existing dat...
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::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.
A datetime (or pure date or time) parameter for processing algorithms.
@ DateTime
Datetime values.
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
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.
bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable 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.
QgsProcessingParameterDateTime(const QString &name, const QString &description=QString(), Type type=DateTime, const QVariant &defaultValue=QVariant(), bool optional=false, const QDateTime &minValue=QDateTime(), const QDateTime &maxValue=QDateTime())
Constructor for QgsProcessingParameterDateTime.
QVariantMap toVariantMap() const override
Saves this parameter to a QVariantMap.
Type dataType() const
Returns the acceptable data type for the parameter.
void setDataType(Type type)
Sets the acceptable data type for the parameter.
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::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.
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.
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...
virtual QStringList valueAsStringList(const QVariant &value, QgsProcessingContext &context, bool &ok) const
Returns a string list version of the parameter input value (if possible).
Flags mFlags
Parameter flags.
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.
virtual QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonQgsProcessingAlgorithmSubclass) const
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
QString mName
Parameter name.
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.
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...
@ FlagOptional
Parameter is optional.
QString mDescription
Parameter description.
virtual QString type() const =0
Unique parameter type name.
Flags flags() const
Returns any flags associated with the parameter.
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.
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.
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.
A double numeric parameter for distance values.
void setParentParameterName(const QString &parentParameterName)
Sets the name of the parent layer parameter.
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.
QgsProcessingParameterDistance * clone() const override
Creates a clone of the parameter definition.
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonQgsProcessingAlgorithmSubclass) const override
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
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.
A double numeric parameter for duration values.
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
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::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...
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...
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonQgsProcessingAlgorithmSubclass) const override
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
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.
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.
An expression parameter for processing algorithms.
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 asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::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.
QStringList dependsOnOtherParameters() const override
Returns a list of other parameter names on which this parameter is dependent (e.g.
QgsProcessingParameterExpression(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), const QString &parentLayerParameterName=QString(), bool optional=false)
Constructor for QgsProcessingParameterExpression.
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.
static QString typeName()
Returns the type name for the parameter class.
A rectangular map extent 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...
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).
A feature sink output for processing algorithms.
QString generateTemporaryDestination() 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.
QgsProcessing::SourceType dataType() const
Returns the layer type for 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.
QgsProcessingParameterFeatureSink(const QString &name, const QString &description=QString(), QgsProcessing::SourceType type=QgsProcessing::TypeVectorAnyGeometry, const QVariant &defaultValue=QVariant(), bool optional=false, bool createByDefault=true, bool supportsAppend=false)
Constructor for QgsProcessingParameterFeatureSink.
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.
void setDataType(QgsProcessing::SourceType type)
Sets the layer type for the sinks associated with the parameter.
bool supportsAppend() const
Returns true if the sink supports appending features to an existing table.
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::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.
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.
An input feature source (such as vector layers) parameter for processing algorithms.
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.
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::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 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 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.
A vector layer or feature source field parameter for processing algorithms.
QgsProcessingParameterField(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), const QString &parentLayerParameterName=QString(), DataType type=Any, bool allowMultiple=false, bool optional=false, bool defaultToAllFields=false)
Constructor for QgsProcessingParameterField.
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 setDataType(DataType type)
Sets the acceptable data type for the field.
void setParentLayerParameterName(const QString &parentLayerParameterName)
Sets the name of the parent layer parameter.
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.
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.
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::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 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 setAllowMultiple(bool allowMultiple)
Sets whether multiple field selections are permitted.
DataType
Field data types.
@ DateTime
Accepts datetime fields.
@ Numeric
Accepts numeric fields.
@ String
Accepts string fields.
DataType dataType() const
Returns the acceptable data type for the field.
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.
A generic file based destination parameter, for specifying the destination path for a file (non-map l...
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::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.
An input file or folder parameter for processing algorithms.
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 asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::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.
void setFileFilter(const QString &filter)
Sets the file filter string for file destinations compatible with this parameter.
static QgsProcessingParameterFile * fromScriptCode(const QString &name, const QString &description, bool isOptional, const QString &definition, Behavior behavior=File)
Creates a new parameter using the definition from a script code.
Behavior
Parameter behavior.
@ Folder
Parameter is a folder.
@ File
Parameter is a single file.
Behavior behavior() const
Returns the parameter behavior (e.g.
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.
QgsProcessingParameterFile(const QString &name, const QString &description=QString(), Behavior behavior=File, const QString &extension=QString(), const QVariant &defaultValue=QVariant(), bool optional=false, const QString &fileFilter=QString())
Constructor for QgsProcessingParameterFile.
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.
A folder destination parameter, for specifying the destination path for a folder created by the algor...
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.
A geometry parameter for processing algorithms.
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 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.
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonQgsProcessingAlgorithmSubclass) const override
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
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.
QVariantMap toVariantMap() const override
Saves this parameter to a QVariantMap.
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
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.
A print layout item parameter, allowing users to select a particular item from a print layout.
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.
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::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.
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.
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.
A print layout parameter, allowing users to select a print layout.
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 asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonQgsProcessingAlgorithmSubclass) const override
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
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.
Can be inherited by parameters which require limits to their acceptable data types.
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.
A map layer parameter for processing algorithms.
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 asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonQgsProcessingAlgorithmSubclass) const override
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
QString type() const override
Unique parameter type name.
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.
A map theme parameter for processing algorithms, allowing users to select an existing map theme from ...
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::PythonQgsProcessingAlgorithmSubclass) const override
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
A table (matrix) parameter for processing algorithms.
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.
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonQgsProcessingAlgorithmSubclass) const override
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
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.
bool hasFixedNumberRows() const
Returns whether the table has a fixed number of rows.
A mesh layer parameter for processing algorithms.
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.
A parameter for processing algorithms which accepts multiple map layers.
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.
QgsProcessingParameterMultipleLayers(const QString &name, const QString &description=QString(), QgsProcessing::SourceType layerType=QgsProcessing::TypeVectorAnyGeometry, const QVariant &defaultValue=QVariant(), bool optional=false)
Constructor for QgsProcessingParameterMultipleLayers.
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.
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...
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonQgsProcessingAlgorithmSubclass) const override
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
void setLayerType(QgsProcessing::SourceType type)
Sets the layer type for layers acceptable by the parameter.
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.
QgsProcessing::SourceType layerType() const
Returns the layer type for layers acceptable by the parameter.
QString type() const override
Unique parameter type name.
int minimumNumberInputs() const
Returns the minimum number of layers required for the parameter.
A numeric parameter for processing algorithms.
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
Double/float values.
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonQgsProcessingAlgorithmSubclass) const override
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
double maximum() const
Returns the maximum value acceptable by the parameter.
QgsProcessingParameterNumber(const QString &name, const QString &description=QString(), Type type=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(Type type)
Sets the acceptable data type for the parameter.
bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
Type dataType() const
Returns the acceptable data type for the parameter.
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.
static QString typeName()
Returns the type name for the parameter class.
A point cloud layer destination parameter, for specifying the destination path for a point cloud laye...
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...
A point cloud layer 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...
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.
A point parameter for processing algorithms.
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...
A data provider connection parameter for processing algorithms, allowing users to select from availab...
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::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.
A numeric range parameter for processing algorithms.
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
QgsProcessingParameterNumber::Type dataType() const
Returns the acceptable data type for the range.
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::PythonQgsProcessingAlgorithmSubclass) const override
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
void setDataType(QgsProcessingParameterNumber::Type dataType)
Sets the acceptable data type for the range.
QgsProcessingParameterRange(const QString &name, const QString &description=QString(), QgsProcessingParameterNumber::Type type=QgsProcessingParameterNumber::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...
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.
A raster layer destination parameter, for specifying the destination path for a raster layer created ...
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.
virtual 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.
A raster layer parameter for processing algorithms.
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...
A double numeric parameter for map scale values.
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::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.
A string parameter for processing algorithms.
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 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::PythonQgsProcessingAlgorithmSubclass) const override
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
Makes metadata of processing parameters available.
virtual QgsProcessingParameterDefinition * create(const QString &name) const =0
Creates a new parameter of this type.
A vector layer destination parameter, for specifying the destination path for a vector layer created ...
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...
QgsProcessing::SourceType dataType() const
Returns the layer type for this created vector layer.
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonQgsProcessingAlgorithmSubclass) const override
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
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.
void setDataType(QgsProcessing::SourceType type)
Sets the layer type for the created vector layer.
QgsProcessingParameterVectorDestination(const QString &name, const QString &description=QString(), QgsProcessing::SourceType type=QgsProcessing::TypeVectorAnyGeometry, const QVariant &defaultValue=QVariant(), bool optional=false, bool createByDefault=true)
Constructor for QgsProcessingParameterVectorDestination.
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.
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...
A vector layer (with or without geometry) parameter for processing algorithms.
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...
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonQgsProcessingAlgorithmSubclass) const override
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
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.
static QList< QgsMapLayer * > parameterAsLayerList(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context)
Evaluates the parameter with matching definition to a list of map layers.
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 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 QgsMapLayer * parameterAsLayer(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context, QgsProcessingUtils::LayerHint layerHint=QgsProcessingUtils::LayerHint::UnknownType)
Evaluates the parameter with matching definition to a map layer.
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 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 QgsPointCloudLayer * parameterAsPointCloudLayer(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context)
Evaluates the parameter with matching definition to a point cloud layer.
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 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 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...
QgsProcessingParameterType * parameterType(const QString &id) const
Returns the parameter type registered for id.
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)
Converts a source vector layer to a file path of a vector layer of compatible format.
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 normalizeLayerSource(const QString &source)
Normalizes a layer source string for safe comparison across different operating system environments.
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.
@ 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 generateTempFilename(const QString &basename)
Returns a temporary filename for a given file, putting it into a temporary folder (creating that fold...
static QgsProcessingFeatureSource * variantToSource(const QVariant &value, QgsProcessingContext &context, const QVariant &fallbackValue=QVariant())
Converts a variant value to a new feature source.
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)
Converts a source vector layer to a file path and layer name of a vector layer of compatible format.
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 QgsMapLayer * mapLayerFromString(const QString &string, QgsProcessingContext &context, bool allowLoadingNewLayers=true, QgsProcessingUtils::LayerHint typeHint=QgsProcessingUtils::LayerHint::UnknownType)
Interprets a string as a map layer within the supplied context.
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 defaultRasterExtension()
Returns the default raster extension to use, in the absence of all other constraints (e....
static QString defaultPointCloudExtension()
Returns the default point cloud extension to use, in the absence of all other constraints (e....
static const QString TEMPORARY_OUTPUT
Constant used to indicate that a Processing algorithm output should be a temporary layer/file.
PythonOutputType
Available Python output types.
@ PythonQgsProcessingAlgorithmSubclass
Full Python QgsProcessingAlgorithm subclass.
SourceType
Data source types enum.
@ TypePlugin
Plugin layers.
@ TypeVectorLine
Vector line layers.
@ TypeMapLayer
Any map layer type (raster, vector, mesh, point cloud, annotation or plugin layer)
@ TypeVectorPolygon
Vector polygon layers.
@ TypeFile
Files (i.e. non map layer sources, such as text files)
@ TypeAnnotation
Annotation layers.
@ TypePointCloud
Point cloud layers.
@ TypeVector
Tables (i.e. vector layers with or without geometry). When used for a sink this indicates the sink ha...
@ TypeRaster
Raster layers.
@ TypeVectorPoint
Vector point layers.
@ TypeVectorAnyGeometry
Any vector layer with geometry.
static QString sourceTypeToString(SourceType type)
Converts a source type to a string representation.
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.
@ ExpressionBasedProperty
Expression based property (QgsExpressionBasedProperty)
@ StaticProperty
Static property (QgsStaticProperty)
@ FieldBasedProperty
Field based property (QgsFieldBasedProperty)
@ InvalidProperty
Invalid (not set) property.
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.
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 toVariant() const
Saves this property to a QVariantMap, wrapped in a QVariant.
bool loadVariant(const QVariant &property)
Loads this property from a QVariantMap, wrapped in a QVariant.
QVariant staticValue() const
Returns the current static value for the property.
Type propertyType() const
Returns the property type.
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 supportedFormatExtensions(RasterFormatOptions options=SortRecommended)
Returns a list of file extensions for supported formats.
Represents a raster layer.
A rectangle specified with double values.
double yMaximum() const SIP_HOLDGIL
Returns the y maximum value (top side of rectangle).
double xMaximum() const SIP_HOLDGIL
Returns the x maximum value (right side of rectangle).
double xMinimum() const SIP_HOLDGIL
Returns the x minimum value (left side of rectangle).
double yMinimum() const SIP_HOLDGIL
Returns the y minimum value (bottom side of rectangle).
bool isNull() const
Test if the rectangle is null (all coordinates zero or after call to setMinimal()).
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 bool isNull(const QVariant &variant)
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 data sets.
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
QString qgsDoubleToString(double a, int precision=17)
Returns a string representation of a double.
QString parameterAsCompatibleSourceLayerPathInternal(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context, const QStringList &compatibleFormats, const QString &preferredFormat, QgsProcessingFeedback *feedback, QString *layerName)
QString createAllMapLayerFileFilter()
const QgsCoordinateReferenceSystem & crs