43 map.insert( QStringLiteral(
"create_options" ),
createOptions );
50 createOptions = map.value( QStringLiteral(
"create_options" ) ).toMap();
56 QVariant val = parameters.value( name );
68 return parameterAsString( definition, parameters.value( definition->
name() ), context );
89 return destParam->generateTemporaryDestination();
92 return val.toString();
100 return parameterAsExpression( definition, parameters.value( definition->
name() ), context );
108 QVariant val = value;
112 if ( val.isValid() && !val.toString().isEmpty() )
116 return val.toString();
128 return parameterAsDouble( definition, parameters.value( definition->
name() ), context );
136 QVariant val = value;
141 double res = val.toDouble( &ok );
147 return val.toDouble();
155 return parameterAsInt( definition, parameters.value( definition->
name() ), context );
163 QVariant val = value;
168 double dbl = val.toDouble( &ok );
173 dbl = val.toDouble( &ok );
180 double round = std::round( dbl );
181 if ( round > std::numeric_limits<int>::max() || round < -std::numeric_limits<int>::max() )
186 return static_cast< int >( std::round( dbl ) );
195 return QList< int >();
197 return parameterAsInts( definition, parameters.value( definition->
name() ), context );
203 return QList< int >();
205 QList< int > resultList;
206 QVariant val = value;
211 else if ( val.type() == QVariant::List )
213 QVariantList list = val.toList();
214 for (
auto it = list.constBegin(); it != list.constEnd(); ++it )
215 resultList << it->toInt();
219 QStringList parts = val.toString().split(
';' );
220 for (
auto it = parts.constBegin(); it != parts.constEnd(); ++it )
221 resultList << it->toInt();
225 if ( ( resultList.isEmpty() || resultList.at( 0 ) == 0 ) )
231 if ( definition->
defaultValue().type() == QVariant::List )
233 QVariantList list = definition->
defaultValue().toList();
234 for (
auto it = list.constBegin(); it != list.constEnd(); ++it )
235 resultList << it->toInt();
239 QStringList parts = definition->
defaultValue().toString().split(
';' );
240 for (
auto it = parts.constBegin(); it != parts.constEnd(); ++it )
241 resultList << it->toInt();
254 return parameterAsEnum( definition, parameters.value( definition->
name() ), context );
262 int val = parameterAsInt( definition, value, context );
264 if ( enumDef && val >= enumDef->
options().size() )
276 return parameterAsEnums( definition, parameters.value( definition->
name() ), context );
284 QVariantList resultList;
285 QVariant val = value;
288 else if ( val.type() == QVariant::List )
290 const auto constToList = val.toList();
291 for (
const QVariant &var : constToList )
294 else if ( val.type() == QVariant::String )
296 const auto constSplit = val.toString().split(
',' );
297 for (
const QString &var : constSplit )
303 if ( resultList.isEmpty() )
304 return QList< int >();
306 if ( ( !val.isValid() || !resultList.at( 0 ).isValid() ) && definition )
310 if ( definition->
defaultValue().type() == QVariant::List )
312 const auto constToList = definition->
defaultValue().toList();
313 for (
const QVariant &var : constToList )
316 else if ( definition->
defaultValue().type() == QVariant::String )
318 const auto constSplit = definition->
defaultValue().toString().split(
',' );
319 for (
const QString &var : constSplit )
328 const auto constResultList = resultList;
329 for (
const QVariant &var : constResultList )
331 int resInt = var.toInt();
332 if ( !enumDef || resInt < enumDef->options().size() )
345 return parameterAsBool( definition, parameters.value( definition->
name() ), context );
353 return parameterAsBoolean( definition, parameters.value( definition->
name() ), context );
363 QVariant val = value;
366 else if ( val.isValid() )
379 QVariant val = value;
382 else if ( val.isValid() )
390 QgsProcessingContext &context, QString &destinationIdentifier, QgsFeatureSink::SinkFlags sinkFlags )
395 val = parameters.value( definition->
name() );
398 return parameterAsSink( definition, val, fields, geometryType, crs, context, destinationIdentifier, sinkFlags );
403 QVariant val = value;
424 else if ( !val.isValid() || val.toString().isEmpty() )
436 dest = val.toString();
441 dest = destParam->generateTemporaryDestination();
444 if ( dest.isEmpty() )
448 destinationIdentifier = dest;
450 if ( destinationProject )
452 if ( destName.isEmpty() && definition )
458 outputName = definition->
name();
462 return sink.release();
470 return parameterAsSource( definition, parameters.value( definition->
name() ), context );
486 QVariant val = parameters.value( definition->
name() );
488 bool selectedFeaturesOnly =
false;
509 vl = qobject_cast<
QgsVectorLayer * >( qvariant_cast<QObject *>( val ) );
518 else if ( !val.isValid() || val.toString().isEmpty() )
524 vl = qobject_cast< QgsVectorLayer * >( qvariant_cast<QObject *>( val ) );
530 layerRef = val.toString();
535 if ( layerRef.isEmpty() )
546 compatibleFormats, preferredFormat, context, feedback );
555 return parameterAsLayer( definition, parameters.value( definition->
name() ), context );
563 QVariant val = value;
569 if (
QgsMapLayer *layer = qobject_cast< QgsMapLayer * >( qvariant_cast<QObject *>( val ) ) )
586 if ( !val.isValid() || val.toString().isEmpty() )
592 if (
QgsMapLayer *layer = qobject_cast< QgsMapLayer * >( qvariant_cast<QObject *>( val ) ) )
597 QString layerRef = val.toString();
598 if ( layerRef.isEmpty() )
601 if ( layerRef.isEmpty() )
609 return qobject_cast<
QgsRasterLayer *>( parameterAsLayer( definition, parameters, context ) );
614 return qobject_cast<
QgsRasterLayer *>( parameterAsLayer( definition, value, context ) );
619 return qobject_cast<
QgsMeshLayer *>( parameterAsLayer( definition, parameters, context ) );
624 return qobject_cast<
QgsMeshLayer *>( parameterAsLayer( definition, value, context ) );
632 val = parameters.value( definition->
name() );
634 return parameterAsOutputLayer( definition, val, context );
639 QVariant val = value;
659 else if ( definition && ( !val.isValid() || val.toString().isEmpty() ) )
666 dest = val.toString();
671 dest = destParam->generateTemporaryDestination();
674 if ( destinationProject )
677 if ( destName.isEmpty() && definition )
682 outputName = definition->
name();
701 val = parameters.value( definition->
name() );
703 return parameterAsFileOutput( definition, val, context );
708 QVariant val = value;
722 else if ( !val.isValid() || val.toString().isEmpty() )
729 dest = val.toString();
734 dest = destParam->generateTemporaryDestination();
741 return qobject_cast<
QgsVectorLayer *>( parameterAsLayer( definition, parameters, context ) );
746 return qobject_cast<
QgsVectorLayer *>( parameterAsLayer( definition, value, context ) );
754 return parameterAsCrs( definition, parameters.value( definition->
name() ), context );
762 QVariant val = value;
788 if (
QgsMapLayer *layer = qobject_cast< QgsMapLayer * >( qvariant_cast<QObject *>( val ) ) )
794 if ( !val.isValid() )
800 QString crsText = val.toString();
801 if ( crsText.isEmpty() )
804 if ( crsText.isEmpty() )
808 if ( context.
project() && crsText.compare( QLatin1String(
"ProjectCrs" ), Qt::CaseInsensitive ) == 0 )
827 return parameterAsExtent( definition, parameters.value( definition->
name() ), context, crs );
835 QVariant val = value;
884 rectText = val.toString();
886 if ( rectText.isEmpty() && !layer )
889 QRegularExpression rx( QStringLiteral(
"^(.*?)\\s*,\\s*(.*?),\\s*(.*?),\\s*(.*?)\\s*(?:\\[(.*)\\])?\\s*$" ) );
890 QRegularExpressionMatch match = rx.match( rectText );
891 if ( match.hasMatch() )
894 double xMin = match.captured( 1 ).toDouble( &xMinOk );
896 double xMax = match.captured( 2 ).toDouble( &xMaxOk );
898 double yMin = match.captured( 3 ).toDouble( &yMinOk );
900 double yMax = match.captured( 4 ).toDouble( &yMaxOk );
901 if ( xMinOk && xMaxOk && yMinOk && yMaxOk )
905 if ( crs.
isValid() && rectCrs.isValid() && crs != rectCrs )
950 QVariant val = parameters.value( definition->
name() );
958 g = g.densifyByCount( 20 );
994 rectText = val.toString();
996 if ( !rectText.isEmpty() )
998 QRegularExpression rx( QStringLiteral(
"^(.*?)\\s*,\\s*(.*?),\\s*(.*?),\\s*(.*?)\\s*(?:\\[(.*)\\])?\\s*$" ) );
999 QRegularExpressionMatch match = rx.match( rectText );
1000 if ( match.hasMatch() )
1002 bool xMinOk =
false;
1003 double xMin = match.captured( 1 ).toDouble( &xMinOk );
1004 bool xMaxOk =
false;
1005 double xMax = match.captured( 2 ).toDouble( &xMaxOk );
1006 bool yMinOk =
false;
1007 double yMin = match.captured( 3 ).toDouble( &yMinOk );
1008 bool yMaxOk =
false;
1009 double yMax = match.captured( 4 ).toDouble( &yMaxOk );
1010 if ( xMinOk && xMaxOk && yMinOk && yMaxOk )
1015 if ( crs.
isValid() && rectCrs.isValid() && crs != rectCrs )
1017 g = g.densifyByCount( 20 );
1065 QVariant val = parameters.value( definition->
name() );
1094 QString valueAsString;
1098 valueAsString = val.toString();
1100 QRegularExpression rx( QStringLiteral(
"^(.*?)\\s*,\\s*(.*?),\\s*(.*?),\\s*(.*?)\\s*(?:\\[(.*)\\])?\\s*$" ) );
1102 QRegularExpressionMatch match = rx.match( valueAsString );
1103 if ( match.hasMatch() )
1129 if (
QgsMapLayer *layer = qobject_cast< QgsMapLayer * >( qvariant_cast<QObject *>( val ) ) )
1130 return layer->crs();
1132 return layer->crs();
1145 return parameterAsPoint( definition, parameters.value( definition->
name() ), context, crs );
1153 QVariant val = value;
1182 QString pointText = parameterAsString( definition, value, context );
1183 if ( pointText.isEmpty() )
1186 if ( pointText.isEmpty() )
1189 QRegularExpression rx( QStringLiteral(
"^\\s*\\(?\\s*(.*?)\\s*,\\s*(.*?)\\s*(?:\\[(.*)\\])?\\s*\\)?\\s*$" ) );
1191 QString valueAsString = parameterAsString( definition, value, context );
1192 QRegularExpressionMatch match = rx.match( valueAsString );
1193 if ( match.hasMatch() )
1196 double x = match.captured( 1 ).toDouble( &xOk );
1198 double y = match.captured( 2 ).toDouble( &yOk );
1205 if ( crs.
isValid() && pointCrs.isValid() && crs != pointCrs )
1226 QVariant val = parameters.value( definition->
name() );
1227 return parameterAsPointCrs( definition, val, context );
1241 QRegularExpression rx( QStringLiteral(
"^\\s*\\(?\\s*(.*?)\\s*,\\s*(.*?)\\s*(?:\\[(.*)\\])?\\s*\\)?\\s*$" ) );
1243 QString valueAsString = parameterAsString( definition, value, context );
1244 QRegularExpressionMatch match = rx.match( valueAsString );
1245 if ( match.hasMatch() )
1263 QString fileText = parameterAsString( definition, parameters, context );
1264 if ( fileText.isEmpty() )
1274 QString fileText = parameterAsString( definition, value, context );
1275 if ( fileText.isEmpty() )
1283 return QVariantList();
1285 return parameterAsMatrix( definition, parameters.value( definition->
name() ), context );
1291 return QVariantList();
1293 QString resultString;
1294 QVariant val = value;
1297 else if ( val.type() == QVariant::List )
1298 return val.toList();
1300 resultString = val.toString();
1302 if ( resultString.isEmpty() )
1305 if ( definition->
defaultValue().type() == QVariant::List )
1311 QVariantList result;
1312 const auto constSplit = resultString.split(
',' );
1313 for (
const QString &s : constSplit )
1322 return QList<QgsMapLayer *>();
1324 return parameterAsLayerList( definition, parameters.value( definition->
name() ), context );
1330 return QList<QgsMapLayer *>();
1332 QVariant val = value;
1333 if (
QgsMapLayer *layer = qobject_cast< QgsMapLayer * >( qvariant_cast<QObject *>( val ) ) )
1335 return QList<QgsMapLayer *>() << layer;
1338 QList<QgsMapLayer *> layers;
1340 std::function< void( const QVariant &var ) > processVariant;
1341 processVariant = [ &layers, &context, &definition, &processVariant ](
const QVariant & var )
1343 if ( var.type() == QVariant::List )
1345 const auto constToList = var.toList();
1346 for (
const QVariant &listVar : constToList )
1348 processVariant( listVar );
1351 else if ( var.type() == QVariant::StringList )
1353 const auto constToStringList = var.toStringList();
1354 for (
const QString &s : constToStringList )
1356 processVariant( s );
1360 processVariant( var.value<
QgsProperty >().
valueAsString( context.expressionContext(), definition->defaultValue().toString() ) );
1368 processVariant( sink.value<
QgsProperty >().
valueAsString( context.expressionContext(), definition->defaultValue().toString() ) );
1371 else if (
QgsMapLayer *layer = qobject_cast< QgsMapLayer * >( qvariant_cast<QObject *>( var ) ) )
1383 processVariant( val );
1385 if ( layers.isEmpty() )
1388 if (
QgsMapLayer *layer = qobject_cast< QgsMapLayer * >( qvariant_cast<QObject *>( definition->defaultValue() ) ) )
1392 else if ( definition->defaultValue().type() == QVariant::List )
1394 const auto constToList = definition->defaultValue().toList();
1395 for (
const QVariant &var : constToList )
1397 if (
QgsMapLayer *layer = qobject_cast< QgsMapLayer * >( qvariant_cast<QObject *>( var ) ) )
1403 processVariant( var );
1408 processVariant( definition->defaultValue() );
1417 return QList<double>();
1419 return parameterAsRange( definition, parameters.value( definition->
name() ), context );
1425 return QList<double>();
1427 QStringList resultStringList;
1428 QVariant val = value;
1431 else if ( val.type() == QVariant::List )
1433 const auto constToList = val.toList();
1434 for (
const QVariant &var : constToList )
1435 resultStringList << var.toString();
1438 resultStringList << val.toString();
1440 if ( ( resultStringList.isEmpty() || ( resultStringList.size() == 1 && resultStringList.at( 0 ).isEmpty() ) ) )
1442 resultStringList.clear();
1444 if ( definition->
defaultValue().type() == QVariant::List )
1446 const auto constToList = definition->
defaultValue().toList();
1447 for (
const QVariant &var : constToList )
1448 resultStringList << var.toString();
1451 resultStringList << definition->
defaultValue().toString();
1454 if ( resultStringList.size() == 1 )
1456 resultStringList = resultStringList.at( 0 ).split(
',' );
1459 if ( resultStringList.size() < 2 )
1460 return QList< double >() << 0.0 << 0.0;
1462 return QList< double >() << resultStringList.at( 0 ).toDouble() << resultStringList.at( 1 ).toDouble();
1468 return QStringList();
1470 QStringList resultStringList;
1471 return parameterAsFields( definition, parameters.value( definition->
name() ), context );
1477 return QStringList();
1479 QStringList resultStringList;
1480 QVariant val = value;
1481 if ( val.isValid() )
1485 else if ( val.type() == QVariant::List )
1487 const auto constToList = val.toList();
1488 for (
const QVariant &var : constToList )
1489 resultStringList << var.toString();
1492 resultStringList.append( val.toString().split(
';' ) );
1495 if ( ( resultStringList.isEmpty() || resultStringList.at( 0 ).isEmpty() ) )
1497 resultStringList.clear();
1501 if ( definition->
defaultValue().type() == QVariant::List )
1503 const auto constToList = definition->
defaultValue().toList();
1504 for (
const QVariant &var : constToList )
1505 resultStringList << var.toString();
1508 resultStringList.append( definition->
defaultValue().toString().split(
';' ) );
1512 return resultStringList;
1520 return parameterAsLayout( definition, parameters.value( definition->
name() ), context );
1525 const QString layoutName = parameterAsString( definition, value, context );
1526 if ( layoutName.isEmpty() )
1534 return static_cast< QgsPrintLayout * >( l );
1544 return parameterAsLayoutItem( definition, parameters.value( definition->
name() ), context, layout );
1552 const QString
id = parameterAsString( definition, value, context );
1567 QString type = map.value( QStringLiteral(
"parameter_type" ) ).toString();
1568 QString name = map.value( QStringLiteral(
"name" ) ).toString();
1569 std::unique_ptr< QgsProcessingParameterDefinition > def;
1628 def.reset( paramType->
create( name ) );
1634 def->fromVariantMap( map );
1635 return def.release();
1640 QString desc = name;
1641 desc.replace(
'_',
' ' );
1647 bool isOptional =
false;
1651 if ( !parseScriptCodeParameterOptions( code, isOptional, name, type, definition ) )
1654 QString description = descriptionFromName( name );
1656 if ( type == QStringLiteral(
"boolean" ) )
1658 else if ( type == QStringLiteral(
"crs" ) )
1660 else if ( type == QStringLiteral(
"layer" ) )
1662 else if ( type == QStringLiteral(
"extent" ) )
1664 else if ( type == QStringLiteral(
"point" ) )
1666 else if ( type == QStringLiteral(
"file" ) )
1668 else if ( type == QStringLiteral(
"folder" ) )
1670 else if ( type == QStringLiteral(
"matrix" ) )
1672 else if ( type == QStringLiteral(
"multiple" ) )
1674 else if ( type == QStringLiteral(
"number" ) )
1676 else if ( type == QStringLiteral(
"distance" ) )
1678 else if ( type == QStringLiteral(
"scale" ) )
1680 else if ( type == QStringLiteral(
"range" ) )
1682 else if ( type == QStringLiteral(
"raster" ) )
1684 else if ( type == QStringLiteral(
"enum" ) )
1686 else if ( type == QStringLiteral(
"string" ) )
1688 else if ( type == QStringLiteral(
"authcfg" ) )
1690 else if ( type == QStringLiteral(
"expression" ) )
1692 else if ( type == QStringLiteral(
"field" ) )
1694 else if ( type == QStringLiteral(
"vector" ) )
1696 else if ( type == QStringLiteral(
"source" ) )
1698 else if ( type == QStringLiteral(
"sink" ) )
1700 else if ( type == QStringLiteral(
"vectordestination" ) )
1702 else if ( type == QStringLiteral(
"rasterdestination" ) )
1704 else if ( type == QStringLiteral(
"filedestination" ) )
1706 else if ( type == QStringLiteral(
"folderdestination" ) )
1708 else if ( type == QStringLiteral(
"band" ) )
1710 else if ( type == QStringLiteral(
"mesh" ) )
1712 else if ( type == QStringLiteral(
"layout" ) )
1714 else if ( type == QStringLiteral(
"layoutitem" ) )
1720 bool QgsProcessingParameters::parseScriptCodeParameterOptions(
const QString &code,
bool &isOptional, QString &name, QString &type, QString &definition )
1722 QRegularExpression re( QStringLiteral(
"(?:#*)(.*?)=\\s*(.*)" ) );
1723 QRegularExpressionMatch m = re.match( code );
1724 if ( !m.hasMatch() )
1727 name = m.captured( 1 );
1728 QString tokens = m.captured( 2 );
1729 if ( tokens.startsWith( QLatin1String(
"optional" ), Qt::CaseInsensitive ) )
1732 tokens.remove( 0, 8 );
1739 tokens = tokens.trimmed();
1741 QRegularExpression re2( QStringLiteral(
"(.*?)\\s+(.*)" ) );
1742 m = re2.match( tokens );
1743 if ( !m.hasMatch() )
1745 type = tokens.toLower().trimmed();
1750 type = m.captured( 1 ).toLower().trimmed();
1751 definition = m.captured( 2 );
1762 , mDescription( description )
1763 , mDefault( defaultValue )
1764 , mFlags( optional ? FlagOptional : 0 )
1769 if ( !input.isValid() && !
mDefault.isValid() )
1772 if ( ( input.type() == QVariant::String && input.toString().isEmpty() )
1773 || ( !input.isValid() &&
mDefault.type() == QVariant::String &&
mDefault.toString().isEmpty() ) )
1781 if ( !value.isValid() )
1782 return QStringLiteral(
"None" );
1785 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( value.value<
QgsProperty >().
asExpression() );
1792 QString code = QStringLiteral(
"##%1=" ).arg(
mName );
1794 code += QStringLiteral(
"optional " );
1795 code +=
type() +
' ';
1797 return code.trimmed();
1805 switch ( outputType )
1809 QString code = t->className() + QStringLiteral(
"('%1', '%2'" ).arg(
name(),
description() );
1811 code += QStringLiteral(
", optional=True" );
1827 map.insert( QStringLiteral(
"parameter_type" ),
type() );
1828 map.insert( QStringLiteral(
"name" ),
mName );
1829 map.insert( QStringLiteral(
"description" ),
mDescription );
1830 map.insert( QStringLiteral(
"default" ),
mDefault );
1831 map.insert( QStringLiteral(
"flags" ), static_cast< int >(
mFlags ) );
1832 map.insert( QStringLiteral(
"metadata" ),
mMetadata );
1838 mName = map.value( QStringLiteral(
"name" ) ).toString();
1839 mDescription = map.value( QStringLiteral(
"description" ) ).toString();
1840 mDefault = map.value( QStringLiteral(
"default" ) );
1841 mFlags =
static_cast< Flags
>( map.value( QStringLiteral(
"flags" ) ).toInt() );
1842 mMetadata = map.value( QStringLiteral(
"metadata" ) ).toMap();
1858 return QStringLiteral(
"<p><b>%1</b></p><p>%2</p>" ).arg(
1860 QObject::tr(
"Python identifier: ‘%1’" ).arg( QStringLiteral(
"<i>%1</i>" ).arg(
name() ) ) );
1874 if ( !val.isValid() )
1875 return QStringLiteral(
"None" );
1879 return val.toBool() ? QStringLiteral(
"True" ) : QStringLiteral(
"False" );
1884 QString code = QStringLiteral(
"##%1=" ).arg(
mName );
1886 code += QStringLiteral(
"optional " );
1887 code +=
type() +
' ';
1888 code +=
mDefault.toBool() ? QStringLiteral(
"true" ) : QStringLiteral(
"false" );
1889 return code.trimmed();
1910 if ( !input.isValid() )
1932 if ( qobject_cast< QgsMapLayer * >( qvariant_cast<QObject *>( input ) ) )
1935 if ( input.type() != QVariant::String || input.toString().isEmpty() )
1943 if ( !value.isValid() )
1944 return QStringLiteral(
"None" );
1949 return QStringLiteral(
"QgsCoordinateReferenceSystem()" );
1955 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( value.value<
QgsProperty >().
asExpression() );
1958 p.insert(
name(), value );
1968 return new QgsProcessingParameterCrs( name, description, definition.compare( QLatin1String(
"none" ), Qt::CaseInsensitive ) == 0 ? QVariant() : definition, isOptional );
1984 if ( !input.isValid() )
1992 if ( qobject_cast< QgsMapLayer * >( qvariant_cast<QObject *>( input ) ) )
1997 if ( input.type() != QVariant::String || input.toString().isEmpty() )
2015 if ( !val.isValid() )
2016 return QStringLiteral(
"None" );
2022 p.insert(
name(), val );
2046 if ( !input.isValid() )
2075 if ( qobject_cast< QgsMapLayer * >( qvariant_cast<QObject *>( input ) ) )
2078 if ( input.type() != QVariant::String || input.toString().isEmpty() )
2087 QRegularExpression rx( QStringLiteral(
"^(.*?)\\s*,\\s*(.*?)\\s*,\\s*(.*?)\\s*,\\s*(.*?)\\s*(?:\\[(.*)\\])?\\s*$" ) );
2088 QRegularExpressionMatch match = rx.match( input.toString() );
2089 if ( match.hasMatch() )
2091 bool xMinOk =
false;
2092 ( void )match.captured( 1 ).toDouble( &xMinOk );
2093 bool xMaxOk =
false;
2094 ( void )match.captured( 2 ).toDouble( &xMaxOk );
2095 bool yMinOk =
false;
2096 ( void )match.captured( 3 ).toDouble( &yMinOk );
2097 bool yMaxOk =
false;
2098 ( void )match.captured( 4 ).toDouble( &yMaxOk );
2099 if ( xMinOk && xMaxOk && yMinOk && yMaxOk )
2109 if ( !value.isValid() )
2110 return QStringLiteral(
"None" );
2113 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( value.value<
QgsProperty >().
asExpression() );
2133 p.insert(
name(), value );
2159 if ( !input.isValid() )
2180 if ( input.type() == QVariant::String )
2182 if ( input.toString().isEmpty() )
2186 QRegularExpression rx( QStringLiteral(
"^\\s*\\(?\\s*(.*?)\\s*,\\s*(.*?)\\s*(?:\\[(.*)\\])?\\s*\\)?\\s*$" ) );
2188 QRegularExpressionMatch match = rx.match( input.toString() );
2189 if ( match.hasMatch() )
2192 ( void )match.captured( 1 ).toDouble( &xOk );
2194 ( void )match.captured( 2 ).toDouble( &yOk );
2203 if ( !value.isValid() )
2204 return QStringLiteral(
"None" );
2207 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( value.value<
QgsProperty >().
asExpression() );
2227 const QString wkt = g.
asWkt();
2228 return QStringLiteral(
"QgsGeometry.fromWkt('%1')" ).arg( wkt );
2242 , mBehavior( behavior )
2243 , mExtension( extension )
2255 if ( !input.isValid() )
2263 QString
string = input.toString().trimmed();
2265 if ( input.type() != QVariant::String ||
string.isEmpty() )
2268 switch ( mBehavior )
2272 if ( !mExtension.isEmpty() )
2273 return string.endsWith( mExtension, Qt::CaseInsensitive );
2285 QString code = QStringLiteral(
"##%1=" ).arg(
mName );
2287 code += QStringLiteral(
"optional " );
2288 code += ( mBehavior ==
File ? QStringLiteral(
"file" ) : QStringLiteral(
"folder" ) ) +
' ';
2290 return code.trimmed();
2295 switch ( outputType )
2300 QString code = QStringLiteral(
"QgsProcessingParameterFile('%1', '%2'" ).arg(
name(),
description() );
2302 code += QStringLiteral(
", optional=True" );
2303 code += QStringLiteral(
", behavior=%1" ).arg( mBehavior ==
File ? QStringLiteral(
"QgsProcessingParameterFile.File" ) : QStringLiteral(
"QgsProcessingParameterFile.Folder" ) );
2304 code += QStringLiteral(
", extension='%1'" ).arg( mExtension );
2316 map.insert( QStringLiteral(
"behavior" ), mBehavior );
2317 map.insert( QStringLiteral(
"extension" ), mExtension );
2324 mBehavior =
static_cast< Behavior >( map.value( QStringLiteral(
"behavior" ) ).toInt() );
2325 mExtension = map.value( QStringLiteral(
"extension" ) ).toString();
2336 , mHeaders( headers )
2337 , mNumberRows( numberRows )
2338 , mFixedNumberRows( fixedNumberRows )
2350 if ( !input.isValid() )
2353 if ( input.type() == QVariant::String )
2355 if ( input.toString().isEmpty() )
2359 else if ( input.type() == QVariant::List )
2361 if ( input.toList().isEmpty() )
2365 else if ( input.type() == QVariant::Double || input.type() == QVariant::Int )
2375 if ( !value.isValid() )
2376 return QStringLiteral(
"None" );
2379 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( value.value<
QgsProperty >().
asExpression() );
2382 p.insert(
name(), value );
2386 const auto constList = list;
2387 for (
const QVariant &v : constList )
2389 if ( v.type() == QVariant::List )
2392 const auto constToList = v.toList();
2393 for (
const QVariant &v2 : constToList )
2395 if ( v2.isNull() || !v2.isValid() )
2396 parts2 << QStringLiteral(
"None" );
2397 else if ( v2.toString().isEmpty() )
2398 parts2 << QStringLiteral(
"''" );
2400 parts2 << v2.toString();
2402 parts << parts2.join(
',' ).prepend(
'[' ).append(
']' );
2406 if ( v.isNull() || !v.isValid() )
2407 parts << QStringLiteral(
"None" );
2408 else if ( v.toString().isEmpty() )
2409 parts << QStringLiteral(
"''" );
2411 parts << v.toString();
2415 return parts.join(
',' ).prepend(
'[' ).append(
']' );
2420 switch ( outputType )
2424 QString code = QStringLiteral(
"QgsProcessingParameterMatrix('%1', '%2'" ).arg(
name(),
description() );
2426 code += QStringLiteral(
", optional=True" );
2427 code += QStringLiteral(
", numberRows=" ).arg( mNumberRows );
2428 code += QStringLiteral(
", hasFixedNumberRows=" ).arg( mFixedNumberRows ? QStringLiteral(
"True" ) : QStringLiteral(
"False" ) );
2431 headers.reserve( mHeaders.size() );
2432 for (
const QString &h : mHeaders )
2434 code += QStringLiteral(
", headers=[%1]" ).arg( headers.join(
',' ) );
2466 return mFixedNumberRows;
2471 mFixedNumberRows = fixedNumberRows;
2477 map.insert( QStringLiteral(
"headers" ), mHeaders );
2478 map.insert( QStringLiteral(
"rows" ), mNumberRows );
2479 map.insert( QStringLiteral(
"fixed_number_rows" ), mFixedNumberRows );
2486 mHeaders = map.value( QStringLiteral(
"headers" ) ).toStringList();
2487 mNumberRows = map.value( QStringLiteral(
"rows" ) ).toInt();
2488 mFixedNumberRows = map.value( QStringLiteral(
"fixed_number_rows" ) ).toBool();
2494 return new QgsProcessingParameterMatrix( name, description, 0,
false, QStringList(), definition.isEmpty() ? QVariant() : definition, isOptional );
2499 , mLayerType( layerType )
2511 if ( !input.isValid() )
2514 if ( qobject_cast< QgsMapLayer * >( qvariant_cast<QObject *>( input ) ) )
2519 if ( input.type() == QVariant::String )
2521 if ( input.toString().isEmpty() )
2524 if ( mMinimumNumberInputs > 1 )
2532 else if ( input.type() == QVariant::List )
2534 if ( input.toList().count() < mMinimumNumberInputs )
2537 if ( mMinimumNumberInputs > input.toList().count() )
2543 const auto constToList = input.toList();
2544 for (
const QVariant &v : constToList )
2546 if ( qobject_cast< QgsMapLayer * >( qvariant_cast<QObject *>( v ) ) )
2554 else if ( input.type() == QVariant::StringList )
2556 if ( input.toStringList().count() < mMinimumNumberInputs )
2559 if ( mMinimumNumberInputs > input.toStringList().count() )
2565 const auto constToStringList = input.toStringList();
2566 for (
const QString &v : constToStringList )
2578 if ( !value.isValid() )
2579 return QStringLiteral(
"None" );
2582 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( value.value<
QgsProperty >().
asExpression() );
2585 p.insert(
name(), value );
2587 if ( !list.isEmpty() )
2590 const auto constList = list;
2595 return parts.join(
',' ).prepend(
'[' ).append(
']' );
2603 QString code = QStringLiteral(
"##%1=" ).arg(
mName );
2605 code += QStringLiteral(
"optional " );
2606 switch ( mLayerType )
2609 code += QStringLiteral(
"multiple raster" );
2613 code += QStringLiteral(
"multiple file" );
2617 code += QStringLiteral(
"multiple vector" );
2621 if (
mDefault.type() == QVariant::List )
2624 const auto constToList =
mDefault.toList();
2625 for (
const QVariant &var : constToList )
2627 parts << var.toString();
2629 code += parts.join(
',' );
2631 else if (
mDefault.type() == QVariant::StringList )
2633 code +=
mDefault.toStringList().join(
',' );
2639 return code.trimmed();
2644 switch ( outputType )
2648 QString code = QStringLiteral(
"QgsProcessingParameterMultipleLayers('%1', '%2'" ).arg(
name(),
description() );
2650 code += QStringLiteral(
", optional=True" );
2654 code += QStringLiteral(
", layerType=%1" ).arg( layerType );
2675 return mMinimumNumberInputs;
2687 map.insert( QStringLiteral(
"layer_type" ), mLayerType );
2688 map.insert( QStringLiteral(
"min_inputs" ), mMinimumNumberInputs );
2696 mMinimumNumberInputs = map.value( QStringLiteral(
"min_inputs" ) ).toInt();
2702 QString
type = definition;
2704 QRegularExpression re( QStringLiteral(
"(.*?)\\s+(.*)" ) );
2705 QRegularExpressionMatch m = re.match( definition );
2708 type = m.captured( 1 ).toLower().trimmed();
2709 defaultVal = m.captured( 2 );
2712 if ( type == QStringLiteral(
"vector" ) )
2714 else if ( type == QStringLiteral(
"raster" ) )
2716 else if ( type == QStringLiteral(
"file" ) )
2729 QgsMessageLog::logMessage( QObject::tr(
"Invalid number parameter \"%1\": min value %2 is >= max value %3!" ).arg( name ).arg( mMin ).arg( mMax ), QObject::tr(
"Processing" ) );
2740 QVariant input = value;
2741 if ( !input.isValid() )
2755 double res = input.toDouble( &ok );
2759 return !( res < mMin || res > mMax );
2764 if ( !value.isValid() )
2765 return QStringLiteral(
"None" );
2768 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( value.value<
QgsProperty >().
asExpression() );
2770 return value.toString();
2777 if ( mMin > std::numeric_limits<double>::lowest() + 1 )
2778 parts << QObject::tr(
"Minimum value: %1" ).arg( mMin );
2779 if ( mMax < std::numeric_limits<double>::max() )
2780 parts << QObject::tr(
"Maximum value: %1" ).arg( mMax );
2782 parts << QObject::tr(
"Default value: %1" ).arg( mDataType ==
Integer ?
mDefault.toInt() :
mDefault.toDouble() );
2783 QString extra = parts.join( QStringLiteral(
"<br />" ) );
2784 if ( !extra.isEmpty() )
2785 text += QStringLiteral(
"<p>%1</p>" ).arg( extra );
2791 switch ( outputType )
2795 QString code = QStringLiteral(
"QgsProcessingParameterNumber('%1', '%2'" ).arg(
name(),
description() );
2797 code += QStringLiteral(
", optional=True" );
2799 code += QStringLiteral(
", type=%1" ).arg( mDataType ==
Integer ? QStringLiteral(
"QgsProcessingParameterNumber.Integer" ) : QStringLiteral(
"QgsProcessingParameterNumber.Double" ) );
2801 if ( mMin != std::numeric_limits<double>::lowest() + 1 )
2802 code += QStringLiteral(
", minValue=%1" ).arg( mMin );
2803 if ( mMax != std::numeric_limits<double>::max() )
2804 code += QStringLiteral(
", maxValue=%1" ).arg( mMax );
2846 map.insert( QStringLiteral(
"min" ), mMin );
2847 map.insert( QStringLiteral(
"max" ), mMax );
2848 map.insert( QStringLiteral(
"data_type" ), mDataType );
2855 mMin = map.value( QStringLiteral(
"min" ) ).toDouble();
2856 mMax = map.value( QStringLiteral(
"max" ) ).toDouble();
2857 mDataType =
static_cast< Type >( map.value( QStringLiteral(
"data_type" ) ).toInt() );
2864 : ( definition.toLower().trimmed() == QStringLiteral(
"none" ) ? QVariant() : definition ), isOptional );
2881 if ( !input.isValid() )
2889 if ( input.type() == QVariant::String )
2891 QStringList list = input.toString().split(
',' );
2892 if ( list.count() != 2 )
2895 list.at( 0 ).toDouble( &ok );
2897 list.at( 1 ).toDouble( &ok2 );
2902 else if ( input.type() == QVariant::List )
2904 if ( input.toList().count() != 2 )
2908 input.toList().at( 0 ).toDouble( &ok );
2910 input.toList().at( 1 ).toDouble( &ok2 );
2921 if ( !value.isValid() )
2922 return QStringLiteral(
"None" );
2925 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( value.value<
QgsProperty >().
asExpression() );
2928 p.insert(
name(), value );
2931 QStringList stringParts;
2932 const auto constParts = parts;
2933 for (
double v : constParts )
2935 stringParts << QString::number( v );
2937 return stringParts.join(
',' ).prepend(
'[' ).append(
']' );
2942 switch ( outputType )
2946 QString code = QStringLiteral(
"QgsProcessingParameterRange('%1', '%2'" ).arg(
name(),
description() );
2948 code += QStringLiteral(
", optional=True" );
2950 code += QStringLiteral(
", type=%1" ).arg( mDataType ==
QgsProcessingParameterNumber::Integer ? QStringLiteral(
"QgsProcessingParameterNumber.Integer" ) : QStringLiteral(
"QgsProcessingParameterNumber.Double" ) );
2973 map.insert( QStringLiteral(
"data_type" ), mDataType );
3002 if ( !input.isValid() )
3010 if ( qobject_cast< QgsRasterLayer * >( qvariant_cast<QObject *>( input ) ) )
3013 if ( input.type() != QVariant::String || input.toString().isEmpty() )
3031 if ( !val.isValid() )
3032 return QStringLiteral(
"None" );
3038 p.insert(
name(), val );
3051 , mOptions( options )
3052 , mAllowMultiple( allowMultiple )
3064 QVariant input = value;
3065 if ( !input.isValid() )
3078 if ( input.type() == QVariant::List )
3080 if ( !mAllowMultiple )
3083 const QVariantList values = input.toList();
3087 for (
const QVariant &val : values )
3090 int res = val.toInt( &ok );
3093 else if ( res < 0 || res >= mOptions.count() )
3099 else if ( input.type() == QVariant::String )
3101 QStringList parts = input.toString().split(
',' );
3102 if ( parts.count() > 1 && !mAllowMultiple )
3105 const auto constParts = parts;
3106 for (
const QString &part : constParts )
3109 int res = part.toInt( &ok );
3112 else if ( res < 0 || res >= mOptions.count() )
3117 else if ( input.type() == QVariant::Int || input.type() == QVariant::Double )
3120 int res = input.toInt( &ok );
3123 else if ( res >= 0 && res < mOptions.count() )
3131 if ( !value.isValid() )
3132 return QStringLiteral(
"None" );
3135 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( value.value<
QgsProperty >().
asExpression() );
3137 if ( value.type() == QVariant::List )
3140 const auto constToList = value.toList();
3141 for (
const QVariant &val : constToList )
3143 parts << QString::number( static_cast< int >( val.toDouble() ) );
3145 return parts.join(
',' ).prepend(
'[' ).append(
']' );
3147 else if ( value.type() == QVariant::String )
3149 QStringList parts = value.toString().split(
',' );
3150 if ( parts.count() > 1 )
3152 return parts.join(
',' ).prepend(
'[' ).append(
']' );
3156 return QString::number( static_cast< int >( value.toDouble() ) );
3161 QString code = QStringLiteral(
"##%1=" ).arg(
mName );
3163 code += QStringLiteral(
"optional " );
3164 code += QStringLiteral(
"enum " );
3166 if ( mAllowMultiple )
3167 code += QStringLiteral(
"multiple " );
3169 code += mOptions.join(
';' ) +
' ';
3172 return code.trimmed();
3177 switch ( outputType )
3181 QString code = QStringLiteral(
"QgsProcessingParameterEnum('%1', '%2'" ).arg(
name(),
description() );
3183 code += QStringLiteral(
", optional=True" );
3186 options.reserve( mOptions.size() );
3187 for (
const QString &o : mOptions )
3189 code += QStringLiteral(
", options=[%1]" ).arg( options.join(
',' ) );
3191 code += QStringLiteral(
", allowMultiple=%1" ).arg( mAllowMultiple ? QStringLiteral(
"True" ) : QStringLiteral(
"False" ) );
3213 return mAllowMultiple;
3224 map.insert( QStringLiteral(
"options" ), mOptions );
3225 map.insert( QStringLiteral(
"allow_multiple" ), mAllowMultiple );
3232 mOptions = map.value( QStringLiteral(
"options" ) ).toStringList();
3233 mAllowMultiple = map.value( QStringLiteral(
"allow_multiple" ) ).toBool();
3240 bool multiple =
false;
3241 QString def = definition;
3242 if ( def.startsWith( QLatin1String(
"multiple" ), Qt::CaseInsensitive ) )
3248 QRegularExpression re( QStringLiteral(
"(.*)\\s+(.*?)$" ) );
3249 QRegularExpressionMatch m = re.match( def );
3250 QString values = def;
3253 values = m.captured( 1 ).trimmed();
3254 defaultVal = m.captured( 2 );
3257 return new QgsProcessingParameterEnum( name, description, values.split(
';' ), multiple, defaultVal.isEmpty() ? QVariant() : defaultVal, isOptional );
3262 , mMultiLine( multiLine )
3274 if ( !value.isValid() || value.isNull() )
3275 return QStringLiteral(
"None" );
3278 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( value.value<
QgsProperty >().
asExpression() );
3280 QString s = value.toString();
3286 QString code = QStringLiteral(
"##%1=" ).arg(
mName );
3288 code += QStringLiteral(
"optional " );
3289 code += QStringLiteral(
"string " );
3292 code += QStringLiteral(
"long " );
3295 return code.trimmed();
3300 switch ( outputType )
3304 QString code = QStringLiteral(
"QgsProcessingParameterString('%1', '%2'" ).arg(
name(),
description() );
3306 code += QStringLiteral(
", optional=True" );
3307 code += QStringLiteral(
", multiLine=%1" ).arg( mMultiLine ? QStringLiteral(
"True" ) : QStringLiteral(
"False" ) );
3330 map.insert( QStringLiteral(
"multiline" ), mMultiLine );
3337 mMultiLine = map.value( QStringLiteral(
"multiline" ) ).toBool();
3343 QString def = definition;
3345 if ( def.startsWith( QLatin1String(
"long" ), Qt::CaseInsensitive ) )
3351 if ( def.startsWith(
'"' ) || def.startsWith(
'\'' ) )
3353 if ( def.endsWith(
'"' ) || def.endsWith(
'\'' ) )
3357 if ( def == QStringLiteral(
"None" ) )
3358 defaultValue = QVariant();
3380 if ( !value.isValid() )
3381 return QStringLiteral(
"None" );
3383 QString s = value.toString();
3389 QString code = QStringLiteral(
"##%1=" ).arg(
mName );
3391 code += QStringLiteral(
"optional " );
3392 code += QStringLiteral(
"authcfg " );
3395 return code.trimmed();
3400 QString def = definition;
3402 if ( def.startsWith(
'"' ) || def.startsWith(
'\'' ) )
3404 if ( def.endsWith(
'"' ) || def.endsWith(
'\'' ) )
3408 if ( def == QStringLiteral(
"None" ) )
3409 defaultValue = QVariant();
3421 , mParentLayerParameterName( parentLayerParameterName )
3433 if ( !value.isValid() )
3434 return QStringLiteral(
"None" );
3437 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( value.value<
QgsProperty >().
asExpression() );
3439 QString s = value.toString();
3445 QStringList depends;
3446 if ( !mParentLayerParameterName.isEmpty() )
3447 depends << mParentLayerParameterName;
3453 switch ( outputType )
3457 QString code = QStringLiteral(
"QgsProcessingParameterExpression('%1', '%2'" ).arg(
name(),
description() );
3459 code += QStringLiteral(
", optional=True" );
3461 code += QStringLiteral(
", parentLayerParameterName='%1'" ).arg( mParentLayerParameterName );
3473 return mParentLayerParameterName;
3484 map.insert( QStringLiteral(
"parent_layer" ), mParentLayerParameterName );
3491 mParentLayerParameterName = map.value( QStringLiteral(
"parent_layer" ) ).toString();
3532 if ( qobject_cast< QgsVectorLayer * >( qvariant_cast<QObject *>( var ) ) )
3535 if ( var.type() != QVariant::String || var.toString().isEmpty() )
3553 if ( !val.isValid() )
3554 return QStringLiteral(
"None" );
3560 p.insert(
name(), val );
3568 switch ( outputType )
3572 QString code = QStringLiteral(
"QgsProcessingParameterVectorLayer('%1', '%2'" ).arg(
name(),
description() );
3574 code += QStringLiteral(
", optional=True" );
3578 QStringList options;
3581 code += QStringLiteral(
", types=[%1]" ).arg( options.join(
',' ) );
3607 for (
int type : constMDataTypes )
3611 map.insert( QStringLiteral(
"data_types" ), types );
3619 QVariantList values = map.value( QStringLiteral(
"data_types" ) ).toList();
3620 const auto constValues = values;
3621 for (
const QVariant &val : constValues )
3667 if ( qobject_cast< QgsMeshLayer * >( qvariant_cast<QObject *>( var ) ) )
3670 if ( var.type() != QVariant::String || var.toString().isEmpty() )
3688 if ( !val.isValid() )
3689 return QStringLiteral(
"None" );
3695 p.insert(
name(), val );
3708 , mParentLayerParameterName( parentLayerParameterName )
3710 , mAllowMultiple( allowMultiple )
3723 if ( !input.isValid() )
3731 if ( input.type() == QVariant::List || input.type() == QVariant::StringList )
3733 if ( !mAllowMultiple )
3739 else if ( input.type() == QVariant::String )
3741 if ( input.toString().isEmpty() )
3744 QStringList parts = input.toString().split(
';' );
3745 if ( parts.count() > 1 && !mAllowMultiple )
3750 if ( input.toString().isEmpty() )
3758 if ( !value.isValid() )
3759 return QStringLiteral(
"None" );
3762 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( value.value<
QgsProperty >().
asExpression() );
3764 if ( value.type() == QVariant::List )
3767 const auto constToList = value.toList();
3768 for (
const QVariant &val : constToList )
3772 return parts.join(
',' ).prepend(
'[' ).append(
']' );
3774 else if ( value.type() == QVariant::StringList )
3777 const auto constToStringList = value.toStringList();
3778 for ( QString s : constToStringList )
3782 return parts.join(
',' ).prepend(
'[' ).append(
']' );
3790 QString code = QStringLiteral(
"##%1=" ).arg(
mName );
3792 code += QStringLiteral(
"optional " );
3793 code += QStringLiteral(
"field " );
3795 switch ( mDataType )
3798 code += QStringLiteral(
"numeric " );
3802 code += QStringLiteral(
"string " );
3806 code += QStringLiteral(
"datetime " );
3813 if ( mAllowMultiple )
3814 code += QStringLiteral(
"multiple " );
3816 code += mParentLayerParameterName +
' ';
3819 return code.trimmed();
3824 switch ( outputType )
3828 QString code = QStringLiteral(
"QgsProcessingParameterField('%1', '%2'" ).arg(
name(),
description() );
3830 code += QStringLiteral(
", optional=True" );
3833 switch ( mDataType )
3836 dataType = QStringLiteral(
"QgsProcessingParameterField.Any" );
3840 dataType = QStringLiteral(
"QgsProcessingParameterField.Numeric" );
3844 dataType = QStringLiteral(
"QgsProcessingParameterField.String" );
3848 dataType = QStringLiteral(
"QgsProcessingParameterField.DateTime" );
3851 code += QStringLiteral(
", type=%1" ).arg( dataType );
3853 code += QStringLiteral(
", parentLayerParameterName='%1'" ).arg( mParentLayerParameterName );
3854 code += QStringLiteral(
", allowMultiple=%1" ).arg( mAllowMultiple ? QStringLiteral(
"True" ) : QStringLiteral(
"False" ) );
3866 QStringList depends;
3867 if ( !mParentLayerParameterName.isEmpty() )
3868 depends << mParentLayerParameterName;
3874 return mParentLayerParameterName;
3894 return mAllowMultiple;
3905 map.insert( QStringLiteral(
"parent_layer" ), mParentLayerParameterName );
3906 map.insert( QStringLiteral(
"data_type" ), mDataType );
3907 map.insert( QStringLiteral(
"allow_multiple" ), mAllowMultiple );
3914 mParentLayerParameterName = map.value( QStringLiteral(
"parent_layer" ) ).toString();
3915 mDataType =
static_cast< DataType >( map.value( QStringLiteral(
"data_type" ) ).toInt() );
3916 mAllowMultiple = map.value( QStringLiteral(
"allow_multiple" ) ).toBool();
3925 QString def = definition;
3927 if ( def.startsWith( QLatin1String(
"numeric " ), Qt::CaseInsensitive ) )
3932 else if ( def.startsWith( QLatin1String(
"string " ), Qt::CaseInsensitive ) )
3937 else if ( def.startsWith( QLatin1String(
"datetime " ), Qt::CaseInsensitive ) )
3943 if ( def.startsWith( QLatin1String(
"multiple" ), Qt::CaseInsensitive ) )
3945 allowMultiple =
true;
3946 def = def.mid( 8 ).trimmed();
3949 QRegularExpression re( QStringLiteral(
"(.*?)\\s+(.*)$" ) );
3950 QRegularExpressionMatch m = re.match( def );
3953 parent = m.captured( 1 ).trimmed();
3954 def = m.captured( 2 );
3979 QVariant var = input;
3980 if ( !var.isValid() )
4007 if ( qobject_cast< QgsVectorLayer * >( qvariant_cast<QObject *>( input ) ) )
4012 if ( var.type() != QVariant::String || var.toString().isEmpty() )
4030 if ( !value.isValid() )
4031 return QStringLiteral(
"None" );
4034 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( value.value<
QgsProperty >().
asExpression() );
4043 return QStringLiteral(
"QgsProcessingFeatureSourceDefinition('%1', True)" ).arg( fromVar.
source.
staticValue().toString() );
4050 layerString = layer->source();
4058 return QStringLiteral(
"QgsProcessingFeatureSourceDefinition(QgsProperty.fromExpression('%1'), True)" ).arg( fromVar.
source.
asExpression() );
4062 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( fromVar.
source.
asExpression() );
4066 else if (
QgsVectorLayer *layer = qobject_cast< QgsVectorLayer * >( qvariant_cast<QObject *>( value ) ) )
4071 QString layerString = value.toString();
4075 layerString = layer->source();
4082 QString code = QStringLiteral(
"##%1=" ).arg(
mName );
4084 code += QStringLiteral(
"optional " );
4085 code += QStringLiteral(
"source " );
4088 for (
int type : constMDataTypes )
4093 code += QStringLiteral(
"point " );
4097 code += QStringLiteral(
"line " );
4101 code += QStringLiteral(
"polygon " );
4108 return code.trimmed();
4113 switch ( outputType )
4117 QString code = QStringLiteral(
"QgsProcessingParameterFeatureSource('%1', '%2'" ).arg(
name(),
description() );
4119 code += QStringLiteral(
", optional=True" );
4123 QStringList options;
4127 code += QStringLiteral(
", types=[%1]" ).arg( options.join(
',' ) );
4149 for (
int type : constMDataTypes )
4153 map.insert( QStringLiteral(
"data_types" ), types );
4161 QVariantList values = map.value( QStringLiteral(
"data_types" ) ).toList();
4162 const auto constValues = values;
4163 for (
const QVariant &val : constValues )
4173 QString def = definition;
4176 if ( def.startsWith( QLatin1String(
"point" ), Qt::CaseInsensitive ) )
4182 else if ( def.startsWith( QLatin1String(
"line" ), Qt::CaseInsensitive ) )
4188 else if ( def.startsWith( QLatin1String(
"polygon" ), Qt::CaseInsensitive ) )
4213 QVariant var = input;
4214 if ( !var.isValid() )
4236 if ( var.type() != QVariant::String )
4239 if ( var.toString().isEmpty() )
4247 if ( !value.isValid() )
4248 return QStringLiteral(
"None" );
4251 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( value.value<
QgsProperty >().
asExpression() );
4262 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( fromVar.
sink.
asExpression() );
4271 QString code = QStringLiteral(
"##%1=" ).arg(
mName );
4273 code += QStringLiteral(
"optional " );
4274 code += QStringLiteral(
"sink " );
4276 switch ( mDataType )
4279 code += QStringLiteral(
"point " );
4283 code += QStringLiteral(
"line " );
4287 code += QStringLiteral(
"polygon " );
4291 code += QStringLiteral(
"table " );
4299 return code.trimmed();
4315 return p->defaultVectorFileExtension(
hasGeometry() );
4322 return settings.
value( QStringLiteral(
"Processing/DefaultOutputVectorLayerExt" ), QStringLiteral(
"shp" ),
QgsSettings::Core ).toString();
4326 return QStringLiteral(
"dbf" );
4333 switch ( outputType )
4337 QString code = QStringLiteral(
"QgsProcessingParameterFeatureSink('%1', '%2'" ).arg(
name(),
description() );
4339 code += QStringLiteral(
", optional=True" );
4343 code += QStringLiteral(
", createByDefault=%1" ).arg(
createByDefault() ? QStringLiteral(
"True" ) : QStringLiteral(
"False" ) );
4365 return p->supportedOutputVectorLayerExtensions();
4367 return p->supportedOutputTableExtensions();
4382 switch ( mDataType )
4408 map.insert( QStringLiteral(
"data_type" ), mDataType );
4422 return QStringLiteral(
"memory:%1" ).arg(
description() );
4430 QString def = definition;
4431 if ( def.startsWith( QLatin1String(
"point" ), Qt::CaseInsensitive ) )
4436 else if ( def.startsWith( QLatin1String(
"line" ), Qt::CaseInsensitive ) )
4441 else if ( def.startsWith( QLatin1String(
"polygon" ), Qt::CaseInsensitive ) )
4446 else if ( def.startsWith( QLatin1String(
"table" ), Qt::CaseInsensitive ) )
4467 QVariant var = input;
4468 if ( !var.isValid() )
4490 if ( var.type() != QVariant::String )
4493 if ( var.toString().isEmpty() )
4501 if ( !value.isValid() )
4502 return QStringLiteral(
"None" );
4505 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( value.value<
QgsProperty >().
asExpression() );
4516 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( fromVar.
sink.
asExpression() );
4536 return p->defaultRasterFileExtension();
4541 return settings.
value( QStringLiteral(
"Processing/DefaultOutputRasterLayerExt" ), QStringLiteral(
"tif" ),
QgsSettings::Core ).toString();
4553 return p->supportedOutputRasterLayerExtensions();
4569 , mFileFilter( fileFilter.isEmpty() ? QObject::tr(
"All files (*.*)" ) : fileFilter )
4581 QVariant var = input;
4582 if ( !var.isValid() )
4604 if ( var.type() != QVariant::String )
4607 if ( var.toString().isEmpty() )
4617 if ( !value.isValid() )
4618 return QStringLiteral(
"None" );
4621 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( value.value<
QgsProperty >().
asExpression() );
4632 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( fromVar.
sink.
asExpression() );
4641 if ( !mFileFilter.isEmpty() && mFileFilter.contains( QStringLiteral(
"htm" ), Qt::CaseInsensitive ) )
4653 if ( mFileFilter.isEmpty() || mFileFilter == QObject::tr(
"All files (*.*)" ) )
4654 return QStringLiteral(
"file" );
4657 QRegularExpression rx( QStringLiteral(
".*?\\(\\*\\.([a-zA-Z0-9._]+).*" ) );
4658 QRegularExpressionMatch match = rx.match( mFileFilter );
4659 if ( !match.hasMatch() )
4660 return QStringLiteral(
"file" );
4662 return match.captured( 1 );
4667 switch ( outputType )
4671 QString code = QStringLiteral(
"QgsProcessingParameterFileDestination('%1', '%2'" ).arg(
name(),
description() );
4673 code += QStringLiteral(
", optional=True" );
4677 code += QStringLiteral(
", createByDefault=%1" ).arg(
createByDefault() ? QStringLiteral(
"True" ) : QStringLiteral(
"False" ) );
4700 map.insert( QStringLiteral(
"file_filter" ), mFileFilter );
4707 mFileFilter = map.value( QStringLiteral(
"file_filter" ) ).toString();
4728 QVariant var = input;
4729 if ( !var.isValid() )
4745 if ( var.type() != QVariant::String )
4748 if ( var.toString().isEmpty() )
4771 , mCreateByDefault( createByDefault )
4779 map.insert( QStringLiteral(
"supports_non_file_outputs" ), mSupportsNonFileBasedOutputs );
4780 map.insert( QStringLiteral(
"create_by_default" ), mCreateByDefault );
4787 mSupportsNonFileBasedOutputs = map.value( QStringLiteral(
"supports_non_file_outputs" ) ).toBool();
4788 mCreateByDefault = map.value( QStringLiteral(
"create_by_default" ), QStringLiteral(
"1" ) ).toBool();
4794 switch ( outputType )
4801 QString code = t->className() + QStringLiteral(
"('%1', '%2'" ).arg(
name(),
description() );
4803 code += QStringLiteral(
", optional=True" );
4805 code += QStringLiteral(
", createByDefault=%1" ).arg( mCreateByDefault ? QStringLiteral(
"True" ) : QStringLiteral(
"False" ) );
4832 return mCreateByDefault;
4854 QVariant var = input;
4855 if ( !var.isValid() )
4877 if ( var.type() != QVariant::String )
4880 if ( var.toString().isEmpty() )
4888 if ( !value.isValid() )
4889 return QStringLiteral(
"None" );
4892 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( value.value<
QgsProperty >().
asExpression() );
4903 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( fromVar.
sink.
asExpression() );
4912 QString code = QStringLiteral(
"##%1=" ).arg(
mName );
4914 code += QStringLiteral(
"optional " );
4915 code += QStringLiteral(
"vectorDestination " );
4917 switch ( mDataType )
4920 code += QStringLiteral(
"point " );
4924 code += QStringLiteral(
"line " );
4928 code += QStringLiteral(
"polygon " );
4936 return code.trimmed();
4952 return p->defaultVectorFileExtension(
hasGeometry() );
4959 return settings.
value( QStringLiteral(
"Processing/DefaultOutputVectorLayerExt" ), QStringLiteral(
"shp" ),
QgsSettings::Core ).toString();
4963 return QStringLiteral(
"dbf" );
4970 switch ( outputType )
4974 QString code = QStringLiteral(
"QgsProcessingParameterVectorDestination('%1', '%2'" ).arg(
name(),
description() );
4976 code += QStringLiteral(
", optional=True" );
4980 code += QStringLiteral(
", createByDefault=%1" ).arg(
createByDefault() ? QStringLiteral(
"True" ) : QStringLiteral(
"False" ) );
5002 return p->supportedOutputVectorLayerExtensions();
5004 return p->supportedOutputTableExtensions();
5019 switch ( mDataType )
5045 map.insert( QStringLiteral(
"data_type" ), mDataType );
5059 QString def = definition;
5060 if ( def.startsWith( QLatin1String(
"point" ), Qt::CaseInsensitive ) )
5065 else if ( def.startsWith( QLatin1String(
"line" ), Qt::CaseInsensitive ) )
5070 else if ( def.startsWith( QLatin1String(
"polygon" ), Qt::CaseInsensitive ) )
5081 , mParentLayerParameterName( parentLayerParameterName )
5082 , mAllowMultiple( allowMultiple )
5094 if ( !input.isValid() )
5102 if ( input.type() == QVariant::List || input.type() == QVariant::StringList )
5104 if ( !mAllowMultiple )
5113 double res = input.toInt( &ok );
5123 return mAllowMultiple;
5133 if ( !value.isValid() )
5134 return QStringLiteral(
"None" );
5137 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( value.value<
QgsProperty >().
asExpression() );
5139 if ( value.type() == QVariant::List )
5142 QVariantList values = value.toList();
5143 for (
auto it = values.constBegin(); it != values.constEnd(); ++it )
5145 parts << QString::number( static_cast< int >( it->toDouble() ) );
5147 return parts.join(
',' ).prepend(
'[' ).append(
']' );
5149 else if ( value.type() == QVariant::StringList )
5152 QStringList values = value.toStringList();
5153 for (
auto it = values.constBegin(); it != values.constEnd(); ++it )
5155 parts << QString::number( static_cast< int >( it->toDouble() ) );
5157 return parts.join(
',' ).prepend(
'[' ).append(
']' );
5160 return value.toString();
5165 QString code = QStringLiteral(
"##%1=" ).arg(
mName );
5167 code += QStringLiteral(
"optional " );
5168 code += QStringLiteral(
"band " );
5170 if ( mAllowMultiple )
5171 code += QStringLiteral(
"multiple " );
5173 code += mParentLayerParameterName +
' ';
5176 return code.trimmed();
5181 QStringList depends;
5182 if ( !mParentLayerParameterName.isEmpty() )
5183 depends << mParentLayerParameterName;
5189 switch ( outputType )
5193 QString code = QStringLiteral(
"QgsProcessingParameterBand('%1', '%2'" ).arg(
name(),
description() );
5195 code += QStringLiteral(
", optional=True" );
5197 code += QStringLiteral(
", parentLayerParameterName='%1'" ).arg( mParentLayerParameterName );
5198 code += QStringLiteral(
", allowMultiple=%1" ).arg( mAllowMultiple ? QStringLiteral(
"True" ) : QStringLiteral(
"False" ) );
5210 return mParentLayerParameterName;
5221 map.insert( QStringLiteral(
"parent_layer" ), mParentLayerParameterName );
5222 map.insert( QStringLiteral(
"allow_multiple" ), mAllowMultiple );
5229 mParentLayerParameterName = map.value( QStringLiteral(
"parent_layer" ) ).toString();
5230 mAllowMultiple = map.value( QStringLiteral(
"allow_multiple" ) ).toBool();
5237 QString def = definition;
5240 if ( def.startsWith( QLatin1String(
"multiple" ), Qt::CaseInsensitive ) )
5242 allowMultiple =
true;
5243 def = def.mid( 8 ).trimmed();
5246 QRegularExpression re( QStringLiteral(
"(.*?)\\s+(.*)$" ) );
5247 QRegularExpressionMatch m = re.match( def );
5250 parent = m.captured( 1 ).trimmed();
5251 def = m.captured( 2 );
5268 , mParentParameterName( parentParameterName )
5285 QStringList depends;
5286 if ( !mParentParameterName.isEmpty() )
5287 depends << mParentParameterName;
5293 switch ( outputType )
5297 QString code = QStringLiteral(
"QgsProcessingParameterDistance('%1', '%2'" ).arg(
name(),
description() );
5299 code += QStringLiteral(
", optional=True" );
5301 code += QStringLiteral(
", parentParameterName='%1'" ).arg( mParentParameterName );
5303 if (
minimum() != std::numeric_limits<double>::lowest() + 1 )
5304 code += QStringLiteral(
", minValue=%1" ).arg(
minimum() );
5305 if (
maximum() != std::numeric_limits<double>::max() )
5306 code += QStringLiteral(
", maxValue=%1" ).arg(
maximum() );
5317 return mParentParameterName;
5328 map.insert( QStringLiteral(
"parent" ), mParentParameterName );
5329 map.insert( QStringLiteral(
"default_unit" ), static_cast< int >( mDefaultUnit ) );
5336 mParentParameterName = map.value( QStringLiteral(
"parent" ) ).toString();
5364 switch ( outputType )
5368 QString code = QStringLiteral(
"QgsProcessingParameterScale('%1', '%2'" ).arg(
name(),
description() );
5370 code += QStringLiteral(
", optional=True" );
5382 : ( definition.toLower().trimmed() == QStringLiteral(
"none" ) ? QVariant() : definition ), isOptional );
5401 if ( !value.isValid() || value.isNull() )
5402 return QStringLiteral(
"None" );
5405 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( value.value<
QgsProperty >().
asExpression() );
5407 QString s = value.toString();
5413 QString code = QStringLiteral(
"##%1=" ).arg(
mName );
5415 code += QStringLiteral(
"optional " );
5416 code += QStringLiteral(
"layout " );
5419 return code.trimmed();
5424 switch ( outputType )
5428 QString code = QStringLiteral(
"QgsProcessingParameterLayout('%1', '%2'" ).arg(
name(),
description() );
5430 code += QStringLiteral(
", optional=True" );
5441 QString def = definition;
5443 if ( def.startsWith(
'"' ) || def.startsWith(
'\'' ) )
5445 if ( def.endsWith(
'"' ) || def.endsWith(
'\'' ) )
5449 if ( def == QStringLiteral(
"None" ) )
5450 defaultValue = QVariant();
5462 , mParentLayoutParameterName( parentLayoutParameterName )
5463 , mItemType( itemType )
5475 if ( !value.isValid() || value.isNull() )
5476 return QStringLiteral(
"None" );
5479 return QStringLiteral(
"QgsProperty.fromExpression('%1')" ).arg( value.value<
QgsProperty >().
asExpression() );
5481 QString s = value.toString();
5487 QString code = QStringLiteral(
"##%1=" ).arg(
mName );
5489 code += QStringLiteral(
"optional " );
5490 code += QStringLiteral(
"layoutitem " );
5491 if ( mItemType >= 0 )
5492 code += QString::number( mItemType ) +
' ';
5494 code += mParentLayoutParameterName +
' ';
5497 return code.trimmed();
5502 switch ( outputType )
5506 QString code = QStringLiteral(
"QgsProcessingParameterLayoutItem('%1', '%2'" ).arg(
name(),
description() );
5508 code += QStringLiteral(
", optional=True" );
5510 if ( mItemType >= 0 )
5511 code += QStringLiteral(
", itemType=%1" ).arg( mItemType );
5513 code += QStringLiteral(
", parentLayoutParameterName='%1'" ).arg( mParentLayoutParameterName );
5526 map.insert( QStringLiteral(
"parent_layout" ), mParentLayoutParameterName );
5527 map.insert( QStringLiteral(
"item_type" ), mItemType );
5534 mParentLayoutParameterName = map.value( QStringLiteral(
"parent_layout" ) ).toString();
5535 mItemType = map.value( QStringLiteral(
"item_type" ) ).toInt();
5541 QStringList depends;
5542 if ( !mParentLayoutParameterName.isEmpty() )
5543 depends << mParentLayoutParameterName;
5550 QString def = definition;
5552 QRegularExpression re( QStringLiteral(
"(\\d+)?\\s*(.*?)\\s+(.*)$" ) );
5553 QRegularExpressionMatch m = re.match( def );
5556 itemType = m.captured( 1 ).trimmed().isEmpty() ? -1 : m.captured( 1 ).trimmed().toInt();
5557 parent = m.captured( 2 ).trimmed().isEmpty() ? m.captured( 3 ).trimmed() : m.captured( 2 ).trimmed();
5558 def = !m.captured( 2 ).trimmed().isEmpty() ? m.captured( 3 ) : QString();
5571 return mParentLayoutParameterName;
5576 mParentLayoutParameterName =
name;
QgsProcessingParameterDefinition(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), bool optional=false)
Constructor for QgsProcessingParameterDefinition.
QgsProperty sink
Sink/layer definition.
bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
static QgsCoordinateReferenceSystem parameterAsCrs(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context)
Evaluates the parameter with matching definition to a coordinate reference system.
bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonQgsProcessingAlgorithmSubclass) const override
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
A boolean parameter for processing algorithms.
int itemType() const
Returns the acceptable item type, or -1 if any item type is allowed.
Class for parsing and evaluation of expressions (formerly called "search strings").
void setDataTypes(const QList< int > &types)
Sets the geometry types for sources acceptable by the parameter.
static QString typeName()
Returns the type name for the parameter class.
An input file or folder parameter for processing algorithms.
A parameter for processing algorithms which accepts multiple map layers.
QgsProcessingOutputDefinition * toOutputDefinition() const override
Returns a new QgsProcessingOutputDefinition corresponding to the definition of the destination parame...
virtual QString asScriptCode() const
Returns the parameter definition encoded in a string which can be used within a Processing script...
QString valueAsPythonString(const QVariant &value, QgsProcessingContext &context) const override
Returns a string version of the parameter input value, which is suitable for use as an input paramete...
static QgsProcessingParameterLayoutItem * fromScriptCode(const QString &name, const QString &description, bool isOptional, const QString &definition)
Creates a new parameter using the definition from a script code.
A rectangle specified with double values.
QString asExpression() const
Returns an expression string representing the state of the property, or an empty string if the proper...
Base class for all map layer types.
static QString descriptionFromName(const QString &name)
Creates an autogenerated parameter description from a parameter name.
static QString parameterAsString(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, const QgsProcessingContext &context)
Evaluates the parameter with matching definition to a static string value.
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
QgsLayoutItem * itemById(const QString &id) const
Returns a layout item given its id.
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.
QVariantMap toVariantMap() const override
Saves this parameter to a QVariantMap.
static int parameterAsEnum(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, const QgsProcessingContext &context)
Evaluates the parameter with matching definition to a enum value.
static QString typeName()
Returns the type name for the parameter class.
Base class for providing feedback from a processing algorithm.
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 bool fromVariantMap(const QVariantMap &map)
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...
QgsMasterLayoutInterface * layoutByName(const QString &name) const
Returns the layout with a matching name, or nullptr if no matching layouts were found.
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
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.
static QVariantList parameterAsMatrix(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context)
Evaluates the parameter with matching definition to a matrix/table of values.
Base class for graphical items within a QgsLayout.
virtual QStringList supportedOutputTableExtensions() const
Returns a list of the table (geometry-less vector layers) file extensions supported by this provider...
Encapsulates settings relating to a feature sink or output raster layer for a processing algorithm...
QVariantMap toVariantMap() const override
Saves this parameter to a QVariantMap.
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
QString type() const override
Unique parameter type name.
static QgsApplication * instance()
Returns the singleton instance of the QgsApplication.
bool hasFixedNumberRows() const
Returns whether the table has a fixed number of rows.
virtual QStringList supportedOutputVectorLayerExtensions() const
Returns a list of the vector format file extensions supported by this parameter.
bool createFromString(const QString &definition)
Set up this CRS from a string definition.
QString type() const override
Unique parameter type name.
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonQgsProcessingAlgorithmSubclass) const override
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
A vector layer or feature source field parameter for processing algorithms.
OperationResult transform(const QgsCoordinateTransform &ct, QgsCoordinateTransform::TransformDirection direction=QgsCoordinateTransform::ForwardTransform, bool transformZ=false) SIP_THROW(QgsCsException)
Transforms this geometry as described by the coordinate transform ct.
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.
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.
DataType dataType() const
Returns the acceptable data type for the field.
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...
QString type() const override
Unique parameter type name.
This class is a composition of two QSettings instances:
virtual QStringList supportedOutputRasterLayerExtensions() const
Returns a list of the raster format file extensions supported for this parameter. ...
void setHasFixedNumberRows(bool hasFixedNumberRows)
Sets whether the table has a fixed number of rows.
QgsProcessingParameterMultipleLayers(const QString &name, const QString &description=QString(), QgsProcessing::SourceType layerType=QgsProcessing::TypeVectorAnyGeometry, const QVariant &defaultValue=QVariant(), bool optional=false)
Constructor for QgsProcessingParameterMultipleLayers.
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...
QgsProcessingParameterExpression(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), const QString &parentLayerParameterName=QString(), bool optional=false)
Constructor for QgsProcessingParameterExpression.
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.
LayerHint
Layer type hints.
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
static QString typeName()
Returns the type name for the parameter class.
QgsProcessingParameterRange(const QString &name, const QString &description=QString(), QgsProcessingParameterNumber::Type type=QgsProcessingParameterNumber::Integer, const QVariant &defaultValue=QVariant(), bool optional=false)
Constructor for QgsProcessingParameterRange.
QVariant value(const QString &key, const QVariant &defaultValue=QVariant(), Section section=NoSection) const
Returns the value for setting key.
QgsProcessingParameterFeatureSource(const QString &name, const QString &description=QString(), const QList< int > &types=QList< int >(), const QVariant &defaultValue=QVariant(), bool optional=false)
Constructor for QgsProcessingParameterFeatureSource.
void setDataType(QgsProcessingParameterNumber::Type dataType)
Sets the acceptable data type for the range.
QVariantMap toVariantMap() const override
Saves this parameter to a QVariantMap.
QString parentLayerParameterName() const
Returns the name of the parent layer parameter, or an empty string if this is not set...
static QString typeName()
Returns the type name for the parameter class.
This class provides qgis with the ability to render raster datasets onto the mapcanvas.
static QList< int > parameterAsEnums(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, const QgsProcessingContext &context)
Evaluates the parameter with matching definition to list of enum values.
static QString typeName()
Returns the type name for the parameter class.
A print layout parameter, allowing users to select a print layout.
QString type() const override
Unique parameter type name.
A map layer 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...
bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
QString asScriptCode() const override
Returns the parameter definition encoded in a string which can be used within a Processing script...
QStringList headers() const
Returns a list of column headers (if set).
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
void setParentLayerParameterName(const QString &parentLayerParameterName)
Sets the name of the parent layer parameter.
QgsProcessingProvider * provider() const
Returns the provider to which this algorithm belongs.
A class to represent a 2D point.
QString valueAsPythonString(const QVariant &value, QgsProcessingContext &context) const override
Returns a string version of the parameter input value, which is suitable for use as an input paramete...
A HTML file output for processing algorithms.
QgsProcessingParameterLayout(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), bool optional=false)
Constructor for QgsProcessingParameterLayout.
QgsProcessingProvider * provider() const
Returns a pointer to the provider for the algorithm which owns this parameter.
An expression parameter for processing algorithms.
A QgsPointXY with associated coordinate reference system.
static QString typeName()
Returns the type name for the parameter class.
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.
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...
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
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...
QgsProcessingParameterString(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), bool multiLine=false, bool optional=false)
Constructor for QgsProcessingParameterString.
QString valueAsPythonString(const QVariant &value, QgsProcessingContext &context) const override
Returns a string version of the parameter input value, which is suitable for use as an input paramete...
bool createByDefault() const
Returns true if the destination should be created by default.
An interface for objects which accept features via addFeature(s) methods.
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...
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonQgsProcessingAlgorithmSubclass) const override
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
QString asScriptCode() const override
Returns the parameter definition encoded in a string which can be used within a Processing script...
PythonOutputType
Available Python output types.
QgsProcessingProvider * originalProvider() const
Original (source) provider which this parameter has been derived from.
bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
QString defaultFileExtension() const override
Returns the default file extension for destination file paths associated with this parameter...
QgsProcessingAlgorithm * mAlgorithm
Pointer to algorithm which owns this parameter.
virtual QStringList supportedOutputRasterLayerExtensions() const
Returns a list of the raster format file extensions supported by this provider.
static QString typeName()
Returns the type name for the parameter class.
static QString stringToPythonLiteral(const QString &string)
Converts a string to a Python string literal.
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
static QString typeName()
Returns the type name for the parameter class.
QVariantMap mMetadata
Freeform metadata for parameter. Mostly used by widget wrappers to customize their appearance and beh...
QString type() const override
Unique parameter type name.
double minimum() const
Returns the minimum value acceptable by the parameter.
QgsFeatureSource subclass which proxies methods to an underlying QgsFeatureSource, modifying results according to the settings in a QgsProcessingContext.
Container of fields for a vector layer.
static QgsProcessingParameterCrs * fromScriptCode(const QString &name, const QString &description, bool isOptional, const QString &definition)
Creates a new parameter using the definition from a script code.
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
static QgsRasterLayer * parameterAsRasterLayer(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context)
Evaluates the parameter with matching definition to a raster layer.
A geometry is the spatial representation of a feature.
static QgsMapLayer * parameterAsLayer(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context)
Evaluates the parameter with matching definition to a map layer.
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...
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.
QVariantMap toVariantMap() const override
Saves this parameter to a QVariantMap.
Abstract base class for processing providers.
virtual QVariantMap toVariantMap() const
Saves this parameter to a QVariantMap.
QgsGeometry centroid() const
Returns the center of mass of a geometry.
bool allowMultiple() const
Returns true if the parameter allows multiple selected values.
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 asScriptCode() const override
Returns the parameter definition encoded in a string which can be used within a Processing script...
QgsProcessingParameterMapLayer(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), bool optional=false)
Constructor for QgsProcessingParameterMapLayer.
A raster band parameter for Processing algorithms.
QString type() const override
Unique parameter type name.
QVariantMap toVariantMap() const override
Saves this parameter to a QVariantMap.
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...
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.
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 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 QgsProcessingParameterDefinition * parameterFromVariantMap(const QVariantMap &map)
Creates a new QgsProcessingParameterDefinition using the configuration from a supplied variant map...
QgsProcessingParameterEnum(const QString &name, const QString &description=QString(), const QStringList &options=QStringList(), bool allowMultiple=false, const QVariant &defaultValue=QVariant(), bool optional=false)
Constructor for QgsProcessingParameterEnum.
QgsProcessingParameterBoolean(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), bool optional=false)
Constructor for QgsProcessingParameterBoolean.
QString type() const override
Unique parameter type name.
QgsProcessingParameterType * parameterType(const QString &id) const
Returns the parameter type registered for id.
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.
static QString typeName()
Returns the type name for the parameter class.
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
const QgsCoordinateReferenceSystem & crs
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 convertToCompatibleFormat(const QgsVectorLayer *layer, bool selectedFeaturesOnly, const QString &baseName, const QStringList &compatibleFormats, const QString &preferredFormat, QgsProcessingContext &context, QgsProcessingFeedback *feedback)
Converts a source vector layer to a file path to a vector layer of compatible format.
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonQgsProcessingAlgorithmSubclass) const override
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
QString asScriptCode() const override
Returns the parameter definition encoded in a string which can be used within a Processing script...
static QString typeName()
Returns the type name for the parameter class.
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
void setMaximum(double maximum)
Sets the maximum value acceptable by the parameter.
void setParentLayerParameterName(const QString &parentLayerParameterName)
Sets the name of the parent layer parameter.
static QString normalizeLayerSource(const QString &source)
Normalizes a layer source string for safe comparison across different operating system environments...
static QgsVectorLayer * parameterAsVectorLayer(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context)
Evaluates the parameter with matching definition to a vector layer.
Base class for all parameter definitions which represent file or layer destinations, e.g.
Abstract base class for processing algorithms.
static QgsPointXY parameterAsPoint(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context, const QgsCoordinateReferenceSystem &crs=QgsCoordinateReferenceSystem())
Evaluates the parameter with matching definition to a point.
A vector layer output for processing algorithms.
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.
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 QString parameterAsFile(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context)
Evaluates the parameter with matching definition to a file/folder name.
QStringList dependsOnOtherParameters() const override
Returns a list of other parameter names on which this parameter is dependent (e.g.
A feature sink output for processing algorithms.
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.
QString fileFilter() const
Returns the file filter string for file destinations compatible with this parameter.
static QList< QgsMapLayer * > parameterAsLayerList(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context)
Evaluates the parameter with matching definition to a list of map layers.
QgsProject * project() const
Returns the project in which the algorithm is being executed.
Files (i.e. non map layer sources, such as text files)
bool selectedFeaturesOnly
true if only selected features in the source should be used by algorithms.
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...
virtual QgsRectangle extent() const
Returns the extent of the layer.
QgsProcessingParameterScale(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), bool optional=false)
Constructor for QgsProcessingParameterScale.
A raster layer destination parameter, for specifying the destination path for a raster layer created ...
int minimumNumberInputs() const
Returns the minimum number of layers required for the parameter.
void setAllowMultiple(bool allowMultiple)
Sets whether multiple field selections are permitted.
QStringList dependsOnOtherParameters() const override
Returns a list of other parameter names on which this parameter is dependent (e.g.
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.
static QString typeName()
Returns the type name for the parameter class.
QgsProcessing::SourceType layerType() const
Returns the layer type for layers acceptable by the parameter.
static QgsGeometry parameterAsExtentGeometry(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context, const QgsCoordinateReferenceSystem &crs=QgsCoordinateReferenceSystem())
Evaluates the parameter with matching definition to a rectangular extent, and returns a geometry cove...
static QgsCoordinateReferenceSystem parameterAsExtentCrs(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context)
Returns the coordinate reference system associated with an extent parameter value.
static QString typeName()
Returns the type name for the parameter class.
A numeric range parameter for processing algorithms.
A double numeric parameter for map scale values.
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
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.
QString parentLayoutParameterName() const
Returns the name of the parent layout parameter, or an empty string if this is not set...
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.
QgsProcessingOutputDefinition * toOutputDefinition() const override
Returns a new QgsProcessingOutputDefinition corresponding to the definition of the destination parame...
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.
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
QgsProcessingParameterCrs(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), bool optional=false)
Constructor for QgsProcessingParameterCrs.
QVariant toVariant() const
Saves this property to a QVariantMap, wrapped in a QVariant.
QList< int > dataTypes() const
Returns the geometry types for sources acceptable by the parameter.
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.
QgsCoordinateReferenceSystem crs() const
Returns the associated coordinate reference system, or an invalid CRS if no reference system is set...
static QString typeName()
Returns the type name for the parameter class.
QgsProcessingParameterFolderDestination(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), bool optional=false)
Constructor for QgsProcessingParameterFolderDestination.
static QString typeName()
Returns the type name for the parameter class.
static QgsFeatureSink * createFeatureSink(QString &destination, QgsProcessingContext &context, const QgsFields &fields, QgsWkbTypes::Type geometryType, const QgsCoordinateReferenceSystem &crs, const QVariantMap &createOptions=QVariantMap(), QgsFeatureSink::SinkFlags sinkFlags=nullptr)
Creates a feature sink ready for adding features.
static QString typeName()
Returns the type name for the parameter class.
static QString typeName()
Returns the type name for the parameter class.
static QgsGeometry fromRect(const QgsRectangle &rect)
Creates a new geometry from a QgsRectangle.
bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
QString parentLayerParameterName() const
Returns the name of the parent layer parameter, or an empty string if this is not set...
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
Can be inherited by parameters which require limits to their acceptable data types.
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...
A raster layer parameter for processing algorithms.
QVariantMap toVariantMap() const override
Saves this parameter to a QVariantMap.
QgsProcessingParameterFeatureSink(const QString &name, const QString &description=QString(), QgsProcessing::SourceType type=QgsProcessing::TypeVectorAnyGeometry, const QVariant &defaultValue=QVariant(), bool optional=false, bool createByDefault=true)
Constructor for QgsProcessingParameterFeatureSink.
QgsProcessingParameterFile(const QString &name, const QString &description=QString(), Behavior behavior=File, const QString &extension=QString(), const QVariant &defaultValue=QVariant(), bool optional=false)
Constructor for QgsProcessingParameterFile.
Type
The WKB type describes the number of dimensions a geometry has.
static QStringList supportedFormatExtensions(RasterFormatOptions options=SortRecommended)
Returns a list of file extensions for supported formats.
virtual QString toolTip() const
Returns a formatted tooltip for use with the parameter, which gives helpful information like paramete...
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.
static QgsCoordinateReferenceSystem parameterAsPointCrs(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context)
Returns the coordinate reference system associated with an point parameter value. ...
QString valueAsString(const QgsExpressionContext &context, const QString &defaultString=QString(), bool *ok=nullptr) const
Calculates the current value of the property and interprets it as a string.
QStringList dependsOnOtherParameters() const override
Returns a list of other parameter names on which this parameter is dependent (e.g.
static QString typeName()
Returns the type name for the parameter class.
static QString typeName()
Returns the type name for the parameter class.
QVariantMap toVariantMap() const override
Saves this parameter to a QVariantMap.
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=nullptr)
Evaluates the parameter with matching definition to a feature sink.
QgsProperty source
Source definition.
virtual QgsProcessingParameterDefinition * create(const QString &name) const =0
Creates a new parameter of this type.
Type propertyType() const
Returns the property type.
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.
bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
QString type() const override
Unique parameter type name.
An enum based parameter for processing algorithms, allowing for selection from predefined values...
bool loadVariant(const QVariant &property)
Loads this property from a QVariantMap, wrapped in a QVariant.
void setMinimum(double minimum)
Sets the minimum value acceptable by the parameter.
Flags flags() const
Returns any flags associated with the parameter.
QgsProcessing::SourceType dataType() const
Returns the layer type for this created vector layer.
static QString typeName()
Returns the type name for the parameter class.
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.
QVariant defaultValue() const
Returns the default value 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...
bool hasGeometry() const
Returns true if the created layer is likely to include geometries.
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
QgsProcessingParameterDistance * clone() const override
Creates a clone of the parameter definition.
QString asScriptCode() const override
Returns the parameter definition encoded in a string which can be used within a Processing script...
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
QgsProcessingOutputDefinition * toOutputDefinition() const override
Returns a new QgsProcessingOutputDefinition corresponding to the definition of the destination parame...
bool allowMultiple() const
Returns whether multiple band selections are permitted.
QgsGeometry densifyByCount(int extraNodesPerSegment) const
Returns a copy of the geometry which has been densified by adding the specified number of extra nodes...
QString qgsDoubleToString(double a, int precision=17)
Returns a string representation of a double.
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
virtual QString defaultRasterFileExtension() const
Returns the default file extension to use for raster outputs created by the provider.
QVariantMap toVariantMap() const override
Saves this parameter to a QVariantMap.
A double numeric parameter for distance values.
A file output for processing algorithms.
QgsCoordinateReferenceSystem crs
static void logMessage(const QString &message, const QString &tag=QString(), Qgis::MessageLevel level=Qgis::Warning, bool notifyUser=true)
Adds a message to the log instance (and creates it if necessary).
QgsProcessingDestinationParameter(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), bool optional=false, bool createByDefault=true)
Constructor for QgsProcessingDestinationParameter.
QString parentParameterName() const
Returns the name of the parent 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 QgsProcessingParameterScale * fromScriptCode(const QString &name, const QString &description, bool isOptional, const QString &definition)
Creates a new parameter using the definition from a script code.
QgsProcessingAlgorithm * algorithm() const
Returns a pointer to the algorithm which owns this parameter.
Parameter is a single file.
static const QString TEMPORARY_OUTPUT
Constant used to indicate that a Processing algorithm output should be a temporary layer/file...
QString asScriptCode() const override
Returns the parameter definition encoded in a string which can be used within a Processing script...
static QList< double > parameterAsRange(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context)
Evaluates the parameter with matching definition to a range of values.
QString type() const override
Unique parameter type name.
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.
static QStringList supportedFormatExtensions(VectorFormatOptions options=SortRecommended)
Returns a list of file extensions for supported formats, e.g "shp", "gpkg".
bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
virtual QgsMasterLayoutInterface::Type layoutType() const =0
Returns the master layout type.
virtual QString type() const =0
Unique parameter type name.
QString asScriptCode() const override
Returns the parameter definition encoded in a string which can be used within a Processing script...
QgsProcessingOutputDefinition * toOutputDefinition() const override
Returns a new QgsProcessingOutputDefinition corresponding to the definition of the destination parame...
Reads and writes project states.
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.
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
static bool parameterAsBoolean(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, const QgsProcessingContext &context)
Evaluates the parameter with matching definition to a static boolean value.
A vector layer (with or without geometry) parameter for processing algorithms.
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.
bool multiLine() const
Returns true if the parameter allows multiline strings.
virtual QString defaultFileExtension() const =0
Returns the default file extension for destination file paths associated with this parameter...
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
QgsProcessingParameterScale * clone() const override
Creates a clone of the parameter definition.
void setParentLayerParameterName(const QString &parentLayerParameterName)
Sets the name of the parent layer parameter.
void setParentParameterName(const QString &parentParameterName)
Sets the name of the parent layer parameter.
QStringList options() const
Returns the list of acceptable options for the parameter.
A QgsRectangle with associated coordinate reference system.
void setItemType(int type)
Sets the acceptable item type, or -1 if any item type is allowed.
QStringList dependsOnOtherParameters() const override
Returns a list of other parameter names on which this parameter is dependent (e.g.
A print layout item parameter, allowing users to select a particular item from a print layout...
A mesh layer parameter for processing algorithms.
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 coordinate reference system parameter for processing algorithms.
static QgsProcessingFeatureSource * variantToSource(const QVariant &value, QgsProcessingContext &context, const QVariant &fallbackValue=QVariant())
Converts a variant value to a new feature source.
A store for object properties.
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...
A rectangular map extent parameter for processing algorithms.
void setMinimumNumberInputs(int minimum)
Sets the minimum number of layers required for 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...
void setLayerType(QgsProcessing::SourceType type)
Sets the layer type for layers acceptable by the parameter.
void setAllowMultiple(bool allowMultiple)
Sets whether multiple band selections are permitted.
Details for layers to load into projects.
void setAllowMultiple(bool allowMultiple)
Sets whether the parameter allows multiple selected values.
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
A numeric parameter for processing algorithms.
bool loadVariant(const QVariantMap &map)
Loads this output layer definition from a QVariantMap, wrapped in a QVariant.
A generic file based destination parameter, for specifying the destination path for a file (non-map l...
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.
QgsExpressionContext & expressionContext()
Returns the expression context.
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 QgsPrintLayout * parameterAsLayout(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context)
Evaluates the parameter with matching definition to a print layout.
const QgsLayoutManager * layoutManager() const
Returns the project's layout manager, which manages compositions within the project.
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.
void setOptions(const QStringList &options)
Sets the list of acceptable options for the parameter.
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
QString asScriptCode() const override
Returns the parameter definition encoded in a string which can be used within a Processing script...
QString name() const
Returns the name of 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...
QList< int > mDataTypes
List of acceptable data types for the parameter.
Encapsulates settings relating to a feature source input to a processing algorithm.
void setMultiLine(bool multiLine)
Sets whether the parameter allows multiline strings.
QStringList dependsOnOtherParameters() const override
Returns a list of other parameter names on which this parameter is dependent (e.g.
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...
bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
double yMinimum() const
Returns the y minimum value (bottom side of rectangle).
bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
bool supportsNonFileBasedOutput() const
Returns true if the destination parameter supports non filed-based outputs, such as memory layers or ...
Behavior behavior() const
Returns the parameter behavior (e.g.
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.
QString asWkt(int precision=17) const
Exports the geometry to WKT.
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.
static QString generateTempFilename(const QString &basename)
Returns a temporary filename for a given file, putting it into a temporary folder (creating that fold...
QString type() const override
Unique parameter type name.
DistanceUnit
Units of distance.
QVariant toVariant() const
Saves this output layer definition to a QVariantMap, wrapped in a QVariant.
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...
double xMaximum() const
Returns the x maximum value (right side of rectangle).
QString valueAsPythonString(const QVariant &value, QgsProcessingContext &context) const override
Returns a string version of the parameter input value, which is suitable for use as an input paramete...
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
QString 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 defaultVectorFileExtension(bool hasGeometry=true) const
Returns the default file extension to use for vector outputs created by the provider.
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.
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.
Base class for the definition of processing outputs.
void setCreateByDefault(bool createByDefault)
Sets whether the destination should be created by default.
static QString typeName()
Returns the type name for the parameter class.
QVariantMap toVariantMap() const override
Saves this parameter to a QVariantMap.
QgsProcessing::SourceType dataType() const
Returns the layer type for sinks associated with the parameter.
QString defaultFileExtension() const override
Returns the default file extension for destination file paths associated with this parameter...
QgsProcessingParameterLimitedDataTypes(const QList< int > &types=QList< int >())
Constructor for QgsProcessingParameterLimitedDataTypes, with a list of acceptable data types...
void setNumberRows(int rows)
Sets the fixed number of rows in the table.
A vector layer destination parameter, for specifying the destination path for a vector layer created ...
QVariantMap toVariantMap() const override
Saves this parameter to a QVariantMap.
QVariantMap toVariantMap() const override
Saves this parameter to a QVariantMap.
QVariantMap toVariantMap() const override
Saves this parameter to a QVariantMap.
QString parentLayerParameterName() const
Returns the name of the parent layer parameter, or an empty string if this is not set...
A point parameter for processing algorithms.
static QgsMeshLayer * parameterAsMeshLayer(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context)
Evaluates the parameter with matching definition and value to a mesh layer.
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.
void setDataType(DataType type)
Sets the acceptable data type for the field.
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.
QgsPointXY asPoint() const
Returns the contents of the geometry as a 2-dimensional point.
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 asScriptCode() const override
Returns the parameter definition encoded in a string which can be used within a Processing script...
QString asScriptCode() const override
Returns the parameter definition encoded in a string which can be used within a Processing script...
static QgsProcessingParameterString * fromScriptCode(const QString &name, const QString &description, bool isOptional, const QString &definition)
Creates a new parameter using the definition from a script code.
QString source() const
Returns the source for the 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 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...
QString defaultFileExtension() const override
Returns the default file extension for destination file paths associated with this parameter...
An input feature source (such as vector layers) parameter for processing algorithms.
A folder destination parameter, for specifying the destination path for a folder created by the algor...
int valueAsInt(const QgsExpressionContext &context, int defaultValue=0, bool *ok=nullptr) const
Calculates the current value of the property and interprets it as an integer.
QString destinationName
Name to use for sink if it's to be loaded into a destination project.
bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
Flags mFlags
Parameter flags.
static QString typeName()
Returns the type name for the parameter class.
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.
Any map layer type (raster or vector or mesh)
Makes metadata of processing parameters available.
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
QString toolTip() const override
Returns a formatted tooltip for use with the parameter, which gives helpful information like paramete...
QgsProject * destinationProject
Destination project.
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
This class represents a coordinate reference system (CRS).
int numberRows() const
Returns the fixed number of rows in the table.
Base class for the definition of processing parameters.
bool isNull() const
Test if the rectangle is null (all coordinates zero or after call to setMinimal()).
virtual bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const
Checks whether the specified input value is acceptable for the parameter.
static QgsProcessingParameterDefinition * parameterFromScriptCode(const QString &code)
Creates a new QgsProcessingParameterDefinition using the configuration from a supplied script code st...
QVariant staticValue() const
Returns the current static value for the property.
QVariantMap toVariantMap() const override
Saves this parameter to a QVariantMap.
QVariantMap toVariantMap() const override
Saves this parameter to a QVariantMap.
Tables (i.e. vector layers with or without geometry). When used for a sink this indicates the sink ha...
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 double parameterAsDouble(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, const QgsProcessingContext &context)
Evaluates the parameter with matching definition to a static double value.
QVariant mDefault
Default value for parameter.
SourceType
Data source types enum.
static QString parameterAsOutputLayer(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context)
Evaluates the parameter with matching definition to a output layer destination.
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.
double xMinimum() const
Returns the x minimum value (left side of rectangle).
static int parameterAsInt(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, const QgsProcessingContext &context)
Evaluates the parameter with matching definition to a static integer value.
static QString typeName()
Returns the type name for the parameter class.
QString mName
Parameter name.
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
static QgsProcessingFeatureSource * parameterAsSource(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context)
Evaluates the parameter with matching definition to a feature source.
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...
QgsProcessingParameterMeshLayer(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), bool optional=false)
Constructor for QgsProcessingParameterMeshLayer.
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
double yMaximum() const
Returns the y maximum value (top side of rectangle).
Represents a mesh layer supporting display of data on structured or unstructured meshes.
static QString typeName()
Returns the type name for the parameter class.
static bool parameterAsBool(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, const QgsProcessingContext &context)
Evaluates the parameter with matching definition to a static boolean value.
Behavior
Parameter behavior.
virtual QString generateTemporaryDestination() const
Generates a temporary destination value for this parameter.
A folder output for processing algorithms.
static QString typeName()
Returns the type name for the parameter class.
DataType
Field data types.
QString asScriptCode() const override
Returns the parameter definition encoded in a string which can be used within a Processing script...
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
static QgsProcessingParameterPoint * fromScriptCode(const QString &name, const QString &description, bool isOptional, const QString &definition)
Creates a new parameter using the definition from a script code.
QgsProcessingParameterPoint(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), bool optional=false)
Constructor for QgsProcessingParameterPoint.
A table (matrix) parameter for processing algorithms.
Full Python QgsProcessingAlgorithm subclass.
Custom exception class for Coordinate Reference System related exceptions.
Type dataType() const
Returns the acceptable data type for the parameter.
QString type() const override
Unique parameter type name.
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.
Print layout, a QgsLayout subclass for static or atlas-based layouts.
A string parameter for authentication configuration ID values.
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.
virtual QStringList supportedOutputVectorLayerExtensions() const
Returns a list of the vector format file extensions supported by this provider.
QString mDescription
Parameter description.
void setFileFilter(const QString &filter)
Sets the file filter string for file destinations compatible with this parameter. ...
bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
QString asPythonString(QgsProcessing::PythonOutputType outputType=QgsProcessing::PythonQgsProcessingAlgorithmSubclass) const override
Returns the parameter definition as a Python command which can be used within a Python Processing scr...
static QString 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...
bool hasGeometry() const
Returns true if sink is likely to include geometries.
QgsProcessingParameterAuthConfig(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), bool optional=false)
Constructor for QgsProcessingParameterAuthConfig.
Interface for master layout type objects, such as print layouts and reports.
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
QgsProcessingParameterExtent(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), bool optional=false)
Constructor for QgsProcessingParameterExtent.
bool fromVariantMap(const QVariantMap &map) override
Restores this parameter to a QVariantMap.
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)
Constructor for QgsProcessingParameterField.
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
QString asScriptCode() const override
Returns the parameter definition encoded in a string which can be used within a Processing script...
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.
Represents a vector layer which manages a vector based data sets.
static QString parameterAsExpression(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, const QgsProcessingContext &context)
Evaluates the parameter with matching definition to an expression.
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...
QVariantMap toVariantMap() const override
Saves this parameter to a QVariantMap.
Static property (QgsStaticProperty)
Contains information about the context in which a processing algorithm is executed.
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 QString sourceTypeToString(SourceType type)
Converts a source type to a string representation.
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 defaultFileExtension() const override
Returns the default file extension for destination file paths associated with this 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...
void setDataType(QgsProcessing::SourceType type)
Sets the layer type for the created vector layer.
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
A string parameter for processing algorithms.
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
QString valueAsPythonString(const QVariant &value, QgsProcessingContext &context) const override
Returns a string version of the parameter input value, which is suitable for use as an input paramete...
QString description() const
Returns the description for the parameter.
QgsProcessingParameterDefinition * clone() const override
Creates a clone of the parameter definition.
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...
QgsProcessingParameterVectorLayer(const QString &name, const QString &description=QString(), const QList< int > &types=QList< int >(), const QVariant &defaultValue=QVariant(), bool optional=false)
Constructor for QgsProcessingParameterVectorLayer.
void setDataType(QgsProcessing::SourceType type)
Sets the layer type for the sinks associated with the parameter.
Any vector layer with geometry.
QgsProcessingParameterNumber::Type dataType() const
Returns the acceptable data type for the range.
QgsProcessingParameterMatrix(const QString &name, const QString &description=QString(), int numberRows=3, bool hasFixedNumberRows=false, const QStringList &headers=QStringList(), const QVariant &defaultValue=QVariant(), bool optional=false)
Constructor for QgsProcessingParameterMatrix.
QString 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.
bool allowMultiple() const
Returns whether multiple field selections are permitted.
QString authid() const
Returns the authority identifier for the CRS.
QString defaultFileExtension() const override
Returns the default file extension for destination file paths associated with this parameter...
virtual QStringList supportedOutputVectorLayerExtensions() const
Returns a list of the vector format file extensions supported by this parameter.
QString generateTemporaryDestination() const override
Generates a temporary destination value for this parameter.
bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
QgsCoordinateReferenceSystem crs
void setParentLayoutParameterName(const QString &name)
Sets the name of the parent layout parameter.
QgsProcessingParameterRasterLayer(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), bool optional=false)
Constructor for QgsProcessingParameterRasterLayer.
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.
double maximum() const
Returns the maximum value acceptable by the parameter.
QVariantMap createOptions
Map of optional sink/layer creation options, which are passed to the underlying provider when creatin...
Individual print layout (QgsPrintLayout)
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.
QgsProcessingParameterRasterDestination(const QString &name, const QString &description=QString(), const QVariant &defaultValue=QVariant(), bool optional=false, bool createByDefault=true)
Constructor for QgsProcessingParameterRasterDestination.
bool checkValueIsAcceptable(const QVariant &input, QgsProcessingContext *context=nullptr) const override
Checks whether the specified input value is acceptable for the parameter.
QgsProcessingOutputDefinition * toOutputDefinition() const override
Returns a new QgsProcessingOutputDefinition corresponding to the definition of the destination parame...
QString 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.
A raster layer output for processing algorithms.
static QgsProcessingRegistry * processingRegistry()
Returns the application's processing registry, used for managing processing providers, algorithms, and various parameters and outputs.
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.
bool isValid() const
Returns whether this CRS is correctly initialized and usable.
static QStringList parameterAsFields(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context)
Evaluates the parameter with matching definition to a list of fields.
void setHeaders(const QStringList &headers)
Sets the list of column headers.