mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-15 00:04:00 -04:00
fix zooming to layers when there are empty layers
This commit is contained in:
parent
9a98ed1b97
commit
34594136c6
@ -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() )
|
||||
|
Loading…
x
Reference in New Issue
Block a user