Skip to content

Commit

Permalink
Merge pull request #636 from vinayan/zoomlayerextent
Browse files Browse the repository at this point in the history
[Fix #7333] - Zoom to layer does not work anymore for newly created shapefiles
  • Loading branch information
NathanW2 committed Jun 5, 2013
2 parents c1fb1bb + 74b18e5 commit e7ea582
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/app/legend/qgslegend.cpp
Expand Up @@ -2675,6 +2675,15 @@ void QgsLegend::legendLayerZoom()
QgsMapLayer* theLayer = currentLayer->layer();
extent = theLayer->extent();

QgsVectorLayer* vLayer = qobject_cast<QgsVectorLayer*>( theLayer );

if ( extent.isEmpty() && vLayer )
{
vLayer->updateExtents();
extent = vLayer->extent();
}


//transform extent if otf-projection is on
if ( mMapCanvas->hasCrsTransformEnabled() )
{
Expand All @@ -2697,6 +2706,14 @@ void QgsLegend::legendLayerZoom()
QgsMapLayer* theLayer = layers.at( i )->layer();
layerExtent = theLayer->extent();

QgsVectorLayer* vLayer = qobject_cast<QgsVectorLayer*>( theLayer );

if ( extent.isEmpty() && vLayer )
{
vLayer->updateExtents();
layerExtent = vLayer->extent();
}

//transform extent if otf-projection is on
if ( mMapCanvas->hasCrsTransformEnabled() )
{
Expand Down

0 comments on commit e7ea582

Please sign in to comment.