Skip to content
Permalink
Browse files
Use canvas project extent where appropriate
  • Loading branch information
nyalldawson committed May 21, 2021
1 parent 7bf85a0 commit 7fa74b6b36eb0766569f4e615e944e4b6b2c606e
@@ -433,7 +433,7 @@ void Qgs3DMapConfigWidget::updateMaxZoomLevel()
}
else // flat or online
{
te = mMainCanvas->fullExtent();
te = mMainCanvas->projectExtent();
}

double tile0width = std::max( te.width(), te.height() );
@@ -8174,7 +8174,7 @@ void QgisApp::pan()

void QgisApp::zoomFull()
{
mMapCanvas->zoomToFullExtent();
mMapCanvas->zoomToProjectExtent();
}

void QgisApp::zoomToPrevious()
@@ -13295,7 +13295,7 @@ void QgisApp::new3DMapCanvas()

// initialize from project
QgsProject *prj = QgsProject::instance();
QgsRectangle fullExtent = mMapCanvas->fullExtent();
QgsRectangle fullExtent = mMapCanvas->projectExtent();

// some layers may go crazy and make full extent unusable
// we can't go any further - invalid extent would break everything
@@ -16279,7 +16279,7 @@ void QgisApp::readProject( const QDomDocument &doc )
if ( map->terrainGenerator()->type() == QgsTerrainGenerator::Flat )
{
QgsFlatTerrainGenerator *flatTerrainGen = static_cast<QgsFlatTerrainGenerator *>( map->terrainGenerator() );
flatTerrainGen->setExtent( mMapCanvas->fullExtent() );
flatTerrainGen->setExtent( mMapCanvas->projectExtent() );
}
map->setOutputDpi( QgsApplication::desktop()->logicalDpiX() );

@@ -94,7 +94,7 @@ QgsMapCanvasDockWidget::QgsMapCanvasDockWidget( const QString &name, QWidget *pa
connect( mActionSetCrs, &QAction::triggered, this, &QgsMapCanvasDockWidget::setMapCrs );
connect( mMapCanvas, &QgsMapCanvas::destinationCrsChanged, this, &QgsMapCanvasDockWidget::mapCrsChanged );
connect( mMapCanvas, &QgsMapCanvas::destinationCrsChanged, this, &QgsMapCanvasDockWidget::updateExtentRect );
connect( mActionZoomFullExtent, &QAction::triggered, mMapCanvas, &QgsMapCanvas::zoomToFullExtent );
connect( mActionZoomFullExtent, &QAction::triggered, mMapCanvas, &QgsMapCanvas::zoomToProjectExtent );
connect( mActionZoomToLayers, &QAction::triggered, mMapCanvas, [ = ] { QgisApp::instance()->layerTreeView()->defaultActions()->zoomToLayers( mMapCanvas ); } );
connect( mActionZoomToSelected, &QAction::triggered, mMapCanvas, [ = ] { mMapCanvas->zoomToSelected(); } );
mapCrsChanged();
@@ -93,7 +93,7 @@ void QgsLayerTreeMapCanvasBridge::setCanvasLayers()
if ( firstValidLayers )
{
// if we are moving from zero to non-zero layers, let's zoom to those data (only consider valid layers here!)
mCanvas->zoomToFullExtent();
mCanvas->zoomToProjectExtent();
}

if ( !mFirstCRS.isValid() )
@@ -190,7 +190,7 @@ void QgsLayerTreeMapCanvasBridge::layersAdded( const QList<QgsMapLayer *> &layer
{
mHasValidLayersLoaded = true;
// if we are moving from zero valid layers to non-zero VALID layers, let's zoom to those data
mCanvas->zoomToFullExtent();
mCanvas->zoomToProjectExtent();
}
} );
}
@@ -294,7 +294,7 @@ void QgsMapOverviewCanvas::updateFullExtent()
if ( mSettings.hasValidSettings() )
rect = mSettings.fullExtent();
else
rect = mMapCanvas->fullExtent();
rect = mMapCanvas->projectExtent();
}

// expand a bit to keep features on margin

0 comments on commit 7fa74b6

Please sign in to comment.