Skip to content
Permalink
Browse files

[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)
  • Loading branch information
nyalldawson committed Mar 28, 2019
1 parent 7590009 commit 7c3edf1e07283b09d349d8d4251b0adc3996d64b
Showing with 2 additions and 2 deletions.
  1. +2 −2 src/core/processing/qgsprocessingutils.cpp
@@ -368,12 +368,12 @@ bool QgsProcessingUtils::canUseLayer( const QgsMeshLayer *layer )
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 )

0 comments on commit 7c3edf1

Please sign in to comment.
You can’t perform that action at this time.