266 return QList< int >();
268 QList< int > resultList;
269 const QVariant val = value;
272 if ( val.userType() == qMetaTypeId<QgsProperty>() )
274 else if ( val.userType() == QMetaType::Type::QVariantList )
276 const QVariantList list = val.toList();
277 for (
auto it = list.constBegin(); it != list.constEnd(); ++it )
278 resultList << it->toInt();
282 const QStringList parts = val.toString().split(
';' );
283 for (
auto it = parts.constBegin(); it != parts.constEnd(); ++it )
284 resultList << it->toInt();
288 if ( resultList.isEmpty() )
293 if ( definition->
defaultValue().userType() == QMetaType::Type::QVariantList )
295 const QVariantList list = definition->
defaultValue().toList();
296 for (
auto it = list.constBegin(); it != list.constEnd(); ++it )
297 resultList << it->toInt();
301 const QStringList parts = definition->
defaultValue().toString().split(
';' );
302 for (
auto it = parts.constBegin(); it != parts.constEnd(); ++it )
303 resultList << it->toInt();
463 QVariantList resultList;
464 const QVariant val = value;
465 if ( val.userType() == qMetaTypeId<QgsProperty>() )
467 else if ( val.userType() == QMetaType::Type::QVariantList )
469 const auto constToList = val.toList();
470 for (
const QVariant &var : constToList )
473 else if ( val.userType() == QMetaType::Type::QString )
475 const auto constSplit = val.toString().split(
',' );
476 for (
const QString &var : constSplit )
482 if ( resultList.isEmpty() )
483 return QList< int >();
485 if ( ( !val.isValid() || !resultList.at( 0 ).isValid() ) && definition )
489 if ( definition->
defaultValue().userType() == QMetaType::Type::QVariantList )
491 const auto constToList = definition->
defaultValue().toList();
492 for (
const QVariant &var : constToList )
495 else if ( definition->
defaultValue().userType() == QMetaType::Type::QString )
497 const auto constSplit = definition->
defaultValue().toString().split(
',' );
498 for (
const QString &var : constSplit )
507 const auto constResultList = resultList;
508 for (
const QVariant &var : constResultList )
510 const int resInt = var.toInt();
511 if ( !enumDef || resInt < enumDef->options().size() )
551 return QStringList();
553 const QVariant val = value;
555 QStringList enumValues;
557 std::function< void(
const QVariant &var ) > processVariant;
558 processVariant = [ &enumValues, &context, &definition, &processVariant ](
const QVariant & var )
560 if ( var.userType() == QMetaType::Type::QVariantList )
562 const auto constToList = var.toList();
563 for (
const QVariant &listVar : constToList )
565 processVariant( listVar );
568 else if ( var.userType() == QMetaType::Type::QStringList )
570 const auto constToStringList = var.toStringList();
571 for (
const QString &s : constToStringList )
576 else if ( var.userType() == qMetaTypeId<QgsProperty>() )
580 const QStringList parts = var.toString().split(
',' );
581 for (
const QString &s : parts )
588 processVariant( val );
594 const QStringList options = enumDef->
options();
595 const QSet<QString> subtraction = QSet<QString>( enumValues.begin(), enumValues.end() ).subtract( QSet<QString>( options.begin(), options.end() ) );
597 if ( enumValues.isEmpty() || !subtraction.isEmpty() )
669QgsFeatureSink *
QgsProcessingParameters::parameterAsSink(
const QgsProcessingParameterDefinition *definition,
const QVariant &value,
const QgsFields &fields,
Qgis::WkbType geometryType,
const QgsCoordinateReferenceSystem &
crs,
QgsProcessingContext &context, QString &destinationIdentifier,
QgsFeatureSink::SinkFlags sinkFlags,
const QVariantMap &createOptions,
const QStringList &datasourceOptions,
const QStringList &layerOptions )
671 QVariantMap options = createOptions;
672 QVariant val = value;
677 bool useRemapDefinition =
false;
678 if ( val.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
689 useRemapDefinition =
true;
695 if ( definition && val.userType() == qMetaTypeId<QgsProperty>() )
699 else if ( !val.isValid() || val.toString().isEmpty() )
715 dest = val.toString();
720 dest = destParam->generateTemporaryDestination( &context );
723 if ( dest.isEmpty() )
726 std::unique_ptr< QgsFeatureSink > sink(
QgsProcessingUtils::createFeatureSink( dest, context, fields, geometryType,
crs, options, datasourceOptions, layerOptions, sinkFlags, useRemapDefinition ? &remapDefinition : nullptr ) );
727 destinationIdentifier = dest;
729 if ( destinationProject )
731 if ( destName.isEmpty() && definition )
737 outputName = definition->
name();
741 return sink.release();
765 QVariant val = parameters.value( definition->
name() );
767 bool selectedFeaturesOnly =
false;
768 long long featureLimit = -1;
769 QString filterExpression;
770 if ( val.userType() == qMetaTypeId<QgsProcessingFeatureSourceDefinition>() )
779 else if ( val.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
786 if ( val.userType() == qMetaTypeId<QgsProperty>() )
792 vl = qobject_cast< QgsVectorLayer * >( qvariant_cast<QObject *>( val ) );
797 if ( val.userType() == qMetaTypeId<QgsProperty>() )
801 else if ( !val.isValid() || val.toString().isEmpty() )
807 vl = qobject_cast< QgsVectorLayer * >( qvariant_cast<QObject *>( val ) );
813 layerRef = val.toString();
818 if ( layerRef.isEmpty() )
830 compatibleFormats, preferredFormat, context, feedback, *layerName, featureLimit, filterExpression );
833 compatibleFormats, preferredFormat, context, feedback, featureLimit, filterExpression );
1085 QVariant val = value;
1087 if ( val.userType() == qMetaTypeId<QgsRectangle>() )
1091 if ( val.userType() == qMetaTypeId< QgsGeometry>() )
1097 if ( val.userType() == qMetaTypeId<QgsReferencedRectangle>() )
1116 if ( val.userType() == qMetaTypeId<QgsProcessingFeatureSourceDefinition>() )
1122 else if ( val.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
1135 QgsMapLayer *layer = qobject_cast< QgsMapLayer * >( qvariant_cast<QObject *>( val ) );
1138 if ( val.userType() == qMetaTypeId<QgsProperty>() )
1141 rectText = val.toString();
1143 if ( rectText.isEmpty() && !layer )
1146 const thread_local QRegularExpression rx( QStringLiteral(
"^(.*?)\\s*,\\s*(.*?),\\s*(.*?),\\s*(.*?)\\s*(?:\\[(.*)\\])?\\s*$" ) );
1147 const QRegularExpressionMatch match = rx.match( rectText );
1148 if ( match.hasMatch() )
1150 bool xMinOk =
false;
1151 const double xMin = match.captured( 1 ).toDouble( &xMinOk );
1152 bool xMaxOk =
false;
1153 const double xMax = match.captured( 2 ).toDouble( &xMaxOk );
1154 bool yMinOk =
false;
1155 const double yMin = match.captured( 3 ).toDouble( &yMinOk );
1156 bool yMaxOk =
false;
1157 const double yMax = match.captured( 4 ).toDouble( &yMaxOk );
1158 if ( xMinOk && xMaxOk && yMinOk && yMaxOk )
1209 QVariant val = parameters.value( definition->
name() );
1211 if ( val.userType() == qMetaTypeId<QgsReferencedRectangle>() )
1217 g = g.densifyByCount( 20 );
1231 if ( val.userType() == qMetaTypeId<QgsProcessingFeatureSourceDefinition>() )
1237 else if ( val.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
1250 if ( val.userType() == qMetaTypeId<QgsProperty>() )
1253 rectText = val.toString();
1255 if ( !rectText.isEmpty() )
1257 const thread_local QRegularExpression rx( QStringLiteral(
"^(.*?)\\s*,\\s*(.*?),\\s*(.*?),\\s*(.*?)\\s*(?:\\[(.*)\\])?\\s*$" ) );
1258 const QRegularExpressionMatch match = rx.match( rectText );
1259 if ( match.hasMatch() )
1261 bool xMinOk =
false;
1262 const double xMin = match.captured( 1 ).toDouble( &xMinOk );
1263 bool xMaxOk =
false;
1264 const double xMax = match.captured( 2 ).toDouble( &xMaxOk );
1265 bool yMinOk =
false;
1266 const double yMin = match.captured( 3 ).toDouble( &yMinOk );
1267 bool yMaxOk =
false;
1268 const double yMax = match.captured( 4 ).toDouble( &yMaxOk );
1269 if ( xMinOk && xMaxOk && yMinOk && yMaxOk )
1295 QgsMapLayer *layer = qobject_cast< QgsMapLayer * >( qvariant_cast<QObject *>( val ) );
1330 QVariant val = value;
1331 if ( val.userType() == qMetaTypeId<QgsReferencedRectangle>() )
1340 if ( val.userType() == qMetaTypeId<QgsProcessingFeatureSourceDefinition>() )
1346 else if ( val.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
1358 QString valueAsString;
1359 if ( val.userType() == qMetaTypeId<QgsProperty>() )
1362 valueAsString = val.toString();
1364 const thread_local QRegularExpression rx( QStringLiteral(
"^(.*?)\\s*,\\s*(.*?),\\s*(.*?),\\s*(.*?)\\s*(?:\\[(.*)\\])?\\s*$" ) );
1366 const QRegularExpressionMatch match = rx.match( valueAsString );
1367 if ( match.hasMatch() )
1374 if ( val.userType() == qMetaTypeId<QgsProcessingFeatureSourceDefinition>() )
1380 else if ( val.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
1393 if (
QgsMapLayer *layer = qobject_cast< QgsMapLayer * >( qvariant_cast<QObject *>( val ) ) )
1394 return layer->crs();
1396 return layer->crs();
1398 if (
auto *lProject = context.
project() )
1399 return lProject->crs();
1772 return QList<QgsMapLayer *>();
1774 const QVariant val = value;
1775 if (
QgsMapLayer *layer = qobject_cast< QgsMapLayer * >( qvariant_cast<QObject *>( val ) ) )
1777 return QList<QgsMapLayer *>() << layer;
1780 QList<QgsMapLayer *> layers;
1782 std::function< void(
const QVariant &var ) > processVariant;
1783 processVariant = [ &layers, &context, &definition, flags, &processVariant](
const QVariant & var )
1785 if ( var.userType() == QMetaType::Type::QVariantList )
1787 const auto constToList = var.toList();
1788 for (
const QVariant &listVar : constToList )
1790 processVariant( listVar );
1793 else if ( var.userType() == QMetaType::Type::QStringList )
1795 const auto constToStringList = var.toStringList();
1796 for (
const QString &s : constToStringList )
1798 processVariant( s );
1801 else if ( var.userType() == qMetaTypeId<QgsProperty>() )
1803 else if ( var.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
1807 const QVariant sink = fromVar.
sink;
1808 if ( sink.userType() == qMetaTypeId<QgsProperty>() )
1813 else if (
QgsMapLayer *layer = qobject_cast< QgsMapLayer * >( qvariant_cast<QObject *>( var ) ) )
1825 processVariant( val );
1827 if ( layers.isEmpty() )
1830 if (
QgsMapLayer *layer = qobject_cast< QgsMapLayer * >( qvariant_cast<QObject *>( definition->
defaultValue() ) ) )
1834 else if ( definition->
defaultValue().userType() == QMetaType::Type::QVariantList )
1836 const auto constToList = definition->
defaultValue().toList();
1837 for (
const QVariant &var : constToList )
1839 if (
QgsMapLayer *layer = qobject_cast< QgsMapLayer * >( qvariant_cast<QObject *>( var ) ) )
1845 processVariant( var );
1921 return QList<double>();
1923 QStringList resultStringList;
1924 const QVariant val = value;
1926 if ( val.userType() == qMetaTypeId<QgsProperty>() )
1928 else if ( val.userType() == QMetaType::Type::QVariantList )
1930 const auto constToList = val.toList();
1931 for (
const QVariant &var : constToList )
1932 resultStringList << var.toString();
1935 resultStringList << val.toString();
1937 if ( ( resultStringList.isEmpty() || ( resultStringList.size() == 1 && resultStringList.at( 0 ).isEmpty() ) ) )
1939 resultStringList.clear();
1941 if ( definition->
defaultValue().userType() == QMetaType::Type::QVariantList )
1943 const auto constToList = definition->
defaultValue().toList();
1944 for (
const QVariant &var : constToList )
1945 resultStringList << var.toString();
1948 resultStringList << definition->
defaultValue().toString();
1951 if ( resultStringList.size() == 1 )
1953 resultStringList = resultStringList.at( 0 ).split(
',' );
1956 if ( resultStringList.size() < 2 )
1957 return QList< double >() << std::numeric_limits<double>::quiet_NaN() << std::numeric_limits<double>::quiet_NaN() ;
1959 QList< double > result;
1961 double n = resultStringList.at( 0 ).toDouble( &ok );
1965 result << std::numeric_limits<double>::quiet_NaN() ;
1967 n = resultStringList.at( 1 ).toDouble( &ok );
1971 result << std::numeric_limits<double>::quiet_NaN() ;
2000 return QStringList();
2002 QStringList resultStringList;
2003 const QVariant val = value;
2004 if ( val.isValid() )
2006 if ( val.userType() == qMetaTypeId<QgsProperty>() )
2008 else if ( val.userType() == QMetaType::Type::QVariantList )
2010 const auto constToList = val.toList();
2011 for (
const QVariant &var : constToList )
2012 resultStringList << var.toString();
2014 else if ( val.userType() == QMetaType::Type::QStringList )
2016 resultStringList = val.toStringList();
2019 resultStringList.append( val.toString().split(
';' ) );
2022 if ( ( resultStringList.isEmpty() || resultStringList.at( 0 ).isEmpty() ) )
2024 resultStringList.clear();
2028 if ( definition->
defaultValue().userType() == QMetaType::Type::QVariantList )
2030 const auto constToList = definition->
defaultValue().toList();
2031 for (
const QVariant &var : constToList )
2032 resultStringList << var.toString();
2034 else if ( definition->
defaultValue().userType() == QMetaType::Type::QStringList )
2036 resultStringList = definition->
defaultValue().toStringList();
2039 resultStringList.append( definition->
defaultValue().toString().split(
';' ) );
2043 return resultStringList;
2308 bool isOptional =
false;
2312 if ( !parseScriptCodeParameterOptions( code, isOptional, name, type, definition ) )
2317 if ( type == QLatin1String(
"boolean" ) )
2319 else if ( type == QLatin1String(
"crs" ) )
2321 else if ( type == QLatin1String(
"layer" ) )
2323 else if ( type == QLatin1String(
"extent" ) )
2325 else if ( type == QLatin1String(
"point" ) )
2327 else if ( type == QLatin1String(
"geometry" ) )
2329 else if ( type == QLatin1String(
"file" ) )
2331 else if ( type == QLatin1String(
"folder" ) )
2333 else if ( type == QLatin1String(
"matrix" ) )
2335 else if ( type == QLatin1String(
"multiple" ) )
2337 else if ( type == QLatin1String(
"number" ) )
2339 else if ( type == QLatin1String(
"distance" ) )
2341 else if ( type == QLatin1String(
"area" ) )
2343 else if ( type == QLatin1String(
"volume" ) )
2345 else if ( type == QLatin1String(
"duration" ) )
2347 else if ( type == QLatin1String(
"scale" ) )
2349 else if ( type == QLatin1String(
"range" ) )
2351 else if ( type == QLatin1String(
"raster" ) )
2353 else if ( type == QLatin1String(
"enum" ) )
2355 else if ( type == QLatin1String(
"string" ) )
2357 else if ( type == QLatin1String(
"authcfg" ) )
2359 else if ( type == QLatin1String(
"expression" ) )
2361 else if ( type == QLatin1String(
"field" ) )
2363 else if ( type == QLatin1String(
"vector" ) )
2365 else if ( type == QLatin1String(
"source" ) )
2367 else if ( type == QLatin1String(
"sink" ) )
2369 else if ( type == QLatin1String(
"vectordestination" ) )
2371 else if ( type == QLatin1String(
"rasterdestination" ) )
2373 else if ( type == QLatin1String(
"pointclouddestination" ) )
2375 else if ( type == QLatin1String(
"filedestination" ) )
2377 else if ( type == QLatin1String(
"folderdestination" ) )
2379 else if ( type == QLatin1String(
"band" ) )
2381 else if ( type == QLatin1String(
"mesh" ) )
2383 else if ( type == QLatin1String(
"layout" ) )
2385 else if ( type == QLatin1String(
"layoutitem" ) )
2387 else if ( type == QLatin1String(
"color" ) )
2389 else if ( type == QLatin1String(
"coordinateoperation" ) )
2391 else if ( type == QLatin1String(
"maptheme" ) )
2393 else if ( type == QLatin1String(
"datetime" ) )
2395 else if ( type == QLatin1String(
"providerconnection" ) )
2397 else if ( type == QLatin1String(
"databaseschema" ) )
2399 else if ( type == QLatin1String(
"databasetable" ) )
2401 else if ( type == QLatin1String(
"pointcloud" ) )
2403 else if ( type == QLatin1String(
"annotation" ) )
2405 else if ( type == QLatin1String(
"attribute" ) )
2407 else if ( type == QLatin1String(
"vectortiledestination" ) )
2525 if ( !value.isValid() )
2529 if ( value.userType() == QMetaType::Type::QVariantMap )
2531 const QVariantMap sourceMap = value.toMap();
2532 QVariantMap resultMap;
2533 for (
auto it = sourceMap.constBegin(); it != sourceMap.constEnd(); it++ )
2539 else if ( value.userType() == QMetaType::Type::QVariantList || value.userType() == QMetaType::Type::QStringList )
2541 const QVariantList sourceList = value.toList();
2542 QVariantList resultList;
2543 resultList.reserve( sourceList.size() );
2544 for (
const QVariant &v : sourceList )
2552 switch ( value.userType() )
2555 case QMetaType::Bool:
2556 case QMetaType::Char:
2557 case QMetaType::Int:
2558 case QMetaType::Double:
2559 case QMetaType::Float:
2560 case QMetaType::LongLong:
2561 case QMetaType::ULongLong:
2562 case QMetaType::UInt:
2563 case QMetaType::ULong:
2564 case QMetaType::UShort:
2571 if ( value.userType() == qMetaTypeId<QgsProperty>() )
2581 return QVariantMap( {{QStringLiteral(
"type" ), QStringLiteral(
"data_defined" )}, {QStringLiteral(
"field" ), prop.
field() }} );
2583 return QVariantMap( {{QStringLiteral(
"type" ), QStringLiteral(
"data_defined" )}, {QStringLiteral(
"expression" ), prop.
expressionString() }} );
2588 if ( value.userType() == qMetaTypeId<QgsCoordinateReferenceSystem>() )
2598 else if ( value.userType() == qMetaTypeId<QgsRectangle>() )
2606 else if ( value.userType() == qMetaTypeId<QgsReferencedRectangle>() )
2615 else if ( value.userType() == qMetaTypeId< QgsGeometry>() )
2627 else if ( value.userType() == qMetaTypeId<QgsReferencedGeometry>() )
2642 else if ( value.userType() == qMetaTypeId<QgsPointXY>() )
2648 else if ( value.userType() == qMetaTypeId<QgsReferencedPointXY>() )
2655 else if ( value.userType() == qMetaTypeId<QgsProcessingFeatureSourceDefinition>() )
2662 else if ( value.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
2667 else if ( value.userType() == qMetaTypeId<QColor>() )
2669 const QColor fromVar = value.value< QColor >();
2670 if ( !fromVar.isValid() )
2673 return QStringLiteral(
"rgba( %1, %2, %3, %4 )" ).arg( fromVar.red() ).arg( fromVar.green() ).arg( fromVar.blue() ).arg( QString::number( fromVar.alphaF(),
'f', 2 ) );
2675 else if ( value.userType() == qMetaTypeId<QDateTime>() )
2677 const QDateTime fromVar = value.toDateTime();
2678 if ( !fromVar.isValid() )
2681 return fromVar.toString( Qt::ISODate );
2683 else if ( value.userType() == qMetaTypeId<QDate>() )
2685 const QDate fromVar = value.toDate();
2686 if ( !fromVar.isValid() )
2689 return fromVar.toString( Qt::ISODate );
2691 else if ( value.userType() == qMetaTypeId<QTime>() )
2693 const QTime fromVar = value.toTime();
2694 if ( !fromVar.isValid() )
2697 return fromVar.toString( Qt::ISODate );
2704 p.insert(
name(), value );
2712 if ( value.userType() == QMetaType::QString )
2717 Q_ASSERT_X(
false,
"QgsProcessingParameterDefinition::valueAsJsonObject", QStringLiteral(
"unsupported variant type %1" ).arg( QMetaType::typeName( value.userType() ) ).toLocal8Bit() );
2730 if ( !value.isValid() )
2733 switch ( value.userType() )
2736 case QMetaType::Bool:
2737 case QMetaType::Char:
2738 case QMetaType::Int:
2739 case QMetaType::Double:
2740 case QMetaType::Float:
2741 case QMetaType::LongLong:
2742 case QMetaType::ULongLong:
2743 case QMetaType::UInt:
2744 case QMetaType::ULong:
2745 case QMetaType::UShort:
2746 return value.toString();
2752 if ( value.userType() == qMetaTypeId<QgsProperty>() )
2762 return QStringLiteral(
"field:%1" ).arg( prop.
field() );
2769 if ( value.userType() == qMetaTypeId<QgsCoordinateReferenceSystem>() )
2779 else if ( value.userType() == qMetaTypeId<QgsRectangle>() )
2787 else if ( value.userType() == qMetaTypeId<QgsReferencedRectangle>() )
2795 else if ( value.userType() == qMetaTypeId< QgsGeometry>() )
2807 else if ( value.userType() == qMetaTypeId<QgsReferencedGeometry>() )
2822 else if ( value.userType() == qMetaTypeId<QgsPointXY>() )
2828 else if ( value.userType() == qMetaTypeId<QgsReferencedPointXY>() )
2835 else if ( value.userType() == qMetaTypeId<QgsProcessingFeatureSourceDefinition>() )
2840 else if ( value.userType() == qMetaTypeId<QgsProcessingOutputLayerDefinition>() )
2845 else if ( value.userType() == qMetaTypeId<QColor>() )
2847 const QColor fromVar = value.value< QColor >();
2848 if ( !fromVar.isValid() )
2851 return QStringLiteral(
"rgba( %1, %2, %3, %4 )" ).arg( fromVar.red() ).arg( fromVar.green() ).arg( fromVar.blue() ).arg( QString::number( fromVar.alphaF(),
'f', 2 ) );
2853 else if ( value.userType() == qMetaTypeId<QDateTime>() )
2855 const QDateTime fromVar = value.toDateTime();
2856 if ( !fromVar.isValid() )
2859 return fromVar.toString( Qt::ISODate );
2861 else if ( value.userType() == qMetaTypeId<QDate>() )
2863 const QDate fromVar = value.toDate();
2864 if ( !fromVar.isValid() )
2867 return fromVar.toString( Qt::ISODate );
2869 else if ( value.userType() == qMetaTypeId<QTime>() )
2871 const QTime fromVar = value.toTime();
2872 if ( !fromVar.isValid() )
2875 return fromVar.toString( Qt::ISODate );
2882 p.insert(
name(), value );
2890 if ( value.userType() == QMetaType::QString )
2891 return value.toString();
2894 QgsDebugError( QStringLiteral(
"unsupported variant type %1" ).arg( QMetaType::typeName( value.userType() ) ) );
2896 return value.toString();
3345 QString def = definition;
3348 if ( def.startsWith( QLatin1String(
"hasgeometry" ), Qt::CaseInsensitive ) )
3351 def = def.mid( 12 );
3354 else if ( def.startsWith( QLatin1String(
"point" ), Qt::CaseInsensitive ) )
3360 else if ( def.startsWith( QLatin1String(
"line" ), Qt::CaseInsensitive ) )
3366 else if ( def.startsWith( QLatin1String(
"polygon" ), Qt::CaseInsensitive ) )
3372 else if ( def.startsWith( QLatin1String(
"raster" ), Qt::CaseInsensitive ) )
3378 else if ( def.startsWith( QLatin1String(
"mesh" ), Qt::CaseInsensitive ) )
3384 else if ( def.startsWith( QLatin1String(
"plugin" ), Qt::CaseInsensitive ) )
3390 else if ( def.startsWith( QLatin1String(
"pointcloud" ), Qt::CaseInsensitive ) )
3393 def = def.mid( 11 );
3396 else if ( def.startsWith( QLatin1String(
"annotation" ), Qt::CaseInsensitive ) )
3399 def = def.mid( 11 );
3748 if ( !input.isValid() )
3756 if ( input.userType() == qMetaTypeId<QgsProperty>() )
3763 if ( input.userType() == qMetaTypeId< QgsGeometry>() )
3765 return ( anyTypeAllowed || mGeomTypes.contains(
static_cast< int >( input.value<
QgsGeometry>().
type() ) ) ) &&
3766 ( mAllowMultipart || !input.value<
QgsGeometry>().isMultipart() );
3769 if ( input.userType() == qMetaTypeId<QgsReferencedGeometry>() )
3775 if ( input.userType() == qMetaTypeId<QgsPointXY>() )
3780 if ( input.userType() == qMetaTypeId<QgsRectangle>() )
3785 if ( input.userType() == qMetaTypeId<QgsReferencedPointXY>() )
3790 if ( input.userType() == qMetaTypeId<QgsReferencedRectangle>() )
3795 if ( input.userType() == QMetaType::Type::QString )
3797 if ( input.toString().isEmpty() )
3802 const thread_local QRegularExpression rx( QStringLiteral(
"^\\s*(?:CRS=(.*);)?(.*?)$" ) );
3804 const QRegularExpressionMatch match = rx.match( input.toString() );
3805 if ( match.hasMatch() )
3810 return ( anyTypeAllowed || mGeomTypes.contains(
static_cast< int >( g.
type() ) ) ) && ( mAllowMultipart || !g.
isMultipart() );
4310 if ( !input.isValid() )
4320 if ( qobject_cast< QgsMapLayer * >( qvariant_cast<QObject *>( input ) ) )
4326 if ( input.userType() == QMetaType::Type::QString )
4328 if ( input.toString().isEmpty() )
4331 if ( mMinimumNumberInputs > 1 )
4342 else if ( input.userType() == QMetaType::Type::QVariantList )
4344 if ( input.toList().count() < mMinimumNumberInputs )
4347 if ( mMinimumNumberInputs > input.toList().count() )
4355 const auto constToList = input.toList();
4356 for (
const QVariant &v : constToList )
4358 if ( qobject_cast< QgsMapLayer * >( qvariant_cast<QObject *>( v ) ) )
4367 else if ( input.userType() == QMetaType::Type::QStringList )
4369 if ( input.toStringList().count() < mMinimumNumberInputs )
4372 if ( mMinimumNumberInputs > input.toStringList().count() )
4380 const auto constToStringList = input.toStringList();
4381 for (
const QString &v : constToStringList )
4977 QVariant input = value;
4978 if ( !input.isValid() )
4986 if ( input.userType() == qMetaTypeId<QgsProperty>() )
4991 if ( mUsesStaticStrings )
4993 if ( input.userType() == QMetaType::Type::QVariantList )
4995 if ( !mAllowMultiple )
4998 const QVariantList values = input.toList();
5002 for (
const QVariant &val : values )
5004 if ( !mOptions.contains( val.toString() ) )
5010 else if ( input.userType() == QMetaType::Type::QStringList )
5012 if ( !mAllowMultiple )
5015 const QStringList values = input.toStringList();
5020 if ( values.count() > 1 && !mAllowMultiple )
5023 for (
const QString &val : values )
5025 if ( !mOptions.contains( val ) )
5030 else if ( input.userType() == QMetaType::Type::QString )
5032 const QStringList parts = input.toString().split(
',' );
5033 if ( parts.count() > 1 && !mAllowMultiple )
5036 const auto constParts = parts;
5037 for (
const QString &part : constParts )
5039 if ( !mOptions.contains( part ) )
5047 if ( input.userType() == QMetaType::Type::QVariantList )
5049 if ( !mAllowMultiple )