Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Backport #9640 on release-3_4: [processing] Refine check for usable l…
…ayers (#9642)

* [processing] Refine check for usable layers

- allow WMS layers and other non-GDAL raster layers. This will work
fine for native algorithms, likely not work for other providers. They
will need to be adapted to throw errors when incompatible raster
layer providers are used

- invalid layers are not permitted (e.g. those with missing data
sources)

* Remove outdated comment
  • Loading branch information
backporting[bot] authored and 3nids committed Apr 1, 2019
1 parent 538e790 commit a80535b
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/core/processing/qgsprocessingutils.cpp
Expand Up @@ -314,13 +314,12 @@ QgsProcessingFeatureSource *QgsProcessingUtils::variantToSource( const QVariant

bool QgsProcessingUtils::canUseLayer( const QgsRasterLayer *layer )
{
// only gdal file-based layers
return layer && layer->providerType() == QStringLiteral( "gdal" );
return layer && layer->isValid();
}

bool QgsProcessingUtils::canUseLayer( const QgsVectorLayer *layer, const QList<int> &sourceTypes )
{
return layer &&
return layer && layer->isValid() &&
( sourceTypes.isEmpty()
|| ( sourceTypes.contains( QgsProcessing::TypeVectorPoint ) && layer->geometryType() == QgsWkbTypes::PointGeometry )
|| ( sourceTypes.contains( QgsProcessing::TypeVectorLine ) && layer->geometryType() == QgsWkbTypes::LineGeometry )
Expand Down

0 comments on commit a80535b

Please sign in to comment.