QGIS API Documentation
3.26.3-Buenos Aires (65e4edfdad)
|
Go to the documentation of this file.
42 #include <QRegularExpression>
50 map.insert( QStringLiteral(
"feature_limit" ),
featureLimit );
51 map.insert( QStringLiteral(
"flags" ),
static_cast< int >(
flags ) );
52 map.insert( QStringLiteral(
"geometry_check" ),
static_cast< int >(
geometryCheck ) );
60 featureLimit = map.value( QStringLiteral(
"feature_limit" ), -1 ).toLongLong();
61 flags =
static_cast< Flags
>( map.value( QStringLiteral(
"flags" ), 0 ).toInt() );
74 mRemappingDefinition = definition;
81 map.insert( QStringLiteral(
"create_options" ),
createOptions );
83 map.insert( QStringLiteral(
"remapping" ), QVariant::fromValue( mRemappingDefinition ) );
90 createOptions = map.value( QStringLiteral(
"create_options" ) ).toMap();
91 if ( map.contains( QStringLiteral(
"remapping" ) ) )
98 mUseRemapping =
false;
106 && mUseRemapping == other.mUseRemapping && mRemappingDefinition == other.mRemappingDefinition;
111 return !( *
this == other );
116 const QVariant val = parameters.value( name );
136 QVariant val = value;
140 if ( !val.isValid() )
149 return destParam->generateTemporaryDestination();
152 return val.toString();
168 const QVariant val = value;
172 if ( val.isValid() && !val.toString().isEmpty() )
176 return val.toString();
196 QVariant val = value;
201 const double res = val.toDouble( &ok );
207 return val.toDouble();
223 QVariant val = value;
228 double dbl = val.toDouble( &ok );
233 dbl = val.toDouble( &ok );
240 const double round = std::round( dbl );
241 if ( round > std::numeric_limits<int>::max() || round < -std::numeric_limits<int>::max() )
246 return static_cast< int >( std::round( dbl ) );
255 return QList< int >();
263 return QList< int >();
265 QList< int > resultList;
266 const QVariant val = value;
271 else if ( val.type() == QVariant::List )
273 const QVariantList list = val.toList();
274 for (
auto it = list.constBegin(); it != list.constEnd(); ++it )
275 resultList << it->toInt();
279 const QStringList parts = val.toString().split(
';' );
280 for (
auto it = parts.constBegin(); it != parts.constEnd(); ++it )
281 resultList << it->toInt();
285 if ( resultList.isEmpty() )
290 if ( definition->
defaultValue().type() == QVariant::List )
292 const QVariantList list = definition->
defaultValue().toList();
293 for (
auto it = list.constBegin(); it != list.constEnd(); ++it )
294 resultList << it->toInt();
298 const QStringList parts = definition->
defaultValue().toString().split(
';' );
299 for (
auto it = parts.constBegin(); it != parts.constEnd(); ++it )
300 resultList << it->toInt();
321 QVariant val = value;
325 QDateTime d = val.toDateTime();
326 if ( !d.isValid() && val.type() == QVariant::String )
328 d = QDateTime::fromString( val.toString() );
335 d = val.toDateTime();
337 if ( !d.isValid() && val.type() == QVariant::String )
339 d = QDateTime::fromString( val.toString() );
358 QVariant val = value;
362 QDate d = val.toDate();
363 if ( !d.isValid() && val.type() == QVariant::String )
365 d = QDate::fromString( val.toString() );
374 if ( !d.isValid() && val.type() == QVariant::String )
376 d = QDate::fromString( val.toString() );
395 QVariant val = value;
401 if ( val.type() == QVariant::DateTime )
402 d = val.toDateTime().time();
406 if ( !d.isValid() && val.type() == QVariant::String )
408 d = QTime::fromString( val.toString() );
417 if ( !d.isValid() && val.type() == QVariant::String )
419 d = QTime::fromString( val.toString() );
440 if ( enumDef && val >= enumDef->
options().size() )
460 QVariantList resultList;
461 const QVariant val = value;
464 else if ( val.type() == QVariant::List )
466 const auto constToList = val.toList();
467 for (
const QVariant &var : constToList )
470 else if ( val.type() == QVariant::String )
472 const auto constSplit = val.toString().split(
',' );
473 for (
const QString &var : constSplit )
479 if ( resultList.isEmpty() )
480 return QList< int >();
482 if ( ( !val.isValid() || !resultList.at( 0 ).isValid() ) && definition )
486 if ( definition->
defaultValue().type() == QVariant::List )
488 const auto constToList = definition->
defaultValue().toList();
489 for (
const QVariant &var : constToList )
492 else if ( definition->
defaultValue().type() == QVariant::String )
494 const auto constSplit = definition->
defaultValue().toString().split(
',' );
495 for (
const QString &var : constSplit )
504 const auto constResultList = resultList;
505 for (
const QVariant &var : constResultList )
507 const int resInt = var.toInt();
508 if ( !enumDef || resInt < enumDef->options().size() )
531 if ( enumText.isEmpty() || !enumDef->
options().contains( enumText ) )
540 return QStringList();
548 return QStringList();
550 const QVariant val = value;
552 QStringList enumValues;
554 std::function< void(
const QVariant &var ) > processVariant;
555 processVariant = [ &enumValues, &context, &definition, &processVariant ](
const QVariant & var )
557 if ( var.type() == QVariant::List )
559 const auto constToList = var.toList();
560 for (
const QVariant &listVar : constToList )
562 processVariant( listVar );
565 else if ( var.type() == QVariant::StringList )
567 const auto constToStringList = var.toStringList();
568 for (
const QString &s : constToStringList )
574 processVariant( var.value<
QgsProperty >().
valueAsString( context.expressionContext(), definition->defaultValue().toString() ) );
577 const QStringList parts = var.toString().split(
',' );
578 for (
const QString &s : parts )
585 processVariant( val );
591 #if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
592 QSet<QString> subtraction = enumValues.toSet().subtract( enumDef->
options().toSet() );
594 const QStringList options = enumDef->
options();
595 const QSet<QString> subtraction = QSet<QString>( enumValues.begin(), enumValues.end() ).subtract( QSet<QString>( options.begin(), options.end() ) );
598 if ( enumValues.isEmpty() || !subtraction.isEmpty() )
601 processVariant( definition->defaultValue() );
630 const QVariant val = value;
633 else if ( val.isValid() )
646 const QVariant val = value;
649 else if ( val.isValid() )
657 QgsProcessingContext &context, QString &destinationIdentifier, QgsFeatureSink::SinkFlags sinkFlags,
658 const QVariantMap &createOptions,
const QStringList &datasourceOptions,
const QStringList &layerOptions )
663 val = parameters.value( definition->
name() );
666 return parameterAsSink( definition, val, fields, geometryType,
crs, context, destinationIdentifier, sinkFlags, createOptions, datasourceOptions, layerOptions );
669 QgsFeatureSink *
QgsProcessingParameters::parameterAsSink(
const QgsProcessingParameterDefinition *definition,
const QVariant &value,
const QgsFields &fields,
QgsWkbTypes::Type geometryType,
const QgsCoordinateReferenceSystem &
crs,
QgsProcessingContext &context, QString &destinationIdentifier, QgsFeatureSink::SinkFlags sinkFlags,
const QVariantMap &createOptions,
const QStringList &datasourceOptions,
const QStringList &layerOptions )
671 QVariantMap options = createOptions;
672 QVariant val = value;
677 bool useRemapDefinition =
false;
689 useRemapDefinition =
true;
699 else if ( !val.isValid() || val.toString().isEmpty() )
715 dest = val.toString();
720 dest = destParam->generateTemporaryDestination();
723 if ( dest.isEmpty() )
726 std::unique_ptr< QgsFeatureSink > sink(
QgsProcessingUtils::createFeatureSink( dest, context, fields, geometryType,
crs, options, datasourceOptions, layerOptions, sinkFlags, useRemapDefinition ? &remapDefinition :
nullptr ) );
727 destinationIdentifier = dest;
729 if ( destinationProject )
731 if ( destName.isEmpty() && definition )
737 outputName = definition->
name();
741 return sink.release();
765 QVariant val = parameters.value( definition->
name() );
767 bool selectedFeaturesOnly =
false;
768 long long featureLimit = -1;
790 vl = qobject_cast< QgsVectorLayer * >( qvariant_cast<QObject *>( val ) );
799 else if ( !val.isValid() || val.toString().isEmpty() )
805 vl = qobject_cast< QgsVectorLayer * >( qvariant_cast<QObject *>( val ) );
811 layerRef = val.toString();
816 if ( layerRef.isEmpty() )
828 compatibleFormats, preferredFormat, context, feedback, *layerName, featureLimit );
831 compatibleFormats, preferredFormat, context, feedback, featureLimit );
841 QString *destLayer = layerName;
856 return parameterAsLayer( definition, parameters.value( definition->
name() ), context, layerHint );
864 QVariant val = value;
870 if (
QgsMapLayer *layer = qobject_cast< QgsMapLayer * >( qvariant_cast<QObject *>( val ) ) )
887 if ( !val.isValid() || val.toString().isEmpty() )
893 if (
QgsMapLayer *layer = qobject_cast< QgsMapLayer * >( qvariant_cast<QObject *>( val ) ) )
898 QString layerRef = val.toString();
899 if ( layerRef.isEmpty() )
902 if ( layerRef.isEmpty() )
933 val = parameters.value( definition->
name() );
940 QVariant val = value;
958 else if ( definition && ( !val.isValid() || val.toString().isEmpty() ) )
965 dest = val.toString();
970 dest = destParam->generateTemporaryDestination();
973 if ( destinationProject )
976 if ( destName.isEmpty() && definition )
981 outputName = definition->
name();
1002 val = parameters.value( definition->
name() );
1009 QVariant val = value;
1019 if ( definition && val.canConvert<
QgsProperty>() )
1023 else if ( definition && ( !val.isValid() || val.toString().isEmpty() ) )
1030 dest = val.toString();
1035 dest = destParam->generateTemporaryDestination();
1055 return parameterAsCrs( definition, parameters.value( definition->
name() ), context );
1080 QVariant val = value;
1130 QgsMapLayer *layer = qobject_cast< QgsMapLayer * >( qvariant_cast<QObject *>( val ) );
1136 rectText = val.toString();
1138 if ( rectText.isEmpty() && !layer )
1141 const QRegularExpression rx( QStringLiteral(
"^(.*?)\\s*,\\s*(.*?),\\s*(.*?),\\s*(.*?)\\s*(?:\\[(.*)\\])?\\s*$" ) );
1142 const QRegularExpressionMatch match = rx.match( rectText );
1143 if ( match.hasMatch() )
1145 bool xMinOk =
false;
1146 const double xMin = match.captured( 1 ).toDouble( &xMinOk );
1147 bool xMaxOk =
false;
1148 const double xMax = match.captured( 2 ).toDouble( &xMaxOk );
1149 bool yMinOk =
false;
1150 const double yMin = match.captured( 3 ).toDouble( &yMinOk );
1151 bool yMaxOk =
false;
1152 const double yMax = match.captured( 4 ).toDouble( &yMaxOk );
1153 if ( xMinOk && xMaxOk && yMinOk && yMaxOk )
1204 QVariant val = parameters.value( definition->
name() );
1212 g = g.densifyByCount( 20 );
1248 rectText = val.toString();
1250 if ( !rectText.isEmpty() )
1252 const QRegularExpression rx( QStringLiteral(
"^(.*?)\\s*,\\s*(.*?),\\s*(.*?),\\s*(.*?)\\s*(?:\\[(.*)\\])?\\s*$" ) );
1253 const QRegularExpressionMatch match = rx.match( rectText );
1254 if ( match.hasMatch() )
1256 bool xMinOk =
false;
1257 const double xMin = match.captured( 1 ).toDouble( &xMinOk );
1258 bool xMaxOk =
false;
1259 const double xMax = match.captured( 2 ).toDouble( &xMaxOk );
1260 bool yMinOk =
false;
1261 const double yMin = match.captured( 3 ).toDouble( &yMinOk );
1262 bool yMaxOk =
false;
1263 const double yMax = match.captured( 4 ).toDouble( &yMaxOk );
1264 if ( xMinOk && xMaxOk && yMinOk && yMaxOk )
1290 QgsMapLayer *layer = qobject_cast< QgsMapLayer * >( qvariant_cast<QObject *>( val ) );
1319 const QVariant val = parameters.value( definition->
name() );
1325 QVariant val = value;
1353 QString valueAsString;
1357 valueAsString = val.toString();
1359 const QRegularExpression rx( QStringLiteral(
"^(.*?)\\s*,\\s*(.*?),\\s*(.*?),\\s*(.*?)\\s*(?:\\[(.*)\\])?\\s*$" ) );
1361 const QRegularExpressionMatch match = rx.match( valueAsString );
1362 if ( match.hasMatch() )
1388 if (
QgsMapLayer *layer = qobject_cast< QgsMapLayer * >( qvariant_cast<QObject *>( val ) ) )
1389 return layer->crs();
1391 return layer->crs();
1393 if (
auto *lProject = context.
project() )
1394 return lProject->crs();
1412 const QVariant val = value;
1442 if ( pointText.isEmpty() )
1445 if ( pointText.isEmpty() )
1448 const QRegularExpression rx( QStringLiteral(
"^\\s*\\(?\\s*(.*?)\\s*,\\s*(.*?)\\s*(?:\\[(.*)\\])?\\s*\\)?\\s*$" ) );
1451 const QRegularExpressionMatch match = rx.match( valueAsString );
1452 if ( match.hasMatch() )
1455 const double x = match.captured( 1 ).toDouble( &xOk );
1457 const double y = match.captured( 2 ).toDouble( &yOk );
1485 const QVariant val = parameters.value( definition->
name() );
1500 const QRegularExpression rx( QStringLiteral(
"^\\s*\\(?\\s*(.*?)\\s*,\\s*(.*?)\\s*(?:\\[(.*)\\])?\\s*\\)?\\s*$" ) );
1503 const QRegularExpressionMatch match = rx.match( valueAsString );
1504 if ( match.hasMatch() )
1511 if (
auto *lProject = context.
project() )
1512 return lProject->crs();
1530 const QVariant val = value;
1570 g = g.densifyByCount( 20 );
1603 if ( valueAsString.isEmpty() )
1606 if ( valueAsString.isEmpty() )
1609 const QRegularExpression rx( QStringLiteral(
"^\\s*(?:CRS=(.*);)?(.*?)$" ) );
1611 const QRegularExpressionMatch match = rx.match( valueAsString );
1612 if ( match.hasMatch() )
1639 const QVariant val = parameters.value( definition->
name() );
1673 const QRegularExpression rx( QStringLiteral(
"^\\s*(?:CRS=(.*);)?(.*?)$" ) );
1676 const QRegularExpressionMatch match = rx.match( valueAsString );
1677 if ( match.hasMatch() )
1684 if (
auto *lProject = context.
project() )
1685 return lProject->crs();
1696 if ( fileText.isEmpty() )
1707 if ( fileText.isEmpty() )
1715 return QVariantList();
1723 return QVariantList();
1725 QString resultString;
1726 const QVariant val = value;
1729 else if ( val.type() == QVariant::List )
1730 return val.toList();
1732 resultString = val.toString();
1734 if ( resultString.isEmpty() )
1737 if ( definition->
defaultValue().type() == QVariant::List )
1743 QVariantList result;
1744 const auto constSplit = resultString.split(
',' );
1747 for (
const QString &s : constSplit )
1749 number = s.toDouble( &ok );
1750 result << ( ok ? QVariant( number ) : s );
1759 return QList<QgsMapLayer *>();
1767 return QList<QgsMapLayer *>();
1769 const QVariant val = value;
1770 if (
QgsMapLayer *layer = qobject_cast< QgsMapLayer * >( qvariant_cast<QObject *>( val ) ) )
1772 return QList<QgsMapLayer *>() << layer;
1775 QList<QgsMapLayer *> layers;
1777 std::function< void(
const QVariant &var ) > processVariant;
1778 processVariant = [ &layers, &context, &definition, &processVariant ](
const QVariant & var )
1780 if ( var.type() == QVariant::List )
1782 const auto constToList = var.toList();
1783 for (
const QVariant &listVar : constToList )
1785 processVariant( listVar );
1788 else if ( var.type() == QVariant::StringList )
1790 const auto constToStringList = var.toStringList();
1791 for (
const QString &s : constToStringList )
1793 processVariant( s );
1797 processVariant( var.value<
QgsProperty >().
valueAsString( context.expressionContext(), definition->defaultValue().toString() ) );
1802 const QVariant sink = fromVar.
sink;
1805 processVariant( sink.value<
QgsProperty >().
valueAsString( context.expressionContext(), definition->defaultValue().toString() ) );
1808 else if (
QgsMapLayer *layer = qobject_cast< QgsMapLayer * >( qvariant_cast<QObject *>( var ) ) )
1820 processVariant( val );
1822 if ( layers.isEmpty() )
1825 if (
QgsMapLayer *layer = qobject_cast< QgsMapLayer * >( qvariant_cast<QObject *>( definition->defaultValue() ) ) )
1829 else if ( definition->defaultValue().type() == QVariant::List )
1831 const auto constToList = definition->defaultValue().toList();
1832 for (
const QVariant &var : constToList )
1834 if (
QgsMapLayer *layer = qobject_cast< QgsMapLayer * >( qvariant_cast<QObject *>( var ) ) )
1840 processVariant( var );
1845 processVariant( definition->defaultValue() );
1854 return QStringList();
1856 const QVariant val = value;
1860 std::function< void(
const QVariant &var ) > processVariant;
1861 processVariant = [ &files, &context, &definition, &processVariant ](
const QVariant & var )
1863 if ( var.type() == QVariant::List )
1865 const auto constToList = var.toList();
1866 for (
const QVariant &listVar : constToList )
1868 processVariant( listVar );
1871 else if ( var.type() == QVariant::StringList )
1873 const auto constToStringList = var.toStringList();
1874 for (
const QString &s : constToStringList )
1876 processVariant( s );
1880 processVariant( var.value<
QgsProperty >().
valueAsString( context.expressionContext(), definition->defaultValue().toString() ) );
1883 files << var.toString();
1887 processVariant( val );
1889 if ( files.isEmpty() )
1891 processVariant( definition->defaultValue() );
1900 return QStringList();
1908 return QList<double>();
1916 return QList<double>();
1918 QStringList resultStringList;
1919 const QVariant val = value;
1923 else if ( val.type() == QVariant::List )
1925 const auto constToList = val.toList();
1926 for (
const QVariant &var : constToList )
1927 resultStringList << var.toString();
1930 resultStringList << val.toString();
1932 if ( ( resultStringList.isEmpty() || ( resultStringList.size() == 1 && resultStringList.at( 0 ).isEmpty() ) ) )
1934 resultStringList.clear();
1936 if ( definition->
defaultValue().type() == QVariant::List )
1938 const auto constToList = definition->
defaultValue().toList();
1939 for (
const QVariant &var : constToList )
1940 resultStringList << var.toString();
1943 resultStringList << definition->
defaultValue().toString();
1946 if ( resultStringList.size() == 1 )
1948 resultStringList = resultStringList.at( 0 ).split(
',' );
1951 if ( resultStringList.size() < 2 )
1952 return QList< double >() << std::numeric_limits<double>::quiet_NaN() << std::numeric_limits<double>::quiet_NaN() ;
1954 QList< double > result;
1956 double n = resultStringList.at( 0 ).toDouble( &ok );
1960 result << std::numeric_limits<double>::quiet_NaN() ;
1962 n = resultStringList.at( 1 ).toDouble( &ok );
1966 result << std::numeric_limits<double>::quiet_NaN() ;
1974 return QStringList();
1976 const QStringList resultStringList;
1983 return QStringList();
1985 QStringList resultStringList;
1986 const QVariant val = value;
1987 if ( val.isValid() )
1991 else if ( val.type() == QVariant::List )
1993 const auto constToList = val.toList();
1994 for (
const QVariant &var : constToList )
1995 resultStringList << var.toString();
1997 else if ( val.type() == QVariant::StringList )
1999 resultStringList = val.toStringList();
2002 resultStringList.append( val.toString().split(
';' ) );
2005 if ( ( resultStringList.isEmpty() || resultStringList.at( 0 ).isEmpty() ) )
2007 resultStringList.clear();
2011 if ( definition->
defaultValue().type() == QVariant::List )
2013 const auto constToList = definition->
defaultValue().toList();
2014 for (
const QVariant &var : constToList )
2015 resultStringList << var.toString();
2017 else if ( definition->
defaultValue().type() == QVariant::StringList )
2019 resultStringList = definition->
defaultValue().toStringList();
2022 resultStringList.append( definition->
defaultValue().toString().split(
';' ) );
2026 return resultStringList;
2040 if ( layoutName.isEmpty() )
2092 QVariant val = value;
2097 if ( val.type() == QVariant::Color )
2099 QColor
c = val.value< QColor >();
2101 if ( !colorParam->opacityEnabled() )
2109 if ( definition->
defaultValue().type() == QVariant::Color )
2115 if ( colorText.isEmpty() )
2118 bool containsAlpha =
false;
2121 if (
c.isValid() && !colorParam->opacityEnabled() )
2193 const QString type = map.value( QStringLiteral(
"parameter_type" ) ).toString();
2194 const QString name = map.value( QStringLiteral(
"name" ) ).toString();
2195 std::unique_ptr< QgsProcessingParameterDefinition > def;
2268 def.reset( paramType->
create( name ) );
2274 def->fromVariantMap( map );
2275 return def.release();
2280 QString desc = name;
2281 desc.replace(
'_',
' ' );
2287 bool isOptional =
false;
2291 if ( !parseScriptCodeParameterOptions( code, isOptional, name, type, definition ) )
2296 if ( type == QLatin1String(
"boolean" ) )
2298 else if ( type == QLatin1String(
"crs" ) )
2300 else if ( type == QLatin1String(
"layer" ) )
2302 else if ( type == QLatin1String(
"extent" ) )
2304 else if ( type == QLatin1String(
"point" ) )
2306 else if ( type == QLatin1String(
"geometry" ) )
2308 else if ( type == QLatin1String(
"file" ) )
2310 else if ( type == QLatin1String(
"folder" ) )
2312 else if ( type == QLatin1String(
"matrix" ) )
2314 else if ( type == QLatin1String(
"multiple" ) )
2316 else if ( type == QLatin1String(
"number" ) )
2318 else if ( type == QLatin1String(
"distance" ) )
2320 else if ( type == QLatin1String(
"duration" ) )
2322 else if ( type == QLatin1String(
"scale" ) )
2324 else if ( type == QLatin1String(
"range" ) )
2326 else if ( type == QLatin1String(
"raster" ) )
2328 else if ( type == QLatin1String(
"enum" ) )
2330 else if ( type == QLatin1String(
"string" ) )
2332 else if ( type == QLatin1String(
"authcfg" ) )
2334 else if ( type == QLatin1String(
"expression" ) )
2336 else if ( type == QLatin1String(
"field" ) )
2338 else if ( type == QLatin1String(
"vector" ) )
2340 else if ( type == QLatin1String(
"source" ) )
2342 else if ( type == QLatin1String(
"sink" ) )
2344 else if ( type == QLatin1String(
"vectordestination" ) )
2346 else if ( type == QLatin1String(
"rasterdestination" ) )
2348 else if ( type == QLatin1String(
"pointclouddestination" ) )
2350 else if ( type == QLatin1String(
"filedestination" ) )
2352 else if ( type == QLatin1String(
"folderdestination" ) )
2354 else if ( type == QLatin1String(
"band" ) )
2356 else if ( type == QLatin1String(
"mesh" ) )
2358 else if ( type == QLatin1String(
"layout" ) )
2360 else if ( type == QLatin1String(
"layoutitem" ) )
2362 else if ( type == QLatin1String(
"color" ) )
2364 else if ( type == QLatin1String(
"coordinateoperation" ) )
2366 else if ( type == QLatin1String(
"maptheme" ) )
2368 else if ( type == QLatin1String(
"datetime" ) )
2370 else if ( type == QLatin1String(
"providerconnection" ) )
2372 else if ( type == QLatin1String(
"databaseschema" ) )
2374 else if ( type == QLatin1String(
"databasetable" ) )
2376 else if ( type == QLatin1String(
"pointcloud" ) )
2378 else if ( type == QLatin1String(
"annotation" ) )
2384 bool QgsProcessingParameters::parseScriptCodeParameterOptions(
const QString &code,
bool &isOptional, QString &name, QString &type, QString &definition )
2386 const QRegularExpression re( QStringLiteral(
"(?:#*)(.*?)=\\s*(.*)" ) );
2387 QRegularExpressionMatch m = re.match( code );
2388 if ( !m.hasMatch() )
2391 name = m.captured( 1 );
2392 QString tokens = m.captured( 2 );
2393 if ( tokens.startsWith( QLatin1String(
"optional" ), Qt::CaseInsensitive ) )
2396 tokens.remove( 0, 8 );
2403 tokens = tokens.trimmed();
2405 const QRegularExpression re2( QStringLiteral(
"(.*?)\\s+(.*)" ) );
2406 m = re2.match( tokens );
2407 if ( !m.hasMatch() )
2409 type = tokens.toLower().trimmed();
2414 type = m.captured( 1 ).toLower().trimmed();
2415 definition = m.captured( 2 );
2426 , mDescription( description )
2428 , mDefault( defaultValue )
2429 , mFlags( optional ? FlagOptional : 0 )
2434 if ( !input.isValid() && !
mDefault.isValid() )
2437 if ( ( input.type() == QVariant::String && input.toString().isEmpty() )
2438 || ( !input.isValid() &&
mDefault.type() == QVariant::String &&
mDefault.toString().isEmpty() ) )
2446 if ( !value.isValid() )
2447 return QStringLiteral(
"None" );
2450 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( value.value<
QgsProperty >().
asExpression() );
2457 if ( !value.isValid() )
2461 if ( value.type() == QVariant::Type::Map )
2463 const QVariantMap sourceMap = value.toMap();
2464 QVariantMap resultMap;
2465 for (
auto it = sourceMap.constBegin(); it != sourceMap.constEnd(); it++ )
2471 else if ( value.type() == QVariant::Type::List || value.type() == QVariant::Type::StringList )
2473 const QVariantList sourceList = value.toList();
2474 QVariantList resultList;
2475 resultList.reserve( sourceList.size() );
2476 for (
const QVariant &v : sourceList )
2484 switch ( value.userType() )
2487 case QMetaType::Bool:
2488 case QMetaType::Char:
2489 case QMetaType::Int:
2490 case QMetaType::Double:
2491 case QMetaType::Float:
2492 case QMetaType::LongLong:
2493 case QMetaType::ULongLong:
2494 case QMetaType::UInt:
2495 case QMetaType::ULong:
2496 case QMetaType::UShort:
2504 if ( value.userType() == QMetaType::type(
"QgsProperty" ) )
2517 QgsDebugMsg( QStringLiteral(
"could not convert expression/field based property to JSON object" ) );
2523 if ( value.userType() == QMetaType::type(
"QgsCoordinateReferenceSystem" ) )
2533 else if ( value.userType() == QMetaType::type(
"QgsRectangle" ) )
2541 else if ( value.userType() == QMetaType::type(
"QgsReferencedRectangle" ) )
2549 else if ( value.userType() == QMetaType::type(
"QgsGeometry" ) )
2561 else if ( value.userType() == QMetaType::type(
"QgsReferencedGeometry" ) )
2576 else if ( value.userType() == QMetaType::type(
"QgsPointXY" ) )
2582 else if ( value.userType() == QMetaType::type(
"QgsReferencedPointXY" ) )
2589 else if ( value.userType() == QMetaType::type(
"QgsProcessingFeatureSourceDefinition" ) )
2596 else if ( value.userType() == QMetaType::type(
"QgsProcessingOutputLayerDefinition" ) )
2601 else if ( value.userType() == QMetaType::type(
"QColor" ) )
2603 const QColor fromVar = value.value< QColor >();
2604 if ( !fromVar.isValid() )
2607 return QStringLiteral(
"rgba( %1, %2, %3, %4 )" ).arg( fromVar.red() ).arg( fromVar.green() ).arg( fromVar.blue() ).arg( QString::number( fromVar.alphaF(),
'f', 2 ) );
2609 else if ( value.userType() == QMetaType::type(
"QDateTime" ) )
2611 const QDateTime fromVar = value.toDateTime();
2612 if ( !fromVar.isValid() )
2615 return fromVar.toString( Qt::ISODate );
2617 else if ( value.userType() == QMetaType::type(
"QDate" ) )
2619 const QDate fromVar = value.toDate();
2620 if ( !fromVar.isValid() )
2623 return fromVar.toString( Qt::ISODate );
2625 else if ( value.userType() == QMetaType::type(
"QTime" ) )
2627 const QTime fromVar = value.toTime();
2628 if ( !fromVar.isValid() )
2631 return fromVar.toString( Qt::ISODate );
2636 p.insert(
name(), value );
2640 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() );
2659 if ( !value.isValid() )
2662 switch ( value.userType() )
2665 case QMetaType::Bool:
2666 case QMetaType::Char:
2667 case QMetaType::Int:
2668 case QMetaType::Double:
2669 case QMetaType::Float:
2670 case QMetaType::LongLong:
2671 case QMetaType::ULongLong:
2672 case QMetaType::UInt:
2673 case QMetaType::ULong:
2674 case QMetaType::UShort:
2675 return value.toString();
2681 if ( value.userType() == QMetaType::type(
"QgsProperty" ) )
2694 QgsDebugMsg( QStringLiteral(
"could not convert expression/field based property to string" ) );
2700 if ( value.userType() == QMetaType::type(
"QgsCoordinateReferenceSystem" ) )
2710 else if ( value.userType() == QMetaType::type(
"QgsRectangle" ) )
2718 else if ( value.userType() == QMetaType::type(
"QgsReferencedRectangle" ) )
2726 else if ( value.userType() == QMetaType::type(
"QgsGeometry" ) )
2738 else if ( value.userType() == QMetaType::type(
"QgsReferencedGeometry" ) )
2753 else if ( value.userType() == QMetaType::type(
"QgsPointXY" ) )
2759 else if ( value.userType() == QMetaType::type(
"QgsReferencedPointXY" ) )
2766 else if ( value.userType() == QMetaType::type(
"QgsProcessingFeatureSourceDefinition" ) )
2771 else if ( value.userType() == QMetaType::type(
"QgsProcessingOutputLayerDefinition" ) )
2776 else if ( value.userType() == QMetaType::type(
"QColor" ) )
2778 const QColor fromVar = value.value< QColor >();
2779 if ( !fromVar.isValid() )
2782 return QStringLiteral(
"rgba( %1, %2, %3, %4 )" ).arg( fromVar.red() ).arg( fromVar.green() ).arg( fromVar.blue() ).arg( QString::number( fromVar.alphaF(),
'f', 2 ) );
2784 else if ( value.userType() == QMetaType::type(
"QDateTime" ) )
2786 const QDateTime fromVar = value.toDateTime();
2787 if ( !fromVar.isValid() )
2790 return fromVar.toString( Qt::ISODate );
2792 else if ( value.userType() == QMetaType::type(
"QDate" ) )
2794 const QDate fromVar = value.toDate();
2795 if ( !fromVar.isValid() )
2798 return fromVar.toString( Qt::ISODate );
2800 else if ( value.userType() == QMetaType::type(
"QTime" ) )
2802 const QTime fromVar = value.toTime();
2803 if ( !fromVar.isValid() )
2806 return fromVar.toString( Qt::ISODate );
2811 p.insert(
name(), value );
2815 if ( !source.isEmpty() )
2821 if ( value.userType() == QMetaType::QString )
2822 return value.toString();
2827 return value.toString();
2833 if ( !value.isValid( ) )
2834 return QStringList();
2836 if ( value.type() == QVariant::Type::List || value.type() == QVariant::Type::StringList )
2838 const QVariantList sourceList = value.toList();
2839 QStringList resultList;
2840 resultList.reserve( sourceList.size() );
2841 for (
const QVariant &v : sourceList )
2850 return QStringList();
2862 QString code = QStringLiteral(
"##%1=" ).arg(
mName );
2864 code += QLatin1String(
"optional " );
2865 code +=
type() +
' ';
2867 return code.trimmed();
2875 switch ( outputType )
2879 QString code = t->className() + QStringLiteral(
"('%1', %2" )
2882 code += QLatin1String(
", optional=True" );
2898 map.insert( QStringLiteral(
"parameter_type" ),
type() );
2899 map.insert( QStringLiteral(
"name" ),
mName );
2900 map.insert( QStringLiteral(
"description" ),
mDescription );
2901 map.insert( QStringLiteral(
"help" ),
mHelp );
2902 map.insert( QStringLiteral(
"default" ),
mDefault );
2903 map.insert( QStringLiteral(
"defaultGui" ),
mGuiDefault );
2904 map.insert( QStringLiteral(
"flags" ),
static_cast< int >(
mFlags ) );
2905 map.insert( QStringLiteral(
"metadata" ),
mMetadata );
2911 mName = map.value( QStringLiteral(
"name" ) ).toString();
2912 mDescription = map.value( QStringLiteral(
"description" ) ).toString();
2913 mHelp = map.value( QStringLiteral(
"help" ) ).toString();
2914 mDefault = map.value( QStringLiteral(
"default" ) );
2915 mGuiDefault = map.value( QStringLiteral(
"defaultGui" ) );
2916 mFlags =
static_cast< Flags
>( map.value( QStringLiteral(
"flags" ) ).toInt() );
2917 mMetadata = map.value( QStringLiteral(
"metadata" ) ).toMap();
2933 QString text = QStringLiteral(
"<p><b>%1</b></p>" ).arg(
description() );
2934 if ( !
help().isEmpty() )
2936 text += QStringLiteral(
"<p>%1</p>" ).arg(
help() );
2938 text += QStringLiteral(
"<p>%1</p>" ).arg( QObject::tr(
"Python identifier: ‘%1’" ).arg( QStringLiteral(
"<i>%1</i>" ).arg(
name() ) ) );
2953 if ( !val.isValid() )
2954 return QStringLiteral(
"None" );
2958 return val.toBool() ? QStringLiteral(
"True" ) : QStringLiteral(
"False" );
2963 QString code = QStringLiteral(
"##%1=" ).arg(
mName );
2965 code += QLatin1String(
"optional " );
2966 code +=
type() +
' ';
2967 code +=
mDefault.toBool() ? QStringLiteral(
"true" ) : QStringLiteral(
"false" );
2968 return code.trimmed();
2989 if ( !input.isValid() )
3011 if ( qobject_cast< QgsMapLayer * >( qvariant_cast<QObject *>( input ) ) )
3014 if ( input.type() != QVariant::String || input.toString().isEmpty() )
3022 if ( !value.isValid() )
3023 return QStringLiteral(
"None" );
3028 return QStringLiteral(
"QgsCoordinateReferenceSystem()" );
3034 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( value.value<
QgsProperty >().
asExpression() );
3037 p.insert(
name(), value );
3064 if ( !input.isValid() )
3072 if ( qobject_cast< QgsMapLayer * >( qvariant_cast<QObject *>( input ) ) )
3077 if ( input.type() != QVariant::String || input.toString().isEmpty() )
3095 if ( !val.isValid() )
3096 return QStringLiteral(
"None" );
3102 p.insert(
name(), val );
3112 for (
const QString &raster : rasters )
3114 if ( !vectors.contains( raster ) )
3118 for (
const QString &mesh : meshFilters )
3120 if ( !vectors.contains( mesh ) )
3124 for (
const QString &pointCloud : pointCloudFilters )
3126 if ( !vectors.contains( pointCloud ) )
3127 vectors << pointCloud;
3129 vectors.removeAll( QObject::tr(
"All files (*.*)" ) );
3130 std::sort( vectors.begin(), vectors.end() );
3132 return QObject::tr(
"All files (*.*)" ) + QStringLiteral(
";;" ) + vectors.join( QLatin1String(
";;" ) );
3142 QString code = QStringLiteral(
"##%1=" ).arg(
mName );
3144 code += QLatin1String(
"optional " );
3145 code += QLatin1String(
"layer " );
3152 code += QLatin1String(
"hasgeometry " );
3156 code += QLatin1String(
"point " );
3160 code += QLatin1String(
"line " );
3164 code += QLatin1String(
"polygon " );
3168 code += QLatin1String(
"raster " );
3172 code += QLatin1String(
"mesh " );
3176 code += QLatin1String(
"plugin " );
3180 code += QLatin1String(
"pointcloud " );
3184 code += QLatin1String(
"annotation " );
3190 return code.trimmed();
3196 QString def = definition;
3199 if ( def.startsWith( QLatin1String(
"hasgeometry" ), Qt::CaseInsensitive ) )
3202 def = def.mid( 12 );
3205 else if ( def.startsWith( QLatin1String(
"point" ), Qt::CaseInsensitive ) )
3211 else if ( def.startsWith( QLatin1String(
"line" ), Qt::CaseInsensitive ) )
3217 else if ( def.startsWith( QLatin1String(
"polygon" ), Qt::CaseInsensitive ) )
3223 else if ( def.startsWith( QLatin1String(
"raster" ), Qt::CaseInsensitive ) )
3229 else if ( def.startsWith( QLatin1String(
"mesh" ), Qt::CaseInsensitive ) )
3235 else if ( def.startsWith( QLatin1String(
"plugin" ), Qt::CaseInsensitive ) )
3241 else if ( def.startsWith( QLatin1String(
"pointcloud" ), Qt::CaseInsensitive ) )
3244 def = def.mid( 11 );
3247 else if ( def.startsWith( QLatin1String(
"annotation" ), Qt::CaseInsensitive ) )
3250 def = def.mid( 11 );
3261 switch ( outputType )
3265 QString code = QStringLiteral(
"QgsProcessingParameterMapLayer('%1', %2" )
3268 code += QLatin1String(
", optional=True" );
3275 QStringList options;
3279 code += QStringLiteral(
", types=[%1])" ).arg( options.join(
',' ) );
3283 code += QLatin1Char(
')' );
3300 map.insert( QStringLiteral(
"data_types" ), types );
3308 const QVariantList values = map.value( QStringLiteral(
"data_types" ) ).toList();
3309 for (
const QVariant &val : values )
3329 if ( !input.isValid() )
3362 if ( qobject_cast< QgsMapLayer * >( qvariant_cast<QObject *>( input ) ) )
3365 if ( input.type() != QVariant::String || input.toString().isEmpty() )
3374 const QRegularExpression rx( QStringLiteral(
"^(.*?)\\s*,\\s*(.*?)\\s*,\\s*(.*?)\\s*,\\s*(.*?)\\s*(?:\\[(.*)\\])?\\s*$" ) );
3375 const QRegularExpressionMatch match = rx.match( input.toString() );
3376 if ( match.hasMatch() )
3378 bool xMinOk =
false;
3379 ( void )match.captured( 1 ).toDouble( &xMinOk );
3380 bool xMaxOk =
false;
3381 ( void )match.captured( 2 ).toDouble( &xMaxOk );
3382 bool yMinOk =
false;
3383 ( void )match.captured( 3 ).toDouble( &yMinOk );
3384 bool yMaxOk =
false;
3385 ( void )match.captured( 4 ).toDouble( &yMaxOk );
3386 if ( xMinOk && xMaxOk && yMinOk && yMaxOk )
3396 if ( !value.isValid() )
3397 return QStringLiteral(
"None" );
3400 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( value.value<
QgsProperty >().
asExpression() );
3423 const QString wkt = g.
asWkt();
3424 return QStringLiteral(
"QgsGeometry.fromWkt('%1')" ).arg( wkt );
3429 p.insert(
name(), value );
3455 if ( !input.isValid() )
3476 if ( input.type() == QVariant::String )
3478 if ( input.toString().isEmpty() )
3482 const QRegularExpression rx( QStringLiteral(
"^\\s*\\(?\\s*(.*?)\\s*,\\s*(.*?)\\s*(?:\\[(.*)\\])?\\s*\\)?\\s*$" ) );
3484 const QRegularExpressionMatch match = rx.match( input.toString() );
3485 if ( match.hasMatch() )
3488 ( void )match.captured( 1 ).toDouble( &xOk );
3490 ( void )match.captured( 2 ).toDouble( &yOk );
3499 if ( !value.isValid() )
3500 return QStringLiteral(
"None" );
3503 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( value.value<
QgsProperty >().
asExpression() );
3523 const QString wkt = g.
asWkt();
3524 return QStringLiteral(
"QgsGeometry.fromWkt('%1')" ).arg( wkt );
3537 const QVariant &defaultValue,
bool optional,
const QList<int> &geometryTypes,
bool allowMultipart )
3539 mGeomTypes( geometryTypes ),
3540 mAllowMultipart( allowMultipart )
3552 if ( !input.isValid() )
3564 return ( anyTypeAllowed || mGeomTypes.contains( input.value<
QgsGeometry>().
type() ) ) &&
3565 ( mAllowMultipart || !input.value<
QgsGeometry>().isMultipart() );
3594 if ( input.type() == QVariant::String )
3596 if ( input.toString().isEmpty() )
3601 const QRegularExpression rx( QStringLiteral(
"^\\s*(?:CRS=(.*);)?(.*?)$" ) );
3603 const QRegularExpressionMatch match = rx.match( input.toString() );
3604 if ( match.hasMatch() )
3609 return ( anyTypeAllowed || mGeomTypes.contains( g.
type() ) ) && ( mAllowMultipart || !g.
isMultipart() );
3629 if ( !value.isValid() )
3630 return QStringLiteral(
"None" );
3682 QString code = QStringLiteral(
"##%1=" ).arg(
mName );
3684 code += QLatin1String(
"optional " );
3685 code +=
type() +
' ';
3687 for (
const int type : mGeomTypes )
3692 code += QLatin1String(
"point " );
3696 code += QLatin1String(
"line " );
3700 code += QLatin1String(
"polygon " );
3704 code += QLatin1String(
"unknown " );
3710 return code.trimmed();
3715 switch ( outputType )
3719 QString code = QStringLiteral(
"QgsProcessingParameterGeometry('%1', %2" )
3722 code += QLatin1String(
", optional=True" );
3724 if ( !mGeomTypes.empty() )
3731 return QStringLiteral(
"PointGeometry" );
3734 return QStringLiteral(
"LineGeometry" );
3737 return QStringLiteral(
"PolygonGeometry" );
3740 return QStringLiteral(
"UnknownGeometry" );
3743 return QStringLiteral(
"NullGeometry" );
3748 QStringList options;
3749 options.reserve( mGeomTypes.size() );
3750 for (
const int type : mGeomTypes )
3754 code += QStringLiteral(
", geometryTypes=[%1 ]" ).arg( options.join(
',' ) );
3757 if ( ! mAllowMultipart )
3759 code += QLatin1String(
", allowMultipart=False" );
3774 for (
const int type : mGeomTypes )
3778 map.insert( QStringLiteral(
"geometrytypes" ), types );
3779 map.insert( QStringLiteral(
"multipart" ), mAllowMultipart );
3787 const QVariantList values = map.value( QStringLiteral(
"geometrytypes" ) ).toList();
3788 for (
const QVariant &val : values )
3790 mGeomTypes << val.toInt();
3792 mAllowMultipart = map.value( QStringLiteral(
"multipart" ) ).toBool();
3803 , mBehavior( behavior )
3804 , mExtension( fileFilter.isEmpty() ? extension : QString() )
3805 , mFileFilter( fileFilter.isEmpty() && extension.isEmpty() ? QObject::tr(
"All files (*.*)" ) : fileFilter )
3817 if ( !input.isValid() )
3825 const QString
string = input.toString().trimmed();
3827 if ( input.type() != QVariant::String ||
string.isEmpty() )
3830 switch ( mBehavior )
3834 if ( !mExtension.isEmpty() )
3836 return string.endsWith( mExtension, Qt::CaseInsensitive );
3838 else if ( !mFileFilter.isEmpty() )
3856 QString code = QStringLiteral(
"##%1=" ).arg(
mName );
3858 code += QLatin1String(
"optional " );
3859 code += ( mBehavior ==
File ? QStringLiteral(
"file" ) : QStringLiteral(
"folder" ) ) +
' ';
3861 return code.trimmed();
3866 switch ( outputType )
3871 QString code = QStringLiteral(
"QgsProcessingParameterFile('%1', %2" )
3874 code += QLatin1String(
", optional=True" );
3875 code += QStringLiteral(
", behavior=%1" ).arg( mBehavior ==
File ? QStringLiteral(
"QgsProcessingParameterFile.File" ) : QStringLiteral(
"QgsProcessingParameterFile.Folder" ) );
3876 if ( !mExtension.isEmpty() )
3877 code += QStringLiteral(
", extension='%1'" ).arg( mExtension );
3878 if ( !mFileFilter.isEmpty() )
3879 code += QStringLiteral(
", fileFilter='%1'" ).arg( mFileFilter );
3890 switch ( mBehavior )
3894 if ( !mFileFilter.isEmpty() )
3895 return mFileFilter != QObject::tr(
"All files (*.*)" ) ? mFileFilter + QStringLiteral(
";;" ) + QObject::tr(
"All files (*.*)" ) : mFileFilter;
3896 else if ( !mExtension.isEmpty() )
3897 return QObject::tr(
"%1 files" ).arg( mExtension.toUpper() ) + QStringLiteral(
" (*." ) + mExtension.toLower() + QStringLiteral(
");;" ) + QObject::tr(
"All files (*.*)" );
3899 return QObject::tr(
"All files (*.*)" );
3911 mFileFilter.clear();
3921 mFileFilter = filter;
3928 map.insert( QStringLiteral(
"behavior" ), mBehavior );
3929 map.insert( QStringLiteral(
"extension" ), mExtension );
3930 map.insert( QStringLiteral(
"filefilter" ), mFileFilter );
3937 mBehavior =
static_cast< Behavior >( map.value( QStringLiteral(
"behavior" ) ).toInt() );
3938 mExtension = map.value( QStringLiteral(
"extension" ) ).toString();
3939 mFileFilter = map.value( QStringLiteral(
"filefilter" ) ).toString();
3950 , mHeaders( headers )
3951 , mNumberRows( numberRows )
3952 , mFixedNumberRows( fixedNumberRows )
3964 if ( !input.isValid() )
3967 if ( input.type() == QVariant::String )
3969 if ( input.toString().isEmpty() )
3973 else if ( input.type() == QVariant::List )
3975 if ( input.toList().isEmpty() )
3979 else if ( input.type() == QVariant::Double || input.type() == QVariant::Int )
3989 if ( !value.isValid() )
3990 return QStringLiteral(
"None" );
3993 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( value.value<
QgsProperty >().
asExpression() );
3996 p.insert(
name(), value );
4004 switch ( outputType )
4008 QString code = QStringLiteral(
"QgsProcessingParameterMatrix('%1', %2" )
4011 code += QLatin1String(
", optional=True" );
4012 code += QStringLiteral(
", numberRows=%1" ).arg( mNumberRows );
4013 code += QStringLiteral(
", hasFixedNumberRows=%1" ).arg( mFixedNumberRows ? QStringLiteral(
"True" ) : QStringLiteral(
"False" ) );
4016 headers.reserve( mHeaders.size() );
4017 for (
const QString &h : mHeaders )
4019 code += QStringLiteral(
", headers=[%1]" ).arg(
headers.join(
',' ) );
4051 return mFixedNumberRows;
4056 mFixedNumberRows = fixedNumberRows;
4062 map.insert( QStringLiteral(
"headers" ), mHeaders );
4063 map.insert( QStringLiteral(
"rows" ), mNumberRows );
4064 map.insert( QStringLiteral(
"fixed_number_rows" ), mFixedNumberRows );
4071 mHeaders = map.value( QStringLiteral(
"headers" ) ).toStringList();
4072 mNumberRows = map.value( QStringLiteral(
"rows" ) ).toInt();
4073 mFixedNumberRows = map.value( QStringLiteral(
"fixed_number_rows" ) ).toBool();
4084 , mLayerType( layerType )
4096 if ( !input.isValid() )
4101 if ( qobject_cast< QgsMapLayer * >( qvariant_cast<QObject *>( input ) ) )
4107 if ( input.type() == QVariant::String )
4109 if ( input.toString().isEmpty() )
4112 if ( mMinimumNumberInputs > 1 )
4123 else if ( input.type() == QVariant::List )
4125 if ( input.toList().count() < mMinimumNumberInputs )
4128 if ( mMinimumNumberInputs > input.toList().count() )
4136 const auto constToList = input.toList();
4137 for (
const QVariant &v : constToList )
4139 if ( qobject_cast< QgsMapLayer * >( qvariant_cast<QObject *>( v ) ) )
4148 else if ( input.type() == QVariant::StringList )
4150 if ( input.toStringList().count() < mMinimumNumberInputs )
4153 if ( mMinimumNumberInputs > input.toStringList().count() )
4161 const auto constToStringList = input.toStringList();
4162 for (
const QString &v : constToStringList )
4175 if ( !value.isValid() )
4176 return QStringLiteral(
"None" );
4179 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( value.value<
QgsProperty >().
asExpression() );
4184 if ( value.type() == QVariant::StringList )
4186 const QStringList list = value.toStringList();
4187 parts.reserve( list.count() );
4188 for (
const QString &v : list )
4191 else if ( value.type() == QVariant::List )
4193 const QVariantList list = value.toList();
4194 parts.reserve( list.count() );
4195 for (
const QVariant &v : list )
4198 if ( !parts.isEmpty() )
4199 return parts.join(
',' ).prepend(
'[' ).append(
']' );
4204 p.insert(
name(), value );
4206 if ( !list.isEmpty() )
4209 parts.reserve( list.count() );
4214 return parts.join(
',' ).prepend(
'[' ).append(
']' );
4223 QString code = QStringLiteral(
"##%1=" ).arg(
mName );
4225 code += QLatin1String(
"optional " );
4226 switch ( mLayerType )
4229 code += QLatin1String(
"multiple raster" );
4233 code += QLatin1String(
"multiple file" );
4237 code += QLatin1String(
"multiple vector" );
4241 if (
mDefault.type() == QVariant::List )
4244 const auto constToList =
mDefault.toList();
4245 for (
const QVariant &var : constToList )
4247 parts << var.toString();
4249 code += parts.join(
',' );
4251 else if (
mDefault.type() == QVariant::StringList )
4253 code +=
mDefault.toStringList().join(
',' );
4259 return code.trimmed();
4264 switch ( outputType )
4268 QString code = QStringLiteral(
"QgsProcessingParameterMultipleLayers('%1', %2" )
4271 code += QLatin1String(
", optional=True" );
4275 code += QStringLiteral(
", layerType=%1" ).arg(
layerType );
4286 const QStringList exts;
4287 switch ( mLayerType )
4290 return QObject::tr(
"All files (*.*)" );
4328 return mMinimumNumberInputs;
4340 map.insert( QStringLiteral(
"layer_type" ), mLayerType );
4341 map.insert( QStringLiteral(
"min_inputs" ), mMinimumNumberInputs );
4349 mMinimumNumberInputs = map.value( QStringLiteral(
"min_inputs" ) ).toInt();
4355 QString
type = definition;
4357 const QRegularExpression re( QStringLiteral(
"(.*?)\\s+(.*)" ) );
4358 const QRegularExpressionMatch m = re.match( definition );
4361 type = m.captured( 1 ).toLower().trimmed();
4362 defaultVal = m.captured( 2 );
4365 if (
type == QLatin1String(
"vector" ) )
4367 else if (
type == QLatin1String(
"raster" ) )
4369 else if (
type == QLatin1String(
"file" ) )
4382 QgsMessageLog::logMessage( QObject::tr(
"Invalid number parameter \"%1\": min value %2 is >= max value %3!" ).arg(
name ).arg( mMin ).arg( mMax ), QObject::tr(
"Processing" ) );
4393 QVariant input = value;
4394 if ( !input.isValid() )
4408 const double res = input.toDouble( &ok );
4412 return !( res < mMin || res > mMax );
4417 if ( !value.isValid() )
4418 return QStringLiteral(
"None" );
4421 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( value.value<
QgsProperty >().
asExpression() );
4423 return value.toString();
4430 if ( mMin > std::numeric_limits<double>::lowest() + 1 )
4431 parts << QObject::tr(
"Minimum value: %1" ).arg( mMin );
4432 if ( mMax < std::numeric_limits<double>::max() )
4433 parts << QObject::tr(
"Maximum value: %1" ).arg( mMax );
4435 parts << QObject::tr(
"Default value: %1" ).arg( mDataType ==
Integer ?
mDefault.toInt() :
mDefault.toDouble() );
4436 const QString extra = parts.join( QLatin1String(
"<br />" ) );
4437 if ( !extra.isEmpty() )
4438 text += QStringLiteral(
"<p>%1</p>" ).arg( extra );
4444 switch ( outputType )
4448 QString code = QStringLiteral(
"QgsProcessingParameterNumber('%1', %2" )
4451 code += QLatin1String(
", optional=True" );
4453 code += QStringLiteral(
", type=%1" ).arg( mDataType ==
Integer ? QStringLiteral(
"QgsProcessingParameterNumber.Integer" ) : QStringLiteral(
"QgsProcessingParameterNumber.Double" ) );
4455 if ( mMin != std::numeric_limits<double>::lowest() + 1 )
4456 code += QStringLiteral(
", minValue=%1" ).arg( mMin );
4457 if ( mMax != std::numeric_limits<double>::max() )
4458 code += QStringLiteral(
", maxValue=%1" ).arg( mMax );
4500 map.insert( QStringLiteral(
"min" ), mMin );
4501 map.insert( QStringLiteral(
"max" ), mMax );
4502 map.insert( QStringLiteral(
"data_type" ), mDataType );
4509 mMin = map.value( QStringLiteral(
"min" ) ).toDouble();
4510 mMax = map.value( QStringLiteral(
"max" ) ).toDouble();
4511 mDataType =
static_cast< Type >( map.value( QStringLiteral(
"data_type" ) ).toInt() );
4518 : ( definition.toLower().trimmed() == QLatin1String(
"none" ) ? QVariant() : definition ), isOptional );
4535 if ( !input.isValid() )
4543 if ( input.type() == QVariant::String )
4545 const QStringList list = input.toString().split(
',' );
4546 if ( list.count() != 2 )
4549 list.at( 0 ).toDouble( &ok );
4551 list.at( 1 ).toDouble( &ok2 );
4556 else if ( input.type() == QVariant::List )
4558 if ( input.toList().count() != 2 )
4562 input.toList().at( 0 ).toDouble( &ok );
4564 input.toList().at( 1 ).toDouble( &ok2 );
4575 if ( !value.isValid() )
4576 return QStringLiteral(
"None" );
4579 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( value.value<
QgsProperty >().
asExpression() );
4582 p.insert(
name(), value );
4585 QStringList stringParts;
4586 const auto constParts = parts;
4587 for (
const double v : constParts )
4589 stringParts << QString::number( v );
4591 return stringParts.join(
',' ).prepend(
'[' ).append(
']' );
4596 switch ( outputType )
4600 QString code = QStringLiteral(
"QgsProcessingParameterRange('%1', %2" )
4603 code += QLatin1String(
", optional=True" );
4605 code += QStringLiteral(
", type=%1" ).arg( mDataType ==
QgsProcessingParameterNumber::Integer ? QStringLiteral(
"QgsProcessingParameterNumber.Integer" ) : QStringLiteral(
"QgsProcessingParameterNumber.Double" ) );
4628 map.insert( QStringLiteral(
"data_type" ), mDataType );
4642 : ( definition.toLower().trimmed() == QLatin1String(
"none" ) ? QVariant() : definition ), isOptional );
4658 if ( !input.isValid() )
4666 if ( qobject_cast< QgsRasterLayer * >( qvariant_cast<QObject *>( input ) ) )
4669 if ( input.type() != QVariant::String || input.toString().isEmpty() )
4687 if ( !val.isValid() )
4688 return QStringLiteral(
"None" );
4694 p.insert(
name(), val );
4712 , mOptions( options )
4713 , mAllowMultiple( allowMultiple )
4714 , mUsesStaticStrings( usesStaticStrings )
4726 QVariant input = value;
4727 if ( !input.isValid() )
4740 if ( mUsesStaticStrings )
4742 if ( input.type() == QVariant::List )
4744 if ( !mAllowMultiple )
4747 const QVariantList values = input.toList();
4751 for (
const QVariant &val : values )
4753 if ( !mOptions.contains( val.toString() ) )
4759 else if ( input.type() == QVariant::StringList )
4761 if ( !mAllowMultiple )
4764 const QStringList values = input.toStringList();
4769 if ( values.count() > 1 && !mAllowMultiple )
4772 for (
const QString &val : values )
4774 if ( !mOptions.contains( val ) )
4779 else if ( input.type() == QVariant::String )
4781 const QStringList parts = input.toString().split(
',' );
4782 if ( parts.count() > 1 && !mAllowMultiple )
4785 const auto constParts = parts;
4786 for (
const QString &part : constParts )
4788 if ( !mOptions.contains( part ) )
4796 if ( input.type() == QVariant::List )
4798 if ( !mAllowMultiple )
4801 const QVariantList values = input.toList();
4805 for (
const QVariant &val : values )
4808 const int res = val.toInt( &ok );
4811 else if ( res < 0 || res >= mOptions.count() )
4817 else if ( input.type() == QVariant::String )
4819 const QStringList parts = input.toString().split(
',' );
4820 if ( parts.count() > 1 && !mAllowMultiple )
4823 const auto constParts = parts;
4824 for (
const QString &part : constParts )
4827 const int res = part.toInt( &ok );
4830 else if ( res < 0 || res >= mOptions.count() )
4835 else if ( input.type() == QVariant::Int || input.type() == QVariant::Double )
4838 const int res = input.toInt( &ok );
4841 else if ( res >= 0 && res < mOptions.count() )
4851 if ( !value.isValid() )
4852 return QStringLiteral(
"None" );
4855 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( value.value<
QgsProperty >().
asExpression() );
4857 if ( mUsesStaticStrings )
4859 if ( value.type() == QVariant::StringList )
4862 const QStringList constList = value.toStringList();
4863 for (
const QString &val : constList )
4867 return parts.join(
',' ).prepend(
'[' ).append(
']' );
4869 else if ( value.type() == QVariant::String )
4872 const QStringList constList = value.toString().split(
',' );
4873 if ( constList.count() > 1 )
4875 for (
const QString &val : constList )
4879 return parts.join(
',' ).prepend(
'[' ).append(
']' );
4887 if ( value.type() == QVariant::List )
4890 const auto constToList = value.toList();
4891 for (
const QVariant &val : constToList )
4893 parts << QString::number( static_cast< int >( val.toDouble() ) );
4895 return parts.join(
',' ).prepend(
'[' ).append(
']' );
4897 else if ( value.type() == QVariant::String )
4899 const QStringList parts = value.toString().split(
',' );
4900 if ( parts.count() > 1 )
4902 return parts.join(
',' ).prepend(
'[' ).append(
']' );
4906 return QString::number(
static_cast< int >( value.toDouble() ) );
4912 if ( !value.isValid() )
4918 if ( mUsesStaticStrings )
4924 if ( value.type() == QVariant::List )
4927 const QVariantList toList = value.toList();
4928 parts.reserve( toList.size() );
4929 for (
const QVariant &val : toList )
4931 parts << mOptions.value(
static_cast< int >( val.toDouble() ) );
4933 return parts.join(
',' );
4935 else if ( value.type() == QVariant::String )
4937 const QStringList parts = value.toString().split(
',' );
4938 QStringList comments;
4939 if ( parts.count() > 1 )
4941 for (
const QString &part : parts )
4944 const int val = part.toInt( &ok );
4946 comments << mOptions.value( val );
4948 return comments.join(
',' );
4952 return mOptions.value(
static_cast< int >( value.toDouble() ) );
4958 QString code = QStringLiteral(
"##%1=" ).arg(
mName );
4960 code += QLatin1String(
"optional " );
4961 code += QLatin1String(
"enum " );
4963 if ( mAllowMultiple )
4964 code += QLatin1String(
"multiple " );
4966 if ( mUsesStaticStrings )
4967 code += QLatin1String(
"static " );
4969 code += mOptions.join(
';' ) +
' ';
4972 return code.trimmed();
4977 switch ( outputType )
4981 QString code = QStringLiteral(
"QgsProcessingParameterEnum('%1', %2" )
4984 code += QLatin1String(
", optional=True" );
4987 options.reserve( mOptions.size() );
4988 for (
const QString &o : mOptions )
4990 code += QStringLiteral(
", options=[%1]" ).arg(
options.join(
',' ) );
4992 code += QStringLiteral(
", allowMultiple=%1" ).arg( mAllowMultiple ? QStringLiteral(
"True" ) : QStringLiteral(
"False" ) );
4994 code += QStringLiteral(
", usesStaticStrings=%1" ).arg( mUsesStaticStrings ? QStringLiteral(
"True" ) : QStringLiteral(
"False" ) );
5017 return mAllowMultiple;
5027 return mUsesStaticStrings;
5038 map.insert( QStringLiteral(
"options" ), mOptions );
5039 map.insert( QStringLiteral(
"allow_multiple" ), mAllowMultiple );
5040 map.insert( QStringLiteral(
"uses_static_strings" ), mUsesStaticStrings );
5047 mOptions = map.value( QStringLiteral(
"options" ) ).toStringList();
5048 mAllowMultiple = map.value( QStringLiteral(
"allow_multiple" ) ).toBool();
5049 mUsesStaticStrings = map.value( QStringLiteral(
"uses_static_strings" ) ).toBool();
5056 QString def = definition;
5058 bool multiple =
false;
5059 if ( def.startsWith( QLatin1String(
"multiple" ), Qt::CaseInsensitive ) )
5065 bool staticStrings =
false;
5066 if ( def.startsWith( QLatin1String(
"static" ), Qt::CaseInsensitive ) )
5068 staticStrings =
true;
5072 const QRegularExpression re( QStringLiteral(
"(.*)\\s+(.*?)$" ) );
5073 const QRegularExpressionMatch m = re.match( def );
5074 QString values = def;
5077 values = m.captured( 1 ).trimmed();
5078 defaultVal = m.captured( 2 );
5086 , mMultiLine( multiLine )
5098 if ( !value.isValid() || value.isNull() )
5099 return QStringLiteral(
"None" );
5102 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( value.value<
QgsProperty >().
asExpression() );
5104 const QString s = value.toString();
5110 QString code = QStringLiteral(
"##%1=" ).arg(
mName );
5112 code += QLatin1String(
"optional " );
5113 code += QLatin1String(
"string " );
5116 code += QLatin1String(
"long " );
5119 return code.trimmed();
5124 switch ( outputType )
5128 QString code = QStringLiteral(
"QgsProcessingParameterString('%1', %2" )
5131 code += QLatin1String(
", optional=True" );
5132 code += QStringLiteral(
", multiLine=%1" ).arg( mMultiLine ? QStringLiteral(
"True" ) : QStringLiteral(
"False" ) );
5155 map.insert( QStringLiteral(
"multiline" ), mMultiLine );
5162 mMultiLine = map.value( QStringLiteral(
"multiline" ) ).toBool();
5168 QString def = definition;
5170 if ( def.startsWith( QLatin1String(
"long" ), Qt::CaseInsensitive ) )
5176 if ( def.startsWith(
'"' ) || def.startsWith(
'\'' ) )
5178 if ( def.endsWith(
'"' ) || def.endsWith(
'\'' ) )
5182 if ( def == QLatin1String(
"None" ) )
5205 if ( !value.isValid() )
5206 return QStringLiteral(
"None" );
5208 const QString s = value.toString();
5214 QString code = QStringLiteral(
"##%1=" ).arg(
mName );
5216 code += QLatin1String(
"optional " );
5217 code += QLatin1String(
"authcfg " );
5220 return code.trimmed();
5225 QString def = definition;
5227 if ( def.startsWith(
'"' ) || def.startsWith(
'\'' ) )
5229 if ( def.endsWith(
'"' ) || def.endsWith(
'\'' ) )
5233 if ( def == QLatin1String(
"None" ) )
5246 , mParentLayerParameterName( parentLayerParameterName )
5258 if ( !value.isValid() )
5259 return QStringLiteral(
"None" );
5262 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( value.value<
QgsProperty >().
asExpression() );
5264 const QString s = value.toString();
5270 QStringList depends;
5271 if ( !mParentLayerParameterName.isEmpty() )
5272 depends << mParentLayerParameterName;
5278 switch ( outputType )
5282 QString code = QStringLiteral(
"QgsProcessingParameterExpression('%1', %2" )
5285 code += QLatin1String(
", optional=True" );
5287 code += QStringLiteral(
", parentLayerParameterName='%1'" ).arg( mParentLayerParameterName );
5299 return mParentLayerParameterName;
5310 map.insert( QStringLiteral(
"parent_layer" ), mParentLayerParameterName );
5317 mParentLayerParameterName = map.value( QStringLiteral(
"parent_layer" ) ).toString();
5358 if ( qobject_cast< QgsVectorLayer * >( qvariant_cast<QObject *>( var ) ) )
5361 if ( var.type() != QVariant::String || var.toString().isEmpty() )
5379 if ( !val.isValid() )
5380 return QStringLiteral(
"None" );
5386 p.insert(
name(), val );
5394 switch ( outputType )
5398 QString code = QStringLiteral(
"QgsProcessingParameterVectorLayer('%1', %2" )
5401 code += QLatin1String(
", optional=True" );
5405 QStringList options;
5408 code += QStringLiteral(
", types=[%1]" ).arg( options.join(
',' ) );
5442 map.insert( QStringLiteral(
"data_types" ), types );
5450 const QVariantList values = map.value( QStringLiteral(
"data_types" ) ).toList();
5451 for (
const QVariant &val : values )
5464 const QVariant &defaultValue,
bool optional )
5495 if ( qobject_cast< QgsMeshLayer * >( qvariant_cast<QObject *>( var ) ) )
5498 if ( var.type() != QVariant::String || var.toString().isEmpty() )
5516 if ( !val.isValid() )
5517 return QStringLiteral(
"None" );
5523 p.insert(
name(), val );
5541 , mParentLayerParameterName( parentLayerParameterName )
5543 , mAllowMultiple( allowMultiple )
5544 , mDefaultToAllFields( defaultToAllFields )
5557 if ( !input.isValid() )
5565 if ( input.type() == QVariant::List || input.type() == QVariant::StringList )
5567 if ( !mAllowMultiple )
5573 else if ( input.type() == QVariant::String )
5575 if ( input.toString().isEmpty() )
5578 const QStringList parts = input.toString().split(
';' );
5579 if ( parts.count() > 1 && !mAllowMultiple )
5584 if ( input.toString().isEmpty() )
5592 if ( !value.isValid() )
5593 return QStringLiteral(
"None" );
5596 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( value.value<
QgsProperty >().
asExpression() );
5598 if ( value.type() == QVariant::List )
5601 const auto constToList = value.toList();
5602 for (
const QVariant &val : constToList )
5606 return parts.join(
',' ).prepend(
'[' ).append(
']' );
5608 else if ( value.type() == QVariant::StringList )
5611 const auto constToStringList = value.toStringList();
5612 for (
const QString &s : constToStringList )
5616 return parts.join(
',' ).prepend(
'[' ).append(
']' );
5624 QString code = QStringLiteral(
"##%1=" ).arg(
mName );
5626 code += QLatin1String(
"optional " );
5627 code += QLatin1String(
"field " );
5629 switch ( mDataType )
5632 code += QLatin1String(
"numeric " );
5636 code += QLatin1String(
"string " );
5640 code += QLatin1String(
"datetime " );
5647 if ( mAllowMultiple )
5648 code += QLatin1String(
"multiple " );
5650 if ( mDefaultToAllFields )
5651 code += QLatin1String(
"default_to_all_fields " );
5653 code += mParentLayerParameterName +
' ';
5656 return code.trimmed();
5661 switch ( outputType )
5665 QString code = QStringLiteral(
"QgsProcessingParameterField('%1', %2" )
5668 code += QLatin1String(
", optional=True" );
5671 switch ( mDataType )
5674 dataType = QStringLiteral(
"QgsProcessingParameterField.Any" );
5678 dataType = QStringLiteral(
"QgsProcessingParameterField.Numeric" );
5682 dataType = QStringLiteral(
"QgsProcessingParameterField.String" );
5686 dataType = QStringLiteral(
"QgsProcessingParameterField.DateTime" );
5689 code += QStringLiteral(
", type=%1" ).arg(
dataType );
5691 code += QStringLiteral(
", parentLayerParameterName='%1'" ).arg( mParentLayerParameterName );
5692 code += QStringLiteral(
", allowMultiple=%1" ).arg( mAllowMultiple ? QStringLiteral(
"True" ) : QStringLiteral(
"False" ) );
5696 if ( mDefaultToAllFields )
5697 code += QLatin1String(
", defaultToAllFields=True" );
5709 QStringList depends;
5710 if ( !mParentLayerParameterName.isEmpty() )
5711 depends << mParentLayerParameterName;
5717 return mParentLayerParameterName;
5737 return mAllowMultiple;
5747 return mDefaultToAllFields;
5752 mDefaultToAllFields = enabled;
5758 map.insert( QStringLiteral(
"parent_layer" ), mParentLayerParameterName );
5759 map.insert( QStringLiteral(
"data_type" ), mDataType );
5760 map.insert( QStringLiteral(
"allow_multiple" ), mAllowMultiple );
5761 map.insert( QStringLiteral(
"default_to_all_fields" ), mDefaultToAllFields );
5768 mParentLayerParameterName = map.value( QStringLiteral(
"parent_layer" ) ).toString();
5769 mDataType =
static_cast< DataType >( map.value( QStringLiteral(
"data_type" ) ).toInt() );
5770 mAllowMultiple = map.value( QStringLiteral(
"allow_multiple" ) ).toBool();
5771 mDefaultToAllFields = map.value( QStringLiteral(
"default_to_all_fields" ) ).toBool();
5781 QString def = definition;
5783 if ( def.startsWith( QLatin1String(
"numeric " ), Qt::CaseInsensitive ) )
5788 else if ( def.startsWith( QLatin1String(
"string " ), Qt::CaseInsensitive ) )
5793 else if ( def.startsWith( QLatin1String(
"datetime " ), Qt::CaseInsensitive ) )
5799 if ( def.startsWith( QLatin1String(
"multiple" ), Qt::CaseInsensitive ) )
5802 def = def.mid( 8 ).trimmed();
5805 if ( def.startsWith( QLatin1String(
"default_to_all_fields" ), Qt::CaseInsensitive ) )
5808 def = def.mid( 21 ).trimmed();
5811 const QRegularExpression re( QStringLiteral(
"(.*?)\\s+(.*)$" ) );
5812 const QRegularExpressionMatch m = re.match( def );
5815 parent = m.captured( 1 ).trimmed();
5816 def = m.captured( 2 );
5841 QVariant var = input;
5842 if ( !var.isValid() )
5869 if ( qobject_cast< QgsVectorLayer * >( qvariant_cast<QObject *>( input ) ) )
5874 if ( var.type() != QVariant::String || var.toString().isEmpty() )
5892 if ( !value.isValid() )
5893 return QStringLiteral(
"None" );
5901 QString geometryCheckString;
5905 geometryCheckString = QStringLiteral(
"QgsFeatureRequest.GeometryNoCheck" );
5909 geometryCheckString = QStringLiteral(
"QgsFeatureRequest.GeometrySkipInvalid" );
5913 geometryCheckString = QStringLiteral(
"QgsFeatureRequest.GeometryAbortOnInvalid" );
5919 if ( fromVar.
flags & QgsProcessingFeatureSourceDefinition::Flag::FlagOverrideDefaultGeometryCheck )
5920 flags << QStringLiteral(
"QgsProcessingFeatureSourceDefinition.FlagOverrideDefaultGeometryCheck" );
5921 if ( fromVar.
flags & QgsProcessingFeatureSourceDefinition::Flag::FlagCreateIndividualOutputPerInputFeature )
5922 flags << QStringLiteral(
"QgsProcessingFeatureSourceDefinition.FlagCreateIndividualOutputPerInputFeature" );
5923 if ( !
flags.empty() )
5924 flagString =
flags.join( QLatin1String(
" | " ) );
5931 layerString = layer->source();
5938 flagString.isEmpty() ? QString() : ( QStringLiteral(
", flags=%1" ).arg( flagString ) ),
5939 geometryCheckString );
5950 return QStringLiteral(
"QgsProcessingFeatureSourceDefinition(QgsProperty.fromExpression(%1), selectedFeaturesOnly=%2, featureLimit=%3%4, geometryCheck=%5)" )
5954 flagString.isEmpty() ? QString() : ( QStringLiteral(
", flags=%1" ).arg( flagString ) ),
5955 geometryCheckString );
5963 else if (
QgsVectorLayer *layer = qobject_cast< QgsVectorLayer * >( qvariant_cast<QObject *>( value ) ) )
5968 QString layerString = value.toString();
5972 layerString = layer->providerType() != QLatin1String(
"ogr" ) && layer->providerType() != QLatin1String(
"gdal" ) && layer->providerType() != QLatin1String(
"mdal" ) ?
QgsProcessingUtils::encodeProviderKeyAndUri( layer->providerType(), layer->source() ) : layer->source();
5979 QString code = QStringLiteral(
"##%1=" ).arg(
mName );
5981 code += QLatin1String(
"optional " );
5982 code += QLatin1String(
"source " );
5989 code += QLatin1String(
"point " );
5993 code += QLatin1String(
"line " );
5997 code += QLatin1String(
"polygon " );
6004 return code.trimmed();
6009 switch ( outputType )
6013 QString code = QStringLiteral(
"QgsProcessingParameterFeatureSource('%1', %2" )
6016 code += QLatin1String(
", optional=True" );
6020 QStringList options;
6024 code += QStringLiteral(
", types=[%1]" ).arg( options.join(
',' ) );
6041 : mDataTypes( types )
6054 map.insert( QStringLiteral(
"data_types" ), types );
6062 const QVariantList values = map.value( QStringLiteral(
"data_types" ) ).toList();
6063 for (
const QVariant &val : values )
6073 QString def = definition;
6076 if ( def.startsWith( QLatin1String(
"point" ), Qt::CaseInsensitive ) )
6082 else if ( def.startsWith( QLatin1String(
"line" ), Qt::CaseInsensitive ) )
6088 else if ( def.startsWith( QLatin1String(
"polygon" ), Qt::CaseInsensitive ) )
6103 , mSupportsAppend( supportsAppend )
6114 QVariant var = input;
6115 if ( !var.isValid() )
6137 if ( var.type() != QVariant::String )
6140 if ( var.toString().isEmpty() )
6148 if ( !value.isValid() )
6149 return QStringLiteral(
"None" );
6152 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( value.value<
QgsProperty >().
asExpression() );
6163 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( fromVar.
sink.
asExpression() );
6172 QString code = QStringLiteral(
"##%1=" ).arg(
mName );
6174 code += QLatin1String(
"optional " );
6175 code += QLatin1String(
"sink " );
6177 switch ( mDataType )
6180 code += QLatin1String(
"point " );
6184 code += QLatin1String(
"line " );
6188 code += QLatin1String(
"polygon " );
6192 code += QLatin1String(
"table " );
6200 return code.trimmed();
6212 return lOriginalProvider->defaultVectorFileExtension(
hasGeometry() );
6216 return p->defaultVectorFileExtension(
hasGeometry() );
6226 return QStringLiteral(
"dbf" );
6233 switch ( outputType )
6237 QString code = QStringLiteral(
"QgsProcessingParameterFeatureSink('%1', %2" )
6240 code += QLatin1String(
", optional=True" );
6244 code += QStringLiteral(
", createByDefault=%1" ).arg(
createByDefault() ? QStringLiteral(
"True" ) : QStringLiteral(
"False" ) );
6245 if ( mSupportsAppend )
6246 code += QLatin1String(
", supportsAppend=True" );
6259 QStringList filters;
6260 for (
const QString &ext : exts )
6262 filters << QObject::tr(
"%1 files (*.%2)" ).arg( ext.toUpper(), ext.toLower() );
6264 return filters.join( QLatin1String(
";;" ) ) + QStringLiteral(
";;" ) + QObject::tr(
"All files (*.*)" );
6273 return lOriginalProvider->supportedOutputVectorLayerExtensions();
6275 return lOriginalProvider->supportedOutputTableExtensions();
6280 return p->supportedOutputVectorLayerExtensions();
6282 return p->supportedOutputTableExtensions();
6297 switch ( mDataType )
6326 map.insert( QStringLiteral(
"data_type" ), mDataType );
6327 map.insert( QStringLiteral(
"supports_append" ), mSupportsAppend );
6335 mSupportsAppend = map.value( QStringLiteral(
"supports_append" ), false ).toBool();
6342 return QStringLiteral(
"memory:%1" ).arg(
description() );
6350 QString def = definition;
6351 if ( def.startsWith( QLatin1String(
"point" ), Qt::CaseInsensitive ) )
6356 else if ( def.startsWith( QLatin1String(
"line" ), Qt::CaseInsensitive ) )
6361 else if ( def.startsWith( QLatin1String(
"polygon" ), Qt::CaseInsensitive ) )
6366 else if ( def.startsWith( QLatin1String(
"table" ), Qt::CaseInsensitive ) )
6377 return mSupportsAppend;
6397 QVariant var = input;
6398 if ( !var.isValid() )
6420 if ( var.type() != QVariant::String )
6423 if ( var.toString().isEmpty() )
6431 if ( !value.isValid() )
6432 return QStringLiteral(
"None" );
6435 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( value.value<
QgsProperty >().
asExpression() );
6446 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( fromVar.
sink.
asExpression() );
6462 return lOriginalProvider->defaultRasterFileExtension();
6466 return p->defaultRasterFileExtension();
6477 QStringList filters;
6478 for (
const QString &ext : exts )
6480 filters << QObject::tr(
"%1 files (*.%2)" ).arg( ext.toUpper(), ext.toLower() );
6482 return filters.join( QLatin1String(
";;" ) ) + QStringLiteral(
";;" ) + QObject::tr(
"All files (*.*)" );
6489 return lOriginalProvider->supportedOutputRasterLayerExtensions();
6493 return p->supportedOutputRasterLayerExtensions();
6509 , mFileFilter( fileFilter.isEmpty() ? QObject::tr(
"All files (*.*)" ) : fileFilter )
6521 QVariant var = input;
6522 if ( !var.isValid() )
6544 if ( var.type() != QVariant::String )
6547 if ( var.toString().isEmpty() )
6557 if ( !value.isValid() )
6558 return QStringLiteral(
"None" );
6561 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( value.value<
QgsProperty >().
asExpression() );
6572 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( fromVar.
sink.
asExpression() );
6581 if ( !mFileFilter.isEmpty() && mFileFilter.contains( QStringLiteral(
"htm" ), Qt::CaseInsensitive ) )
6593 if ( mFileFilter.isEmpty() || mFileFilter == QObject::tr(
"All files (*.*)" ) )
6594 return QStringLiteral(
"file" );
6597 const QRegularExpression rx( QStringLiteral(
".*?\\(\\*\\.([a-zA-Z0-9._]+).*" ) );
6598 const QRegularExpressionMatch match = rx.match( mFileFilter );
6599 if ( !match.hasMatch() )
6600 return QStringLiteral(
"file" );
6602 return match.captured( 1 );
6607 switch ( outputType )
6611 QString code = QStringLiteral(
"QgsProcessingParameterFileDestination('%1', %2" )
6614 code += QLatin1String(
", optional=True" );
6618 code += QStringLiteral(
", createByDefault=%1" ).arg(
createByDefault() ? QStringLiteral(
"True" ) : QStringLiteral(
"False" ) );
6630 return (
fileFilter().isEmpty() ? QString() :
fileFilter() + QStringLiteral(
";;" ) ) + QObject::tr(
"All files (*.*)" );
6646 map.insert( QStringLiteral(
"file_filter" ), mFileFilter );
6653 mFileFilter = map.value( QStringLiteral(
"file_filter" ) ).toString();
6674 QVariant var = input;
6675 if ( !var.isValid() )
6691 if ( var.type() != QVariant::String )
6694 if ( var.toString().isEmpty() )
6717 , mCreateByDefault( createByDefault )
6725 map.insert( QStringLiteral(
"supports_non_file_outputs" ), mSupportsNonFileBasedOutputs );
6726 map.insert( QStringLiteral(
"create_by_default" ), mCreateByDefault );
6733 mSupportsNonFileBasedOutputs = map.value( QStringLiteral(
"supports_non_file_outputs" ) ).toBool();
6734 mCreateByDefault = map.value( QStringLiteral(
"create_by_default" ), QStringLiteral(
"1" ) ).toBool();
6740 switch ( outputType )
6747 QString code = t->className() + QStringLiteral(
"('%1', %2" )
6750 code += QLatin1String(
", optional=True" );
6752 code += QStringLiteral(
", createByDefault=%1" ).arg( mCreateByDefault ? QStringLiteral(
"True" ) : QStringLiteral(
"False" ) );
6767 return QObject::tr(
"Default extension" ) + QStringLiteral(
" (*." ) +
defaultFileExtension() +
')';
6774 const QRegularExpression rx( QStringLiteral(
"[.]" ) );
6775 QString sanitizedName =
name();
6776 sanitizedName.replace( rx, QStringLiteral(
"_" ) );
6791 return lOriginalProvider->isSupportedOutputValue( value,
this, context, error );
6800 return mCreateByDefault;
6822 QVariant var = input;
6823 if ( !var.isValid() )
6845 if ( var.type() != QVariant::String )
6848 if ( var.toString().isEmpty() )
6856 if ( !value.isValid() )
6857 return QStringLiteral(
"None" );
6860 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( value.value<
QgsProperty >().
asExpression() );
6871 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( fromVar.
sink.
asExpression() );
6880 QString code = QStringLiteral(
"##%1=" ).arg(
mName );
6882 code += QLatin1String(
"optional " );
6883 code += QLatin1String(
"vectorDestination " );
6885 switch ( mDataType )
6888 code += QLatin1String(
"point " );
6892 code += QLatin1String(
"line " );
6896 code += QLatin1String(
"polygon " );
6904 return code.trimmed();
6916 return lOriginalProvider->defaultVectorFileExtension(
hasGeometry() );
6920 return p->defaultVectorFileExtension(
hasGeometry() );
6930 return QStringLiteral(
"dbf" );
6937 switch ( outputType )
6941 QString code = QStringLiteral(
"QgsProcessingParameterVectorDestination('%1', %2" )
6944 code += QLatin1String(
", optional=True" );
6948 code += QStringLiteral(
", createByDefault=%1" ).arg(
createByDefault() ? QStringLiteral(
"True" ) : QStringLiteral(
"False" ) );
6961 QStringList filters;
6962 for (
const QString &ext : exts )
6964 filters << QObject::tr(
"%1 files (*.%2)" ).arg( ext.toUpper(), ext.toLower() );
6966 return filters.join( QLatin1String(
";;" ) ) + QStringLiteral(
";;" ) + QObject::tr(
"All files (*.*)" );
6974 return lOriginalProvider->supportedOutputVectorLayerExtensions();
6976 return lOriginalProvider->supportedOutputTableExtensions();
6981 return p->supportedOutputVectorLayerExtensions();
6983 return p->supportedOutputTableExtensions();
6998 switch ( mDataType )
7027 map.insert( QStringLiteral(
"data_type" ), mDataType );
7041 QString def = definition;
7042 if ( def.startsWith( QLatin1String(
"point" ), Qt::CaseInsensitive ) )
7047 else if ( def.startsWith( QLatin1String(
"line" ), Qt::CaseInsensitive ) )
7052 else if ( def.startsWith( QLatin1String(
"polygon" ), Qt::CaseInsensitive ) )
7063 , mParentLayerParameterName( parentLayerParameterName )
7064 , mAllowMultiple( allowMultiple )
7076 if ( !input.isValid() )
7084 if ( input.type() == QVariant::List || input.type() == QVariant::StringList )
7086 if ( !mAllowMultiple )
7095 const double res = input.toInt( &ok );
7105 return mAllowMultiple;
7115 if ( !value.isValid() )
7116 return QStringLiteral(
"None" );
7119 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( value.value<
QgsProperty >().
asExpression() );
7121 if ( value.type() == QVariant::List )
7124 const QVariantList values = value.toList();
7125 for (
auto it = values.constBegin(); it != values.constEnd(); ++it )
7127 parts << QString::number( static_cast< int >( it->toDouble() ) );
7129 return parts.join(
',' ).prepend(
'[' ).append(
']' );
7131 else if ( value.type() == QVariant::StringList )
7134 const QStringList values = value.toStringList();
7135 for (
auto it = values.constBegin(); it != values.constEnd(); ++it )
7137 parts << QString::number( static_cast< int >( it->toDouble() ) );
7139 return parts.join(
',' ).prepend(
'[' ).append(
']' );
7142 return value.toString();
7147 QString code = QStringLiteral(
"##%1=" ).arg(
mName );
7149 code += QLatin1String(
"optional " );
7150 code += QLatin1String(
"band " );
7152 if ( mAllowMultiple )
7153 code += QLatin1String(
"multiple " );
7155 code += mParentLayerParameterName +
' ';
7158 return code.trimmed();
7163 QStringList depends;
7164 if ( !mParentLayerParameterName.isEmpty() )
7165 depends << mParentLayerParameterName;
7171 switch ( outputType )
7175 QString code = QStringLiteral(
"QgsProcessingParameterBand('%1', %2" )
7178 code += QLatin1String(
", optional=True" );
7180 code += QStringLiteral(
", parentLayerParameterName='%1'" ).arg( mParentLayerParameterName );
7181 code += QStringLiteral(
", allowMultiple=%1" ).arg( mAllowMultiple ? QStringLiteral(
"True" ) : QStringLiteral(
"False" ) );
7193 return mParentLayerParameterName;
7204 map.insert( QStringLiteral(
"parent_layer" ), mParentLayerParameterName );
7205 map.insert( QStringLiteral(
"allow_multiple" ), mAllowMultiple );
7212 mParentLayerParameterName = map.value( QStringLiteral(
"parent_layer" ) ).toString();
7213 mAllowMultiple = map.value( QStringLiteral(
"allow_multiple" ) ).toBool();
7220 QString def = definition;
7223 if ( def.startsWith( QLatin1String(
"multiple" ), Qt::CaseInsensitive ) )
7226 def = def.mid( 8 ).trimmed();
7229 const QRegularExpression re( QStringLiteral(
"(.*?)\\s+(.*)$" ) );
7230 const QRegularExpressionMatch m = re.match( def );
7233 parent = m.captured( 1 ).trimmed();
7234 def = m.captured( 2 );
7251 , mParentParameterName( parentParameterName )
7268 QStringList depends;
7269 if ( !mParentParameterName.isEmpty() )
7270 depends << mParentParameterName;
7276 switch ( outputType )
7280 QString code = QStringLiteral(
"QgsProcessingParameterDistance('%1', %2" )
7283 code += QLatin1String(
", optional=True" );
7285 code += QStringLiteral(
", parentParameterName='%1'" ).arg( mParentParameterName );
7287 if (
minimum() != std::numeric_limits<double>::lowest() + 1 )
7288 code += QStringLiteral(
", minValue=%1" ).arg(
minimum() );
7289 if (
maximum() != std::numeric_limits<double>::max() )
7290 code += QStringLiteral(
", maxValue=%1" ).arg(
maximum() );
7301 return mParentParameterName;
7312 map.insert( QStringLiteral(
"parent" ), mParentParameterName );
7313 map.insert( QStringLiteral(
"default_unit" ),
static_cast< int >( mDefaultUnit ) );
7320 mParentParameterName = map.value( QStringLiteral(
"parent" ) ).toString();
7347 switch ( outputType )
7351 QString code = QStringLiteral(
"QgsProcessingParameterDuration('%1', %2" )
7354 code += QLatin1String(
", optional=True" );
7356 if (
minimum() != std::numeric_limits<double>::lowest() + 1 )
7357 code += QStringLiteral(
", minValue=%1" ).arg(
minimum() );
7358 if (
maximum() != std::numeric_limits<double>::max() )
7359 code += QStringLiteral(
", maxValue=%1" ).arg(
maximum() );
7371 map.insert( QStringLiteral(
"default_unit" ),
static_cast< int >( mDefaultUnit ) );
7405 switch ( outputType )
7409 QString code = QStringLiteral(
"QgsProcessingParameterScale('%1', %2" )
7412 code += QLatin1String(
", optional=True" );
7424 : ( definition.toLower().trimmed() == QLatin1String(
"none" ) ? QVariant() : definition ), isOptional );
7443 if ( !value.isValid() || value.isNull() )
7444 return QStringLiteral(
"None" );
7447 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( value.value<
QgsProperty >().
asExpression() );
7449 const QString s = value.toString();
7455 QString code = QStringLiteral(
"##%1=" ).arg(
mName );
7457 code += QLatin1String(
"optional " );
7458 code += QLatin1String(
"layout " );
7461 return code.trimmed();
7466 switch ( outputType )
7470 QString code = QStringLiteral(
"QgsProcessingParameterLayout('%1', %2" )
7473 code += QLatin1String(
", optional=True" );
7484 QString def = definition;
7486 if ( def.startsWith(
'"' ) || def.startsWith(
'\'' ) )
7488 if ( def.endsWith(
'"' ) || def.endsWith(
'\'' ) )
7492 if ( def == QLatin1String(
"None" ) )
7505 , mParentLayoutParameterName( parentLayoutParameterName )
7506 , mItemType( itemType )
7518 if ( !value.isValid() || value.isNull() )
7519 return QStringLiteral(
"None" );
7522 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( value.value<
QgsProperty >().
asExpression() );
7524 const QString s = value.toString();
7530 QString code = QStringLiteral(
"##%1=" ).arg(
mName );
7532 code += QLatin1String(
"optional " );
7533 code += QLatin1String(
"layoutitem " );
7534 if ( mItemType >= 0 )
7535 code += QString::number( mItemType ) +
' ';
7537 code += mParentLayoutParameterName +
' ';
7540 return code.trimmed();
7545 switch ( outputType )
7549 QString code = QStringLiteral(
"QgsProcessingParameterLayoutItem('%1', %2" )
7552 code += QLatin1String(
", optional=True" );
7554 if ( mItemType >= 0 )
7555 code += QStringLiteral(
", itemType=%1" ).arg( mItemType );
7557 code += QStringLiteral(
", parentLayoutParameterName='%1'" ).arg( mParentLayoutParameterName );
7570 map.insert( QStringLiteral(
"parent_layout" ), mParentLayoutParameterName );
7571 map.insert( QStringLiteral(
"item_type" ), mItemType );
7578 mParentLayoutParameterName = map.value( QStringLiteral(
"parent_layout" ) ).toString();
7579 mItemType = map.value( QStringLiteral(
"item_type" ) ).toInt();
7585 QStringList depends;
7586 if ( !mParentLayoutParameterName.isEmpty() )
7587 depends << mParentLayoutParameterName;
7594 QString def = definition;
7596 const QRegularExpression re( QStringLiteral(
"(\\d+)?\\s*(.*?)\\s+(.*)$" ) );
7597 const QRegularExpressionMatch m = re.match( def );
7600 itemType = m.captured( 1 ).trimmed().isEmpty() ? -1 : m.captured( 1 ).trimmed().toInt();
7601 parent = m.captured( 2 ).trimmed().isEmpty() ? m.captured( 3 ).trimmed() : m.captured( 2 ).trimmed();
7602 def = !m.captured( 2 ).trimmed().isEmpty() ? m.captured( 3 ) : QString();
7615 return mParentLayoutParameterName;
7620 mParentLayoutParameterName =
name;
7639 , mAllowOpacity( opacityEnabled )
7651 if ( !value.isValid() || value.isNull() )
7652 return QStringLiteral(
"None" );
7655 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( value.value<
QgsProperty >().
asExpression() );
7657 if ( value.canConvert< QColor >() && !value.value< QColor >().isValid() )
7658 return QStringLiteral(
"QColor()" );
7660 if ( value.canConvert< QColor >() )
7662 const QColor
c = value.value< QColor >();
7663 if ( !mAllowOpacity ||
c.alpha() == 255 )
7664 return QStringLiteral(
"QColor(%1, %2, %3)" ).arg(
c.red() ).arg(
c.green() ).arg(
c.blue() );
7666 return QStringLiteral(
"QColor(%1, %2, %3, %4)" ).arg(
c.red() ).arg(
c.green() ).arg(
c.blue() ).arg(
c.alpha() );
7669 const QString s = value.toString();
7675 QString code = QStringLiteral(
"##%1=" ).arg(
mName );
7677 code += QLatin1String(
"optional " );
7678 code += QLatin1String(
"color " );
7680 if ( mAllowOpacity )
7681 code += QLatin1String(
"withopacity " );
7684 return code.trimmed();
7689 switch ( outputType )
7693 QString code = QStringLiteral(
"QgsProcessingParameterColor('%1', %2" )
7696 code += QLatin1String(
", optional=True" );
7698 code += QStringLiteral(
", opacityEnabled=%1" ).arg( mAllowOpacity ? QStringLiteral(
"True" ) : QStringLiteral(
"False" ) );
7710 if ( !input.isValid() && (
mDefault.isValid() && ( !
mDefault.toString().isEmpty() ||
mDefault.value< QColor >().isValid() ) ) )
7713 if ( !input.isValid() )
7716 if ( input.type() == QVariant::Color )
7725 if ( input.type() != QVariant::String || input.toString().isEmpty() )
7728 bool containsAlpha =
false;
7735 map.insert( QStringLiteral(
"opacityEnabled" ), mAllowOpacity );
7742 mAllowOpacity = map.value( QStringLiteral(
"opacityEnabled" ) ).toBool();
7748 return mAllowOpacity;
7753 mAllowOpacity = enabled;
7758 QString def = definition;
7760 bool allowOpacity =
false;
7761 if ( def.startsWith( QLatin1String(
"withopacity" ), Qt::CaseInsensitive ) )
7763 allowOpacity =
true;
7764 def = def.mid( 12 );
7767 if ( def.startsWith(
'"' ) || def.startsWith(
'\'' ) )
7769 if ( def.endsWith(
'"' ) || def.endsWith(
'\'' ) )
7773 if ( def == QLatin1String(
"None" ) )
7784 , mSourceParameterName( sourceCrsParameterName )
7785 , mDestParameterName( destinationCrsParameterName )
7786 , mSourceCrs( staticSourceCrs )
7787 , mDestCrs( staticDestinationCrs )
7799 if ( !value.isValid() || value.isNull() )
7800 return QStringLiteral(
"None" );
7805 return QStringLiteral(
"QgsCoordinateReferenceSystem()" );
7811 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( value.value<
QgsProperty >().
asExpression() );
7814 p.insert(
name(), value );
7819 const QString s = value.toString();
7825 QString code = QStringLiteral(
"##%1=" ).arg(
mName );
7827 code += QLatin1String(
"optional " );
7828 code += QLatin1String(
"coordinateoperation " );
7831 return code.trimmed();
7836 switch ( outputType )
7841 QString code = QStringLiteral(
"QgsProcessingParameterCoordinateOperation('%1', %2" )
7844 code += QLatin1String(
", optional=True" );
7845 if ( !mSourceParameterName.isEmpty() )
7846 code += QStringLiteral(
", sourceCrsParameterName=%1" ).arg(
valueAsPythonString( mSourceParameterName,
c ) );
7847 if ( !mDestParameterName.isEmpty() )
7848 code += QStringLiteral(
", destinationCrsParameterName=%1" ).arg(
valueAsPythonString( mDestParameterName,
c ) );
7850 if ( mSourceCrs.isValid() )
7852 if ( mDestCrs.isValid() )
7853 code += QStringLiteral(
", staticDestinationCrs=%1" ).arg(
valueAsPythonString( mDestCrs,
c ) );
7865 if ( !mSourceParameterName.isEmpty() )
7866 res << mSourceParameterName;
7867 if ( !mDestParameterName.isEmpty() )
7868 res << mDestParameterName;
7875 map.insert( QStringLiteral(
"source_crs_parameter_name" ), mSourceParameterName );
7876 map.insert( QStringLiteral(
"dest_crs_parameter_name" ), mDestParameterName );
7877 map.insert( QStringLiteral(
"static_source_crs" ), mSourceCrs );
7878 map.insert( QStringLiteral(
"static_dest_crs" ), mDestCrs );
7885 mSourceParameterName = map.value( QStringLiteral(
"source_crs_parameter_name" ) ).toString();
7886 mDestParameterName = map.value( QStringLiteral(
"dest_crs_parameter_name" ) ).toString();
7887 mSourceCrs = map.value( QStringLiteral(
"static_source_crs" ) );
7888 mDestCrs = map.value( QStringLiteral(
"static_dest_crs" ) );
7894 QString def = definition;
7896 if ( def.startsWith(
'"' ) || def.startsWith(
'\'' ) )
7898 if ( def.endsWith(
'"' ) || def.endsWith(
'\'' ) )
7902 if ( def == QLatin1String(
"None" ) )
7927 if ( !input.isValid() && !
mDefault.isValid() )
7930 if ( ( input.type() == QVariant::String && input.toString().isEmpty() )
7931 || ( !input.isValid() &&
mDefault.type() == QVariant::String &&
mDefault.toString().isEmpty() ) )
7939 if ( !value.isValid() )
7940 return QStringLiteral(
"None" );
7943 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( value.value<
QgsProperty >().
asExpression() );
7950 QString code = QStringLiteral(
"##%1=" ).arg(
mName );
7952 code += QLatin1String(
"optional " );
7953 code += QLatin1String(
"maptheme " );
7956 return code.trimmed();
7961 switch ( outputType )
7965 QString code = QStringLiteral(
"QgsProcessingParameterMapTheme('%1', %2" )
7968 code += QLatin1String(
", optional=True" );
7993 QString def = definition;
7994 if ( def.startsWith(
'"' ) || def.startsWith(
'\'' ) )
7996 if ( def.endsWith(
'"' ) || def.endsWith(
'\'' ) )
8018 if ( mMin.isValid() && mMax.isValid() && mMin >= mMax )
8020 QgsMessageLog::logMessage( QObject::tr(
"Invalid datetime parameter \"%1\": min value %2 is >= max value %3!" ).arg(
name, mMin.toString(), mMax.toString() ), QObject::tr(
"Processing" ) );
8031 QVariant input = value;
8032 if ( !input.isValid() )
8045 if ( input.type() != QVariant::DateTime && input.type() != QVariant::Date && input.type() != QVariant::Time && input.type() != QVariant::String )
8048 if ( ( input.type() == QVariant::DateTime || input.type() == QVariant::Date ) && mDataType ==
Time )
8051 if ( input.type() == QVariant::String )
8053 const QString s = input.toString();
8057 input = QDateTime::fromString( s, Qt::ISODate );
8058 if ( mDataType ==
Time )
8060 if ( !input.toDateTime().isValid() )
8061 input = QTime::fromString( s );
8063 input = input.toDateTime().time();
8067 if ( mDataType !=
Time )
8069 const QDateTime res = input.toDateTime();
8070 return res.isValid() && ( res >= mMin || !mMin.isValid() ) && ( res <= mMax || !mMax.isValid() );
8074 const QTime res = input.toTime();
8075 return res.isValid() && ( res >= mMin.time() || !mMin.isValid() ) && ( res <= mMax.time() || !mMax.isValid() );
8081 if ( !value.isValid() )
8082 return QStringLiteral(
"None" );
8085 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( value.value<
QgsProperty >().
asExpression() );
8087 if ( value.type() == QVariant::DateTime )
8089 const QDateTime dt = value.toDateTime();
8090 if ( !dt.isValid() )
8091 return QStringLiteral(
"QDateTime()" );
8093 return QStringLiteral(
"QDateTime(QDate(%1, %2, %3), QTime(%4, %5, %6))" ).arg( dt.date().year() )
8094 .arg( dt.date().month() )
8095 .arg( dt.date().day() )
8096 .arg( dt.time().hour() )
8097 .arg( dt.time().minute() )
8098 .arg( dt.time().second() );
8100 else if ( value.type() == QVariant::Date )
8102 const QDate dt = value.toDate();
8103 if ( !dt.isValid() )
8104 return QStringLiteral(
"QDate()" );
8106 return QStringLiteral(
"QDate(%1, %2, %3)" ).arg( dt.year() )
8110 else if ( value.type() == QVariant::Time )
8112 const QTime dt = value.toTime();
8113 if ( !dt.isValid() )
8114 return QStringLiteral(
"QTime()" );
8116 return QStringLiteral(
"QTime(%4, %5, %6)" )
8119 .arg( dt.second() );
8121 return value.toString();
8128 if ( mMin.isValid() )
8129 parts << QObject::tr(
"Minimum value: %1" ).arg( mMin.toString( Qt::ISODate ) );
8130 if ( mMax.isValid() )
8131 parts << QObject::tr(
"Maximum value: %1" ).arg( mMax.toString( Qt::ISODate ) );
8133 parts << QObject::tr(
"Default value: %1" ).arg( mDataType ==
DateTime ?
mDefault.toDateTime().toString( Qt::ISODate ) :
8134 ( mDataType ==
Date ?
mDefault.toDate().toString( Qt::ISODate ) :
mDefault.toTime( ).toString() ) );
8135 const QString extra = parts.join( QLatin1String(
"<br />" ) );
8136 if ( !extra.isEmpty() )
8137 text += QStringLiteral(
"<p>%1</p>" ).arg( extra );
8143 switch ( outputType )
8147 QString code = QStringLiteral(
"QgsProcessingParameterDateTime('%1', %2" )
8150 code += QLatin1String(
", optional=True" );
8152 code += QStringLiteral(
", type=%1" ).arg( mDataType ==
DateTime ? QStringLiteral(
"QgsProcessingParameterDateTime.DateTime" )
8153 : mDataType ==
Date ? QStringLiteral(
"QgsProcessingParameterDateTime.Date" )
8154 : QStringLiteral(
"QgsProcessingParameterDateTime.Time" ) );
8157 if ( mMin.isValid() )
8159 if ( mMax.isValid() )
8201 map.insert( QStringLiteral(
"min" ), mMin );
8202 map.insert( QStringLiteral(
"max" ), mMax );
8203 map.insert( QStringLiteral(
"data_type" ), mDataType );
8210 mMin = map.value( QStringLiteral(
"min" ) ).toDateTime();
8211 mMax = map.value( QStringLiteral(
"max" ) ).toDateTime();
8212 mDataType =
static_cast< Type >( map.value( QStringLiteral(
"data_type" ) ).toInt() );
8219 : ( definition.toLower().trimmed() == QLatin1String(
"none" ) ? QVariant() : definition ), isOptional );
8230 , mProviderId( provider )
8243 if ( !input.isValid() && !
mDefault.isValid() )
8246 if ( ( input.type() == QVariant::String && input.toString().isEmpty() )
8247 || ( !input.isValid() &&
mDefault.type() == QVariant::String &&
mDefault.toString().isEmpty() ) )
8255 if ( !value.isValid() )
8256 return QStringLiteral(
"None" );
8259 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( value.value<
QgsProperty >().
asExpression() );
8266 QString code = QStringLiteral(
"##%1=" ).arg(
mName );
8268 code += QLatin1String(
"optional " );
8269 code += QLatin1String(
"providerconnection " );
8270 code += mProviderId +
' ';
8273 return code.trimmed();
8278 switch ( outputType )
8282 QString code = QStringLiteral(
"QgsProcessingParameterProviderConnection('%1', %2, '%3'" )
8285 code += QLatin1String(
", optional=True" );
8299 map.insert( QStringLiteral(
"provider" ), mProviderId );
8306 mProviderId = map.value( QStringLiteral(
"provider" ) ).toString();
8312 QString def = definition;
8314 if ( def.contains(
' ' ) )
8316 provider = def.left( def.indexOf(
' ' ) );
8317 def = def.mid( def.indexOf(
' ' ) + 1 );
8325 if ( def.startsWith(
'"' ) || def.startsWith(
'\'' ) )
8327 if ( def.endsWith(
'"' ) || def.endsWith(
'\'' ) )
8345 , mParentConnectionParameterName( parentLayerParameterName )
8358 if ( !input.isValid() && !
mDefault.isValid() )
8361 if ( ( input.type() == QVariant::String && input.toString().isEmpty() )
8362 || ( !input.isValid() &&
mDefault.type() == QVariant::String &&
mDefault.toString().isEmpty() ) )
8370 if ( !value.isValid() )
8371 return QStringLiteral(
"None" );
8374 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( value.value<
QgsProperty >().
asExpression() );
8381 QString code = QStringLiteral(
"##%1=" ).arg(
mName );
8383 code += QLatin1String(
"optional " );
8384 code += QLatin1String(
"databaseschema " );
8386 code += mParentConnectionParameterName +
' ';
8389 return code.trimmed();
8394 switch ( outputType )
8398 QString code = QStringLiteral(
"QgsProcessingParameterDatabaseSchema('%1', %2" )
8401 code += QLatin1String(
", optional=True" );
8403 code += QStringLiteral(
", connectionParameterName='%1'" ).arg( mParentConnectionParameterName );
8417 QStringList depends;
8418 if ( !mParentConnectionParameterName.isEmpty() )
8419 depends << mParentConnectionParameterName;
8425 return mParentConnectionParameterName;
8430 mParentConnectionParameterName =
name;
8436 map.insert( QStringLiteral(
"mParentConnectionParameterName" ), mParentConnectionParameterName );
8443 mParentConnectionParameterName = map.value( QStringLiteral(
"mParentConnectionParameterName" ) ).toString();
8450 QString def = definition;
8452 const QRegularExpression re( QStringLiteral(
"(.*?)\\s+(.*)$" ) );
8453 const QRegularExpressionMatch m = re.match( def );
8456 parent = m.captured( 1 ).trimmed();
8457 def = m.captured( 2 );
8473 const QString &connectionParameterName,
8474 const QString &schemaParameterName,
8475 const QVariant &defaultValue,
bool optional,
bool allowNewTableNames )
8477 , mParentConnectionParameterName( connectionParameterName )
8478 , mParentSchemaParameterName( schemaParameterName )
8479 , mAllowNewTableNames( allowNewTableNames )
8492 if ( !input.isValid() && !
mDefault.isValid() )
8495 if ( ( input.type() == QVariant::String && input.toString().isEmpty() )
8496 || ( !input.isValid() &&
mDefault.type() == QVariant::String &&
mDefault.toString().isEmpty() ) )
8504 if ( !value.isValid() )
8505 return QStringLiteral(
"None" );
8508 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( value.value<
QgsProperty >().
asExpression() );
8515 QString code = QStringLiteral(
"##%1=" ).arg(
mName );
8517 code += QLatin1String(
"optional " );
8518 code += QLatin1String(
"databasetable " );
8520 code += ( mParentConnectionParameterName.isEmpty() ? QStringLiteral(
"none" ) : mParentConnectionParameterName ) +
' ';
8521 code += ( mParentSchemaParameterName.isEmpty() ? QStringLiteral(
"none" ) : mParentSchemaParameterName ) +
' ';
8524 return code.trimmed();
8529 switch ( outputType )
8533 QString code = QStringLiteral(
"QgsProcessingParameterDatabaseTable('%1', %2" )
8536 code += QLatin1String(
", optional=True" );
8538 if ( mAllowNewTableNames )
8539 code += QLatin1String(
", allowNewTableNames=True" );
8541 code += QStringLiteral(
", connectionParameterName='%1'" ).arg( mParentConnectionParameterName );
8542 code += QStringLiteral(
", schemaParameterName='%1'" ).arg( mParentSchemaParameterName );
8556 QStringList depends;
8557 if ( !mParentConnectionParameterName.isEmpty() )
8558 depends << mParentConnectionParameterName;
8559 if ( !mParentSchemaParameterName.isEmpty() )
8560 depends << mParentSchemaParameterName;
8566 return mParentConnectionParameterName;
8571 mParentConnectionParameterName =
name;
8576 return mParentSchemaParameterName;
8581 mParentSchemaParameterName =
name;
8587 map.insert( QStringLiteral(
"mParentConnectionParameterName" ), mParentConnectionParameterName );
8588 map.insert( QStringLiteral(
"mParentSchemaParameterName" ), mParentSchemaParameterName );
8589 map.insert( QStringLiteral(
"mAllowNewTableNames" ), mAllowNewTableNames );
8596 mParentConnectionParameterName = map.value( QStringLiteral(
"mParentConnectionParameterName" ) ).toString();
8597 mParentSchemaParameterName = map.value( QStringLiteral(
"mParentSchemaParameterName" ) ).toString();
8598 mAllowNewTableNames = map.value( QStringLiteral(
"mAllowNewTableNames" ),
false ).toBool();
8606 QString def = definition;
8608 const QRegularExpression re( QStringLiteral(
"(.*?)\\s+(.*+)\\b\\s*(.*)$" ) );
8609 const QRegularExpressionMatch m = re.match( def );
8612 connection = m.captured( 1 ).trimmed();
8613 if ( connection == QLatin1String(
"none" ) )
8615 schema = m.captured( 2 ).trimmed();
8616 if ( schema == QLatin1String(
"none" ) )
8618 def = m.captured( 3 );
8626 return mAllowNewTableNames;
8639 const QVariant &defaultValue,
bool optional )
8669 if ( qobject_cast< QgsPointCloudLayer * >( qvariant_cast<QObject *>( var ) ) )
8672 if ( var.type() != QVariant::String || var.toString().isEmpty() )
8690 if ( !val.isValid() )
8691 return QStringLiteral(
"None" );
8697 p.insert(
name(), val );
8718 const QVariant &defaultValue,
bool optional )
8748 if ( qobject_cast< QgsAnnotationLayer * >( qvariant_cast<QObject *>( var ) ) )
8751 if ( var.type() != QVariant::String || var.toString().isEmpty() )
8769 if ( !val.isValid() )
8770 return QStringLiteral(
"None" );
8776 p.insert(
name(), val );
8799 QVariant var = input;
8800 if ( !var.isValid() )
8822 if ( var.type() != QVariant::String )
8825 if ( var.toString().isEmpty() )
8833 if ( !value.isValid() )
8834 return QStringLiteral(
"None" );
8837 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( value.value<
QgsProperty >().
asExpression() );
8848 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( fromVar.
sink.
asExpression() );
8864 return lOriginalProvider->defaultPointCloudFileExtension();
8868 return p->defaultPointCloudFileExtension();
8879 QStringList filters;
8880 for (
const QString &ext : exts )
8882 filters << QObject::tr(
"%1 files (*.%2)" ).arg( ext.toUpper(), ext.toLower() );
8884 return filters.join( QLatin1String(
";;" ) ) + QStringLiteral(
";;" ) + QObject::tr(
"All files (*.*)" );
8891 return lOriginalProvider->supportedOutputPointCloudLayerExtensions();
8895 return p->supportedOutputPointCloudLayerExtensions();
8900 return QStringList() << QObject::tr(
"%1 files (*.%2)" ).arg( ext.toUpper(), ext.toLower() );
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.
QString parentParameterName() const
Returns the name of the parent parameter, or an empty string if this is not set.
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 selectedFeaturesOnly
true if only selected features in the source should be used by algorithms.
A table (matrix) 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...
QString lastError() const SIP_HOLDGIL
Returns an error string referring to the last error encountered either when this geometry was created...
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.
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
QString mHelp
Parameter help.
QgsProcessingOutputDefinition * toOutputDefinition() const override
Returns a new QgsProcessingOutputDefinition corresponding to the definition of the destination parame...
QgsCoordinateReferenceSystem crs
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...
QVariantMap toVariantMap() const override
Saves this parameter to a QVariantMap.
virtual QgsProcessingParameterDefinition * create(const QString &name) const =0
Creates a new parameter of this type.
void setItemType(int type)
Sets the acceptable item type, or -1 if any item type is allowed.
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
static QgsProcessingRegistry * processingRegistry()
Returns the application's processing registry, used for managing processing providers,...
static QString typeName()
Returns the type name for the parameter class.
QString parentConnectionParameterName() const
Returns the name of the parent connection parameter, or an empty string if this is not set.
static QVariantList parameterAsMatrix(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context)
Evaluates the parameter with matching definition to a matrix/table of values.
void setFileFilter(const QString &filter)
Sets the file filter string for file destinations compatible with this parameter.
QString asScriptCode() const override
Returns the parameter definition encoded in a string which can be used within a Processing script.
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...
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.
QgsProcessingOutputDefinition * toOutputDefinition() const override
Returns a new QgsProcessingOutputDefinition corresponding to the definition of the destination parame...
@ Double
Double/float values.
@ String
Accepts string fields.
DataType
Field data types.
static QString defaultVectorExtension()
Returns the default vector extension to use, in the absence of all other constraints (e....
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 QgsFeatureSink * createFeatureSink(QString &destination, QgsProcessingContext &context, const QgsFields &fields, QgsWkbTypes::Type 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 QgsCoordinateReferenceSystem parameterAsCrs(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context)
Evaluates the parameter with matching definition to a coordinate reference system.
virtual QStringList supportedOutputVectorLayerExtensions() const
Returns a list of the vector format file extensions supported by this parameter.
void setParentParameterName(const QString &parentParameterName)
Sets the name of the parent layer parameter.
static QString parameterAsConnectionName(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, const QgsProcessingContext &context)
Evaluates the parameter with matching definition to a connection name string.
virtual QVariantMap toVariantMap() const
Saves this parameter to a QVariantMap.
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.
bool allowMultiple() const
Returns true if the parameter allows multiple selected values.
QString type() const override
Unique parameter type name.
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
@ Numeric
Accepts numeric fields.
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...
QgsProcessingParameterRasterLayer(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), bool optional=false)
Constructor for QgsProcessingParameterRasterLayer.
QString type() const override
Unique parameter type name.
bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
A store for object properties.
void setMinimum(const QDateTime &minimum)
Sets the minimum value acceptable by the parameter.
void setDataType(Type type)
Sets the acceptable data type 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.
@ GeometryAbortOnInvalid
Close iterator on encountering any features with invalid geometry. This requires a slow geometry vali...
static QgsProcessingFeatureSource * variantToSource(const QVariant &value, QgsProcessingContext &context, const QVariant &fallbackValue=QVariant())
Converts a variant value to a new feature source.
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.
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
QString type() const override
Unique parameter type name.
QgsProcessingAlgorithm * mAlgorithm
Pointer to algorithm which owns this parameter.
bool multiLine() const
Returns true if the parameter allows multiline strings.
bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
static QList< int > parameterAsEnums(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, const QgsProcessingContext &context)
Evaluates the parameter with matching definition to list of enum values.
Defines the parameters used to remap features when creating a QgsRemappingProxyFeatureSink.
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 fromVariantMap(const QVariantMap &map) override
Restores 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 QStringList parameterAsEnumStrings(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, const QgsProcessingContext &context)
Evaluates the parameter with matching definition to list of static enum strings.
bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
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 QgsGeometry parameterAsGeometry(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context, const QgsCoordinateReferenceSystem &crs=QgsCoordinateReferenceSystem())
Evaluates the parameter with matching definition to a geometry.
A numeric parameter for processing algorithms.
QgsProject * project() const
Returns the project in which the algorithm is being executed.
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
QgsProcessingOutputDefinition * toOutputDefinition() const override
Returns a new QgsProcessingOutputDefinition corresponding to the definition of the destination parame...
QString type() const override
Unique parameter type name.
void setParentLayerParameterName(const QString &parentLayerParameterName)
Sets the name of the parent layer parameter.
QString type() const override
Unique parameter type name.
@ TypePointCloud
Point cloud layers.
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...
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...
A QgsRectangle with associated coordinate reference system.
@ DistanceUnknownUnit
Unknown distance unit.
bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
Base class for providing feedback from a processing algorithm.
QVariantMap toVariantMap() const override
Saves this parameter to a QVariantMap.
void setExtension(const QString &extension)
Sets a file extension for the parameter.
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.
QString description() const
Returns the description for the parameter.
int numberRows() const
Returns the fixed number of rows in the table.
QgsLayoutItem * itemById(const QString &id) const
Returns a layout item given its id.
QgsProcessingProvider * originalProvider() const
Original (source) provider which this parameter has been derived from.
void setAllowMultiple(bool allowMultiple)
Sets whether multiple field selections are permitted.
QVariantMap toVariantMap() const override
Saves this parameter to a QVariantMap.
void setAllowNewTableNames(bool allowed)
Sets whether the parameter allows users to enter names for a new (non-existing) tables.
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 QgsProcessingParameterVectorLayer * fromScriptCode(const QString &name, const QString &description, bool isOptional, const QString &definition)
Creates a new parameter using the definition from a script code.
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.
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...
QVariantMap toVariantMap() const override
Saves this parameter to a QVariantMap.
@ WKT_PREFERRED
Preferred format, matching the most recent WKT ISO standard. Currently an alias to WKT2_2019,...
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.
Represents a map layer supporting display of point clouds.
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
static QString parameterAsDatabaseTableName(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, const QgsProcessingContext &context)
Evaluates the parameter with matching definition to a database table name.
QgsProcessingParameterAnnotationLayer(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), bool optional=false)
Constructor for QgsProcessingParameterAnnotationLayer.
QString parentSchemaParameterName() const
Returns the name of the parent schema parameter, or an empty string if this is not set.
QgsProcessingParameterMapTheme(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), bool optional=false)
Constructor for QgsProcessingParameterMapTheme.
QString asScriptCode() const override
Returns the parameter definition encoded in a string which can be used within a Processing script.
const QgsCoordinateReferenceSystem & crs
QString asScriptCode() const override
Returns the parameter definition encoded in a string which can be used within a Processing script.
static QStringList parameterAsFields(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context)
Evaluates the parameter with matching definition to a list of fields.
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.
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
Flags flags() const
Returns any flags associated with the parameter.
QVariantMap mMetadata
Freeform metadata for parameter. Mostly used by widget wrappers to customize their appearance and beh...
A raster layer destination parameter, for specifying the destination path for a raster layer created ...
QgsProcessingParameterExtent(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), bool optional=false)
Constructor for QgsProcessingParameterExtent.
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.
bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
@ FieldBasedProperty
Field based property (QgsFieldBasedProperty)
QgsProcessingDestinationParameter(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), bool optional=false, bool createByDefault=true)
Constructor for QgsProcessingDestinationParameter.
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.
void setCreateByDefault(bool createByDefault)
Sets whether the destination should be created by default.
@ Folder
Parameter is a folder.
A map theme parameter for processing algorithms, allowing users to select an existing map theme from ...
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 setDefaultToAllFields(bool enabled)
Sets whether a parameter which allows multiple selections (see allowMultiple()) should automatically ...
QStringList dependsOnOtherParameters() const override
Returns a list of other parameter names on which this parameter is dependent (e.g.
@ TypeVectorPolygon
Vector polygon layers.
void setMultiLine(bool multiLine)
Sets whether the parameter allows multiline strings.
static QString normalizeLayerSource(const QString &source)
Normalizes a layer source string for safe comparison across different operating system environments.
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.
Container of fields for a vector layer.
double yMinimum() const SIP_HOLDGIL
Returns the y minimum value (bottom side of rectangle).
QVariantMap toVariantMap() const override
Saves this parameter to a QVariantMap.
A file output for processing algorithms.
static QgsGeometry fromWkt(const QString &wkt)
Creates a new geometry from a WKT string.
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.
A vector layer output for processing algorithms.
static QgsGeometry fromPointXY(const QgsPointXY &point) SIP_HOLDGIL
Creates a new geometry from a QgsPointXY object.
QgsProcessing::SourceType dataType() const
Returns the layer type for sinks associated with the parameter.
QString parentLayerParameterName() const
Returns the name of the parent layer parameter, or an empty string if this is not set.
QgsProcessing::SourceType layerType() const
Returns the layer type for layers acceptable by the parameter.
QString valueAsPythonString(const QVariant &value, QgsProcessingContext &context) const override
Returns a string version of the parameter input value, which is suitable for use as an input paramete...
static 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.
QgsProcessingOutputDefinition * toOutputDefinition() const override
Returns a new QgsProcessingOutputDefinition corresponding to the definition of the destination parame...
QgsProcessingParameterAuthConfig(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), bool optional=false)
Constructor for QgsProcessingParameterAuthConfig.
Abstract base class for processing providers.
bool isValid() const
Checks if this expression is valid.
QVariantMap toVariantMap() const override
Saves this parameter to a QVariantMap.
QgsGeometry centroid() const
Returns the center of mass of a geometry.
static QgsCoordinateReferenceSystem parameterAsExtentCrs(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context)
Returns the coordinate reference system associated with an extent parameter value.
QString asExpression() const
Returns an expression string representing the state of the property, or an empty string if the proper...
static QString typeName()
Returns the type name for the parameter class.
static QDate parameterAsDate(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, const QgsProcessingContext &context)
Evaluates the parameter with matching definition to a static date value.
virtual bool isSupportedOutputValue(const QVariant &value, QgsProcessingContext &context, QString &error) const
Tests whether a value is a supported value for this parameter.
QgsProcessingParameterExpression(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), const QString &parentLayerParameterName=QString(), bool optional=false)
Constructor for QgsProcessingParameterExpression.
QString toolTip() const override
Returns a formatted tooltip for use with the parameter, which gives helpful information like 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...
int minimumNumberInputs() const
Returns the minimum number of layers required for the parameter.
static QString typeName()
Returns the type name for the parameter class.
A QgsGeometry with associated coordinate reference system.
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
QgsProcessingParameterMapLayer(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), bool optional=false, const QList< int > &types=QList< int >())
Constructor for QgsProcessingParameterMapLayer.
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...
Can be inherited by parameters which require limits to their acceptable data types.
Flags flags
Flags which dictate source behavior.
QString fileMeshFilters() const
Returns a file filter string for supported mesh files.
static QString typeName()
Returns the type name for the parameter class.
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.
Base class for the definition of processing parameters.
QgsProcessingParameterLimitedDataTypes(const QList< int > &types=QList< int >())
Constructor for QgsProcessingParameterLimitedDataTypes, with a list of acceptable data types.
@ TypeVectorLine
Vector line layers.
void setUsesStaticStrings(bool usesStaticStrings)
Sets whether the parameter uses static (non-translated) string values for its enumeration choice list...
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.
QVariantMap toVariantMap() const override
Saves this parameter to a QVariantMap.
An input feature source (such as vector layers) 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...
Encapsulates settings relating to a feature sink or output raster layer for a processing algorithm.
Type
The WKB type describes the number of dimensions a geometry has.
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
void setNumberRows(int rows)
Sets the fixed number of rows in the table.
void setParentLayoutParameterName(const QString &name)
Sets the name of the parent layout parameter.
QVariantMap toVariantMap() const override
Saves this parameter to a QVariantMap.
A map layer parameter for processing algorithms.
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
static QString sourceTypeToString(SourceType type)
Converts a source type to a string representation.
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
QgsFeatureRequest::InvalidGeometryCheck geometryCheck
Geometry check method to apply to this source.
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...
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 createFileFilter() const override
This method needs to be reimplemented in all classes which implement this interface and return a file...
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
LayerHint
Layer type hints.
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
InvalidGeometryCheck
Handling of features with invalid geometries.
@ GeometrySkipInvalid
Skip any features with invalid geometry. This requires a slow geometry validity check for every featu...
Type propertyType() const
Returns the property type.
bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
static QString encodeProviderKeyAndUri(const QString &providerKey, const QString &uri)
Encodes a provider key and layer uri to a single string, for use with decodeProviderKeyAndUri()
TemporalUnit
Temporal units.
DistanceUnit
Units of distance.
bool loadVariant(const QVariant &property)
Loads this property from a QVariantMap, wrapped in a QVariant.
static QString typeName()
Returns the type name for the parameter class.
void setSupportsAppend(bool supportsAppend)
Sets whether the sink supports appending features to an existing table.
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.
void setMinimumNumberInputs(int minimum)
Sets the minimum number of layers required for the parameter.
@ TypeVectorPoint
Vector point layers.
static QString stringToPythonLiteral(const QString &string)
Converts a string to a Python string literal.
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.
@ PrintLayout
Individual print layout (QgsPrintLayout)
bool defaultToAllFields() const
Returns whether a parameter which allows multiple selections (see allowMultiple()) should automatical...
A parameter for processing algorithms which accepts multiple map layers.
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 parameterAsSchema(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, const QgsProcessingContext &context)
Evaluates the parameter with matching definition to a database schema name.
static QgsRasterLayer * parameterAsRasterLayer(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context)
Evaluates the parameter with matching definition to a raster layer.
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 QgsProcessingParameterProviderConnection * fromScriptCode(const QString &name, const QString &description, bool isOptional, const QString &definition)
Creates a new parameter using the definition from a script code.
QgsProperty source
Source definition.
A rectangle specified with double 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...
static bool fileMatchesFilter(const QString &fileName, const QString &filter)
Returns true if the given fileName matches a file filter string.
QString createFileFilter() const override
This method needs to be reimplemented in all classes which implement this interface and return a file...
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.
bool allowMultiple() const
Returns whether multiple field selections are permitted.
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...
QString toolTip() const override
Returns a formatted tooltip for use with the parameter, which gives helpful information like paramete...
static QString typeName()
Returns the type name for the parameter class.
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
QVariantMap toVariantMap() const override
Saves this parameter to a QVariantMap.
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
QString qgsDoubleToString(double a, int precision=17)
Returns a string representation of a double.
static QgsProcessingParameterDefinition * parameterFromVariantMap(const QVariantMap &map)
Creates a new QgsProcessingParameterDefinition using the configuration from a supplied variant map.
QString createFileFilter() const override
This method needs to be reimplemented in all classes which implement this interface and return a file...
Encapsulates a QGIS project, including sets of map layers and their styles, layouts,...
QStringList dependsOnOtherParameters() const override
Returns a list of other parameter names on which this parameter is dependent (e.g.
QVariantMap toVariantMap() const override
Saves 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.
void setDataType(QgsProcessingParameterNumber::Type dataType)
Sets the acceptable data type for the range.
@ Raster
Raster layer type.
virtual QStringList valueAsStringList(const QVariant &value, QgsProcessingContext &context, bool &ok) const
Returns a string list version of the parameter input value (if possible).
const QgsLayoutManager * layoutManager() const
Returns the project's layout manager, which manages print layouts, atlases and reports within the pro...
@ TypeAnnotation
Annotation layers.
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.
bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
Makes metadata of processing parameters available.
QString asScriptCode() const override
Returns the parameter definition encoded in a string which can be used within a Processing script.
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.
QgsProcessingParameterNumber::Type dataType() const
Returns the acceptable data type for the range.
Type dataType() const
Returns the acceptable data type for the parameter.
static QString typeName()
Returns the type name for the parameter class.
@ Mesh
Mesh layer type, since QGIS 3.6.
A string parameter for authentication configuration ID values.
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.
A color parameter for processing algorithms.
static QString typeName()
Returns the type name for the parameter class.
bool isMultipart() const SIP_HOLDGIL
Returns true if WKB of the geometry is of WKBMulti* type.
A database table name parameter for processing algorithms, allowing users to select from existing dat...
bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
QString createFileFilter() const override
This method needs to be reimplemented in all classes which implement this interface and return a file...
@ File
Parameter is a single file.
void setDataType(QgsProcessing::SourceType type)
Sets the layer type for the sinks associated with the parameter.
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.
A feature sink output for processing algorithms.
static QList< double > parameterAsRange(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context)
Evaluates the parameter with matching definition to a range of values.
Base class for all parameter definitions which represent file or layer destinations,...
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.
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...
QString generateTemporaryDestination() const override
Generates a temporary destination value for this parameter.
static QString parameterAsFile(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context)
Evaluates the parameter with matching definition to a file/folder name.
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
bool loadVariant(const QVariantMap &map)
Loads this output layer definition from a QVariantMap, wrapped in a QVariant.
virtual QgsMasterLayoutInterface::Type layoutType() const =0
Returns the master layout type.
Base class for the definition of processing outputs.
static QList< QgsMapLayer * > parameterAsLayerList(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context)
Evaluates the parameter with matching definition to a list of map layers.
QStringList options() const
Returns the list of acceptable options for the parameter.
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.
Encapsulates settings relating to a feature source input to a processing algorithm.
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.
double xMaximum() const SIP_HOLDGIL
Returns the x maximum value (right side of rectangle).
bool hasGeometry() const
Returns true if sink is likely to include geometries.
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.
QString createFileFilter() const override
This method needs to be reimplemented in all classes which implement this interface and return a file...
QString asScriptCode() const override
Returns the parameter definition encoded in a string which can be used within a Processing script.
@ Annotation
Annotation layer type, since QGIS 3.22.
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 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.
@ ExpressionBasedProperty
Expression based property (QgsExpressionBasedProperty)
QgsProcessingParameterRasterDestination(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), bool optional=false, bool createByDefault=true)
Constructor for QgsProcessingParameterRasterDestination.
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
static QString typeName()
Returns the type name for the parameter class.
QString filePointCloudFilters() const
Returns a file filter string for supported point clouds.
QString asScriptCode() const override
Returns the parameter definition encoded in a string which can be used within a Processing script.
A double numeric parameter for map scale 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...
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...
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...
QgsProcessing::SourceType dataType() const
Returns the layer type for this created vector layer.
A numeric range 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...
Custom exception class for Coordinate Reference System related exceptions.
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.
void setRemappingDefinition(const QgsRemappingSinkDefinition &definition)
Sets the remapping definition to use when adding features to the output layer.
QString valueAsPythonString(const QVariant &value, QgsProcessingContext &context) const override
Returns a string version of the parameter input value, which is suitable for use as an input paramete...
static 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...
Print layout, a QgsLayout subclass for static or atlas-based layouts.
@ TypeMapLayer
Any map layer type (raster, vector, mesh, point cloud, annotation or plugin layer)
QVariant toVariant() const
Saves this property to a QVariantMap, wrapped in a QVariant.
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...
@ PythonQgsProcessingAlgorithmSubclass
Full Python QgsProcessingAlgorithm subclass.
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.
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.
QgsGeometry densifyByCount(int extraNodesPerSegment) const
Returns a copy of the geometry which has been densified by adding the specified number of extra nodes...
void setLayerType(QgsProcessing::SourceType type)
Sets the layer type for layers acceptable by the parameter.
QVariant toVariant() const
Saves this output layer definition to a QVariantMap, wrapped in a QVariant.
@ TypeVector
Tables (i.e. vector layers with or without geometry). When used for a sink this indicates the sink ha...
virtual bool fromVariantMap(const QVariantMap &map)
Restores this parameter to a QVariantMap.
static QStringList supportedFormatExtensions(RasterFormatOptions options=SortRecommended)
Returns a list of file extensions for supported formats.
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.
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 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 QgsProcessingParameterDatabaseTable * fromScriptCode(const QString &name, const QString &description, bool isOptional, const QString &definition)
Creates a new parameter using the definition from a script code.
A mesh layer parameter for processing algorithms.
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.
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...
bool allowMultiple() const
Returns whether multiple band selections are permitted.
@ DateTime
Datetime values.
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.
A coordinate reference system 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 QString typeName()
Returns the type name for the parameter class.
static QString typeName()
Returns the type name for the parameter class.
Flags mFlags
Parameter flags.
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
static QString typeName()
Returns the type name for the parameter class.
static QString defaultPointCloudExtension()
Returns the default point cloud extension to use, in the absence of all other constraints (e....
static QgsVectorLayer * parameterAsVectorLayer(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context)
Evaluates the parameter with matching definition to a vector layer.
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 QDateTime parameterAsDateTime(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, const QgsProcessingContext &context)
Evaluates the parameter with matching definition to a static datetime value.
void setParentSchemaParameterName(const QString &name)
Sets the name of the parent schema parameter.
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.
Contains information about the context in which a processing algorithm is executed.
QVariantMap toVariantMap() const override
Saves this parameter to a QVariantMap.
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.
A geometry parameter for processing algorithms.
virtual QString toolTip() const
Returns a formatted tooltip for use with the parameter, which gives helpful information like paramete...
bool operator==(const QgsProcessingOutputLayerDefinition &other) const
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.
void setAllowMultiple(bool allowMultiple)
Sets whether multiple band selections are permitted.
QString type() const override
Unique parameter type name.
QString mDescription
Parameter description.
QVariantMap toVariantMap() const override
Saves this parameter to a QVariantMap.
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.
QString asScriptCode() const override
Returns the parameter definition encoded in a string which can be used within a Processing script.
QVariantMap toVariantMap() const override
Saves this parameter to a QVariantMap.
A generic file based destination parameter, for specifying the destination path for a file (non-map l...
virtual QStringList supportedOutputVectorLayerExtensions() const
Returns a list of the vector format file extensions supported by this parameter.
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
QString valueAsPythonString(const QVariant &value, QgsProcessingContext &context) const override
Returns a string version of the parameter input value, which is suitable for use as an input paramete...
QgsProcessingOutputDefinition * toOutputDefinition() const override
Returns a new QgsProcessingOutputDefinition corresponding to the definition of the destination parame...
QString createFileFilter() const override
This method needs to be reimplemented in all classes which implement this interface and return a file...
QString asScriptCode() const override
Returns the parameter definition encoded in a string which can be used within a Processing script.
QString extension() const
Returns any specified file extension for the parameter.
QgsProcessingAlgorithm * algorithm() const
Returns a pointer to the algorithm which owns this parameter.
QString defaultFileExtension() const override
Returns the default file extension for destination file paths associated with this parameter.
QString parentLayerParameterName() const
Returns the name of the parent layer parameter, or an empty string if this is not set.
bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
virtual QgsRectangle extent() const
Returns the extent of the layer.
static bool parameterAsBoolean(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, const QgsProcessingContext &context)
Evaluates the parameter with matching definition to a static boolean value.
@ TypePlugin
Plugin layers.
void setHasFixedNumberRows(bool hasFixedNumberRows)
Sets whether the table has a fixed number of rows.
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
static QgsAnnotationLayer * parameterAsAnnotationLayer(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context)
Evaluates the parameter with matching definition to an annotation layer.
Represents a mesh layer supporting display of data on structured or unstructured meshes.
@ TypeRaster
Raster layers.
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 name() const
Returns the name of the parameter.
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 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...
bool hasGeometry() const
Returns true if the created layer is likely to include geometries.
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...
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.
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
QgsProcessingParameterScale(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), bool optional=false)
Constructor for QgsProcessingParameterScale.
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.
A print layout item parameter, allowing users to select a particular item from a print layout.
void setDataType(DataType type)
Sets the acceptable data type for the field.
QgsRemappingSinkDefinition remappingDefinition() const
Returns the output remapping definition, if useRemapping() is true.
void setParentLayerParameterName(const QString &parentLayerParameterName)
Sets the name of the parent layer parameter.
@ TypeVectorAnyGeometry
Any vector layer with geometry.
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
QString fileRasterFilters() const
Returns a file filter string for supported raster files.
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
double maximum() const
Returns the maximum value acceptable by 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.
QStringList dependsOnOtherParameters() const override
Returns a list of other parameter names on which this parameter is dependent (e.g.
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.
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.
A string 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 help() const
Returns the help 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...
QgsProcessingParameterMeshLayer(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), bool optional=false)
Constructor for QgsProcessingParameterMeshLayer.
@ DateTime
Accepts datetime fields.
A rectangular map extent parameter for processing algorithms.
QString type() const override
Unique parameter type name.
static QString typeName()
Returns the type name for the parameter class.
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
static QgsProcessingParameterMultipleLayers * fromScriptCode(const QString &name, const QString &description, bool isOptional, const QString &definition)
Creates a new parameter using the definition from a script code.
QString 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 toWkt(WktVariant variant=WKT1_GDAL, bool multiline=false, int indentationWidth=4) const
Returns a WKT representation of this CRS.
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
QgsProcessingParameterType * parameterType(const QString &id) const
Returns the parameter type registered for id.
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.
QStringList headers() const
Returns a list of column headers (if set).
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).
bool isValid() const
Returns whether this CRS is correctly initialized and usable.
A raster layer parameter for processing algorithms.
QVariantMap toVariantMap() const override
Saves this parameter to a QVariantMap.
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
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.
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.
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.
static QgsPrintLayout * parameterAsLayout(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context)
Evaluates the parameter with matching definition to a print layout.
QgsProcessingParameterDuration * clone() const override
Creates a clone of the parameter definition.
static QgsCoordinateReferenceSystem parameterAsPointCrs(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context)
Returns the coordinate reference system associated with an point parameter value.
QString id() const
Returns the layer's unique ID, which is used to access this layer from QgsProject.
static QStringList supportedFormatExtensions(VectorFormatOptions options=SortRecommended)
Returns a list of file extensions for supported formats, e.g "shp", "gpkg".
A data provider connection parameter for processing algorithms, allowing users to select from availab...
void setDataTypes(const QList< int > &types)
Sets the geometry types for sources acceptable by the parameter.
static const QString TEMPORARY_OUTPUT
Constant used to indicate that a Processing algorithm output should be a temporary layer/file.
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
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.
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
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.
An input file or folder 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.
QList< int > dataTypes() const
Returns the geometry types for sources 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...
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...
bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
A vector layer (with or without geometry) parameter for processing algorithms. Consider using the mor...
bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
Base class for graphical items within a QgsLayout.
double xMinimum() const SIP_HOLDGIL
Returns the x minimum value (left side of rectangle).
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.
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.
Represents a raster layer.
static QStringList parameterAsFileList(const QgsProcessingParameterDefinition *definition, const QVariant &value, QgsProcessingContext &context)
Evaluates the parameter with matching definition to a list of files (for QgsProcessingParameterMultip...
QString type() const override
Unique parameter type name.
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 checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
Details for layers to load into projects.
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.
static QgsCoordinateReferenceSystem parameterAsGeometryCrs(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context)
Returns the coordinate reference system associated with a geometry parameter value.
bool allowNewTableNames() const
Returns true if the parameter allows users to enter names for a new (non-existing) tables.
virtual QString defaultFileExtension() const =0
Returns the default file extension for destination file paths associated with this parameter.
static QgsPointCloudLayer * parameterAsPointCloudLayer(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context)
Evaluates the parameter with matching definition to a point cloud layer.
QgsMasterLayoutInterface * layoutByName(const QString &name) const
Returns the layout with a matching name, or nullptr if no matching layouts were found.
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...
bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
This class represents a coordinate reference system (CRS).
bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
A print layout parameter, allowing users to select a print layout.
bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
QgsProcessingParameterScale * clone() const override
Creates a clone of the parameter definition.
A vector layer destination parameter, for specifying the destination path for a vector layer created ...
A database schema parameter for processing algorithms, allowing users to select from existing schemas...
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.
A QgsPointXY with associated coordinate reference system.
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.
A double numeric parameter for distance values. Linked to a source layer or CRS parameter to determin...
QString parentLayerParameterName() const
Returns the name of the parent layer 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 QgsProcessingParameterDefinition * parameterFromScriptCode(const QString &code)
Creates a new QgsProcessingParameterDefinition using the configuration from a supplied script code st...
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
A point parameter for processing algorithms.
QVariantMap toVariantMap() const override
Saves this parameter to a QVariantMap.
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.
QString createFileFilter() const override
This method needs to be reimplemented in all classes which implement this interface and return a file...
QgsProcessingParameterBoolean(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), bool optional=false)
Constructor for QgsProcessingParameterBoolean.
QgsProcessingParameterMultipleLayers(const QString &name, const QString &description=QString(), QgsProcessing::SourceType layerType=QgsProcessing::TypeVectorAnyGeometry, const QVariant &defaultValue=QVariant(), bool optional=false)
Constructor for QgsProcessingParameterMultipleLayers.
int itemType() const
Returns 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...
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
QString parameterAsCompatibleSourceLayerPathInternal(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context, const QStringList &compatibleFormats, const QString &preferredFormat, QgsProcessingFeedback *feedback, QString *layerName)
void setHeaders(const QStringList &headers)
Sets the list of column headers.
A class to represent a 2D point.
static QgsMeshLayer * parameterAsMeshLayer(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context)
Evaluates the parameter with matching definition and value to a mesh layer.
QString asScriptCode() const override
Returns the parameter definition encoded in a string which can be used within a Processing script.
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...
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.
QgsProcessingParameterDistance * 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 QString typeName()
Returns the type name for the parameter class.
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
QgsPointXY asPoint() const
Returns the contents of the geometry as a 2-dimensional point.
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
QVariantMap toVariantMap() const override
Saves this parameter to a QVariantMap.
QString mName
Parameter name.
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
QgsCoordinateReferenceSystem crs() const
Returns the associated coordinate reference system, or an invalid CRS if no reference system is set.
QString defaultFileExtension() const override
Returns the default file extension for destination file paths associated with this parameter.
QString source() const
Returns the source for the layer.
@ Vector
Vector layer type.
void setParentConnectionParameterName(const QString &name)
Sets the name of the parent connection parameter.
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.
double minimum() const
Returns the minimum value acceptable by the parameter.
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...
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
Type dataType() const
Returns the acceptable data type for the parameter.
static QgsReferencedGeometry fromReferencedRect(const QgsReferencedRectangle &rectangle)
Construct a new QgsReferencedGeometry from referenced rectangle.
QString asWkt(int precision=17) const
Exports the geometry to WKT.
QgsProcessingParameterColor(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), bool opacityEnabled=true, bool optional=false)
Constructor for QgsProcessingParameterColor.
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.
A boolean 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...
QgsProcessingParameterPoint(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), bool optional=false)
Constructor for QgsProcessingParameterPoint.
QString defaultFileExtension() const override
Returns the default file extension for destination file paths associated with this parameter.
QVariantMap createOptions
Map of optional sink/layer creation options, which are passed to the underlying provider when creatin...
QString type() const override
Unique parameter type name.
double yMaximum() const SIP_HOLDGIL
Returns the y maximum value (top side of rectangle).
bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
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.
QStringList dependsOnOtherParameters() const override
Returns a list of other parameter names on which this parameter is dependent (e.g.
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.
bool supportsNonFileBasedOutput() const
Returns true if the destination parameter supports non filed-based outputs, such as memory layers or ...
static QString generateTempFilename(const QString &basename)
Returns a temporary filename for a given file, putting it into a temporary folder (creating that fold...
A datetime (or pure date or time) 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...
Abstract base class for processing algorithms.
QStringList dependsOnOtherParameters() const override
Returns a list of other parameter names on which this parameter is dependent (e.g.
GeometryType
The geometry types are used to group QgsWkbTypes::Type in a coarse way.
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...
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 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.
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
void setMaximum(double maximum)
Sets the maximum 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.
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.
bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
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
A geometry is the spatial representation of a feature.
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.
bool hasFixedNumberRows() const
Returns whether the table has a fixed number of rows.
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
A raster layer output for processing algorithms.
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
QVariantMap toVariantMap() const override
Saves this parameter to a QVariantMap.
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
Represents a vector layer which manages a vector based data sets.
An expression parameter for processing algorithms.
static QString variantToPythonLiteral(const QVariant &value)
Converts a variant to a Python literal.
QString createAllMapLayerFileFilter()
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
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 createFileFilter() const override
This method needs to be reimplemented in all classes which implement this interface and return a file...
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...
QString asScriptCode() const override
Returns the parameter definition encoded in a string which can be used within a Processing script.
QgsProcessingParameterString(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), bool multiLine=false, bool optional=false)
Constructor for QgsProcessingParameterString.
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,...
Base class for all map layer types. This is the base class for all map layer types (vector,...
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 QString parameterAsOutputLayer(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context)
Evaluates the parameter with matching definition to a output layer destination.
QVariantMap toVariantMap() const override
Saves this parameter to a QVariantMap.
void setParentConnectionParameterName(const QString &name)
Sets the name of the parent connection parameter.
QString valueAsPythonString(const QVariant &value, QgsProcessingContext &context) const override
Returns a string version of the parameter input value, which is suitable for use as an input paramete...
static QString typeName()
Returns the type name for the parameter class.
Represents a map layer containing a set of georeferenced annotations, e.g. markers,...
bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
QgsExpressionContext & expressionContext()
Returns the expression context.
static QgsCoordinateReferenceSystem variantToCrs(const QVariant &value, QgsProcessingContext &context, const QVariant &fallbackValue=QVariant())
Converts a variant value to a coordinate reference system.
virtual QString asScriptCode() const
Returns the parameter definition encoded in a string which can be used within a Processing script.
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.
void setAllowMultiple(bool allowMultiple)
Sets whether the parameter allows multiple selected values.
QgsProcessingParameterFolderDestination(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), bool optional=false, bool createByDefault=true)
Constructor for QgsProcessingParameterFolderDestination.
QStringList dependsOnOtherParameters() const override
Returns a list of other parameter names on which this parameter is dependent (e.g.
QString asScriptCode() const override
Returns the parameter definition encoded in a string which can be used within a Processing script.
static QgsGeometry fromRect(const QgsRectangle &rect) SIP_HOLDGIL
Creates a new geometry from a QgsRectangle.
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
QString type() const override
Unique parameter type name.
QgsFeatureSource subclass which proxies methods to an underlying QgsFeatureSource,...
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.
QVariantMap toVariantMap() const override
Saves this parameter to a QVariantMap.
QgsProcessingParameterRange(const QString &name, const QString &description=QString(), QgsProcessingParameterNumber::Type type=QgsProcessingParameterNumber::Integer, const QVariant &defaultValue=QVariant(), bool optional=false)
Constructor for QgsProcessingParameterRange.
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 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 QgsReferencedGeometry fromReferencedPointXY(const QgsReferencedPointXY &point)
Construct a new QgsReferencedGeometry from referenced point.
virtual QStringList supportedOutputRasterLayerExtensions() const
Returns a list of the raster format file extensions supported for this parameter.
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...
static QString typeName()
Returns the type name for the parameter class.
static QString parameterAsEnumString(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, const QgsProcessingContext &context)
Evaluates the parameter with matching definition to a static enum string.
void setMaximum(const QDateTime &maximum)
Sets the maximum value acceptable by the parameter.
@ TypeFile
Files (i.e. non map layer sources, such as text files)
QStringList dependsOnOtherParameters() const override
Returns a list of other parameter names on which this parameter is dependent (e.g.
QString asScriptCode() const override
Returns the parameter definition encoded in a string which can be used within a Processing script.
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...
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
QVariant mGuiDefault
Default value for parameter in GUI.
QString createFileFilter() const override
This method needs to be reimplemented in all classes which implement this interface and return a file...
A raster band parameter for Processing algorithms.
@ GeometryNoCheck
No invalid geometry checking.
QList< int > mDataTypes
List of acceptable data types for the parameter.
A point cloud layer parameter for processing algorithms.
QString fileFilter() const
Returns the file filter string for file destinations compatible 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...
QVariantMap toVariantMap() const override
Saves this parameter to a QVariantMap.
void setOpacityEnabled(bool enabled)
Sets whether the parameter allows opacity control.
QString type() const override
Unique parameter type name.
QVariant mDefault
Default value for parameter.
QgsRectangle boundingBox() const
Returns the bounding box of the geometry.
QVariantMap toVariantMap() const override
Saves this parameter to a QVariantMap.
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...
QString fileVectorFilters() const
Returns a file filter string for supported vector files.
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 QString typeName()
Returns the type name for the parameter class.
static QString typeName()
Returns the type name for the parameter class.
void setParentLayerParameterName(const QString &parentLayerParameterName)
Sets the name of the parent layer parameter.
QVariant staticValue() const
Returns the current static value for the property.
QString createFileFilter() const override
This method needs to be reimplemented in all classes which implement this interface and return a file...
static QString parameterAsFileOutput(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context)
Evaluates the parameter with matching definition to a file based output destination.
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 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.
QgsProcessingOutputDefinition * toOutputDefinition() const override
Returns a new QgsProcessingOutputDefinition corresponding to the definition of the destination parame...
QString valueAsPythonString(const QVariant &value, QgsProcessingContext &context) const override
Returns a string version of the parameter input value, which is suitable for use as an input paramete...
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.
bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
static QString parameterAsExpression(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, const QgsProcessingContext &context)
Evaluates the parameter with matching definition to an expression.
QgsProcessingParameterPointCloudDestination(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), bool optional=false, bool createByDefault=true)
Constructor for QgsProcessingParameterPointCloudDestination.
static QgsFeatureSink * parameterAsSink(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, const QgsFields &fields, QgsWkbTypes::Type 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.
QString parentLayoutParameterName() const
Returns the name of the parent layout parameter, or an empty string if this is not set.
QgsProcessingProvider * provider() const
Returns a pointer to the provider for the algorithm which owns this parameter.
QgsProcessingParameterCrs(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), bool optional=false)
Constructor for QgsProcessingParameterCrs.
QString asScriptCode() const override
Returns the parameter definition encoded in a string which can be used within a Processing script.
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 ...
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...
virtual QString type() const =0
Unique parameter type name.
Interface for master layout type objects, such as print layouts and reports.
An enum based parameter for processing algorithms, allowing for selection from predefined values.
QVariantMap toVariantMap() const override
Saves this parameter to a QVariantMap.
QgsProperty sink
Sink/layer 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...
bool createByDefault() const
Returns true if the destination should be created by default.
virtual QString valueAsString(const QVariant &value, QgsProcessingContext &context, bool &ok) const
Returns a string version of the parameter input value (if possible).
A HTML file output for processing algorithms.
QString destinationName
Name to use for sink if it's to be loaded into a destination project.
QString createFileFilter() const override
This method needs to be reimplemented in all classes which implement this interface and return a file...
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
QVariantMap toVariantMap() const override
Saves this parameter to a QVariantMap.
@ FlagOptional
Parameter is optional.
QString asScriptCode() const override
Returns the parameter definition encoded in a string which can be used within a Processing script.
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.
QgsProcessingParameterDefinition(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), bool optional=false, const QString &help=QString())
Constructor for QgsProcessingParameterDefinition.
A coordinate operation parameter for processing algorithms, for selection between available coordinat...
QVariant defaultValue() const
Returns the default value for the parameter.
static QString descriptionFromName(const QString &name)
Creates an autogenerated parameter description from a parameter name.
QgsProcessingProvider * provider() const
Returns the provider to which this algorithm belongs.
Class for parsing and evaluation of expressions (formerly called "search strings")....
@ StaticProperty
Static property (QgsStaticProperty)
QString defaultFileExtension() const override
Returns the default file extension for destination file paths associated with this parameter.
bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
PythonOutputType
Available Python output types.
static QString typeName()
Returns the type name for the parameter class.
QgsWkbTypes::GeometryType type
QgsProcessingParameterPointCloudLayer(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), bool optional=false)
Constructor for QgsProcessingParameterPointCloudLayer.
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...
DataType dataType() const
Returns the acceptable data type for the field.
static int parameterAsEnum(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, const QgsProcessingContext &context)
Evaluates the parameter with matching definition to a enum value.
QString asScriptCode() const override
Returns the parameter definition encoded in a string which can be used within a Processing script.
Behavior behavior() const
Returns the parameter behavior (e.g.
QgsProcessingParameterLayout(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), bool optional=false)
Constructor for QgsProcessingParameterLayout.
QStringList dependsOnOtherParameters() const override
Returns a list of other parameter names on which this parameter is dependent (e.g.
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.
static QgsProviderRegistry * instance(const QString &pluginPath=QString())
Means of accessing canonical single instance.
A folder output for processing algorithms.
QString defaultFileExtension() const override
Returns the default file extension for destination file paths associated with this parameter.
static QString defaultRasterExtension()
Returns the default raster extension to use, in the absence of all other constraints (e....
virtual bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const
Checks whether the specified input value is acceptable for the parameter.
void setOptions(const QStringList &options)
Sets the list of acceptable options for the parameter.
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
static QString typeName()
Returns the type name for the parameter class.
bool operator!=(const QgsProcessingOutputLayerDefinition &other) const
SourceType
Data source types enum.
@ PointCloud
Point cloud layer type, since QGIS 3.22.
Custom exception class for processing related exceptions.
A vector layer or feature source field parameter for processing algorithms.
QgsAnnotationLayer * mainAnnotationLayer()
Returns the main annotation layer associated with the project.
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 isNull() const
Test if the rectangle is null (all coordinates zero or after call to setMinimal()).
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
static QString typeName()
Returns the type name for the parameter class.
QString createFileFilter() const override
This method needs to be reimplemented in all classes which implement this interface and return a file...
QString asScriptCode() const override
Returns the parameter definition encoded in a string which can be used within a Processing script.
bool loadVariant(const QVariantMap &map)
Loads this source definition from a QVariantMap, wrapped in a QVariant.
static QTime parameterAsTime(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, const QgsProcessingContext &context)
Evaluates the parameter with matching definition to a static time value.
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.
bool usesStaticStrings() const
Returns true if the parameter uses static (non-translated) string values for its enumeration choice l...
bool useRemapping() const
Returns true if the output uses a remapping 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...
bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
virtual QStringList supportedOutputPointCloudLayerExtensions() const
Returns a list of the point cloud format file extensions supported for this parameter.
An interface for objects which accept features via addFeature(s) methods.
static double parameterAsDouble(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, const QgsProcessingContext &context)
Evaluates the parameter with matching definition to a static double value.
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 QgsProcessingParameterLayout * fromScriptCode(const QString &name, const QString &description, bool isOptional, const QString &definition)
Creates a new parameter using the definition from a script code.
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.
An annotation layer parameter for processing algorithms.
static QString typeName()
Returns the type name for the parameter class.
void setMinimum(double minimum)
Sets the minimum value acceptable by the parameter.
virtual QString generateTemporaryDestination() const
Generates a temporary destination value for this parameter.
QString asScriptCode() const override
Returns the parameter definition encoded in a string which can be used within a Processing script.
static int parameterAsInt(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, const QgsProcessingContext &context)
Evaluates the parameter with matching definition to a static integer value.
A pointcloud layer output for processing algorithms.
void setDataType(QgsProcessing::SourceType type)
Sets the layer type for the created vector layer.
static QgsProcessingFeatureSource * parameterAsSource(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context)
Evaluates the parameter with matching definition to a feature source.
QVariant toVariant() const
Saves this source definition to a QVariantMap, wrapped in a QVariant.
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
@ InvalidProperty
Invalid (not set) property.
static QString typeName()
Returns the type name for the parameter class.
QDateTime maximum() const
Returns the maximum 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.
Behavior
Parameter behavior.
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 opacityEnabled() const
Returns true if the parameter allows opacity control.
QgsProject * destinationProject
Destination project.
@ UnknownType
Unknown layer type.
QgsProcessingParameterVectorLayer(const QString &name, const QString &description=QString(), const QList< int > &types=QList< int >(), const QVariant &defaultValue=QVariant(), bool optional=false)
Constructor for QgsProcessingParameterVectorLayer.
QgsProcessingParameterFeatureSource(const QString &name, const QString &description=QString(), const QList< int > &types=QList< int >(), const QVariant &defaultValue=QVariant(), bool optional=false)
Constructor for QgsProcessingParameterFeatureSource.
A folder destination parameter, for specifying the destination path for a folder created by the algor...
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 parameterAsString(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, const QgsProcessingContext &context)
Evaluates the parameter with matching definition to a static string value.
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.
A double numeric parameter for duration values. The returned value will always be in milliseconds.
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.
QDateTime minimum() const
Returns the minimum value acceptable by the parameter.
A point cloud layer destination parameter, for specifying the destination path for a point cloud laye...
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...