Skip to content

Commit

Permalink
fix zooming to layers when there are empty layers
Browse files Browse the repository at this point in the history
  • Loading branch information
jef-n committed Aug 5, 2014
1 parent 9a98ed1 commit 3459413
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/gui/layertree/qgslayertreeviewdefaultactions.cpp
Expand Up @@ -192,6 +192,7 @@ void QgsLayerTreeViewDefaultActions::zoomToGroup()
void QgsLayerTreeViewDefaultActions::zoomToLayers( QgsMapCanvas* canvas, const QList<QgsMapLayer*>& layers )
{
QgsRectangle extent;
extent.setMinimal();

for ( int i = 0; i < layers.size(); ++i )
{
Expand All @@ -208,14 +209,14 @@ void QgsLayerTreeViewDefaultActions::zoomToLayers( QgsMapCanvas* canvas, const Q
layerExtent = vLayer->extent();
}

if ( layerExtent.isNull() )
continue;

//transform extent if otf-projection is on
if ( canvas->hasCrsTransformEnabled() )
layerExtent = canvas->mapSettings().layerExtentToOutputExtent( layer, layerExtent );

if ( i == 0 )
extent = layerExtent;
else
extent.combineExtentWith( &layerExtent );
extent.combineExtentWith( &layerExtent );
}

if ( extent.isNull() )
Expand Down

0 comments on commit 3459413

Please sign in to comment.