Skip to content
Permalink
Browse files

avoid reloading not rendered layers on map refresh

  • Loading branch information
jef-n committed Jun 24, 2015
1 parent feb8d38 commit ea71b2c0c7e50f56bc349cb9646f7fdfca9415f2
Showing with 26 additions and 6 deletions.
  1. +4 −0 python/gui/qgsmapcanvas.sip
  2. +1 −6 src/app/qgisapp.cpp
  3. +17 −0 src/gui/qgsmapcanvas.cpp
  4. +4 −0 src/gui/qgsmapcanvas.h
@@ -84,6 +84,10 @@ class QgsMapCanvas : QGraphicsView
//! @note added in 2.4
void clearCache();

//! Reload all layers, clear the cache and refresh the canvas
//! @note added in 2.9
void refreshAllLayers();

//! Set whether the layers are rendered in parallel or sequentially
//! @note added in 2.4
void setParallelRenderingEnabled( bool enabled );
@@ -6635,12 +6635,7 @@ void QgisApp::refreshMapCanvas()
//stop any current rendering
mMapCanvas->stopRendering();

//reload cached provider data
QgsMapLayerRegistry::instance()->reloadAllLayers();

mMapCanvas->clearCache();
//then refresh
mMapCanvas->refresh();
mMapCanvas->refreshAllLayers();
}

void QgisApp::canvasRefreshStarted()
@@ -1966,3 +1966,20 @@ void QgsMapCanvas::enableRotation( bool enable )
{
QSettings().setValue( "/qgis/canvasRotation", enable );
}

void QgsMapCanvas::refreshAllLayers()
{
// reload all layers in canvas
for ( int i = 0; i < layerCount(); i++ )
{
QgsMapLayer *l = layer( i );
if ( l )
l->reload();
}

// clear the cache
clearCache();

// and then refresh
refresh();
}
@@ -154,6 +154,10 @@ class GUI_EXPORT QgsMapCanvas : public QGraphicsView
//! @note added in 2.4
void clearCache();

//! Reload all layers, clear the cache and refresh the canvas
//! @note added in 2.9
void refreshAllLayers();

//! Set whether the layers are rendered in parallel or sequentially
//! @note added in 2.4
void setParallelRenderingEnabled( bool enabled );

0 comments on commit ea71b2c

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