Skip to content
Permalink
Browse files

fix zooming to layers when there are empty layers

  • Loading branch information
jef-n committed Aug 5, 2014
1 parent 9a98ed1 commit 34594136c6df3310be507a676039e42929f5019c
Showing with 5 additions and 4 deletions.
  1. +5 −4 src/gui/layertree/qgslayertreeviewdefaultactions.cpp
@@ -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 )
{
@@ -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() )

0 comments on commit 3459413

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