Skip to content

Commit

Permalink
[processing] Refine check for usable layers (#9640)
Browse files Browse the repository at this point in the history
- 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 authored and 3nids committed Mar 28, 2019
1 parent f5a3485 commit 20ec29a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/core/processing/qgsprocessingutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 )
Expand Down

0 comments on commit 20ec29a

Please sign in to comment.