Skip to content
Permalink
Browse files

Allow vector rendering cancelation to also cancel feature iteration f…

…or that request

Connect the cancel rendering signal to the iteration cancelation.
This allows providers (e.g. WFS, AFS) to abort slow network requests
when they have been triggered by a render request and that request
is no longer required.

Allows much faster quit, render cancelation when using WFS/AFS layers.

(cherry picked from commit 6fa3bf8)
  • Loading branch information
nyalldawson committed Feb 1, 2019
1 parent fad0861 commit f5ca7b7453444aee31cf8a6cf054ffa89b6e8bcf
Showing with 8 additions and 3 deletions.
  1. +6 −2 src/core/qgsvectorlayerrenderer.cpp
  2. +2 −1 src/core/qgsvectorlayerrenderer.h
@@ -42,7 +42,7 @@
QgsVectorLayerRenderer::QgsVectorLayerRenderer( QgsVectorLayer *layer, QgsRenderContext &context )
: QgsMapLayerRenderer( layer->id() )
, mContext( context )
, mInterruptionChecker( context )
, mInterruptionChecker( qgis::make_unique< QgsVectorLayerRendererInterruptionChecker >( context ) )
, mLayer( layer )
, mFields( layer->fields() )
, mLabeling( false )
@@ -106,6 +106,10 @@ QgsVectorLayerRenderer::~QgsVectorLayerRenderer()
delete mSource;
}

QgsFeedback *QgsVectorLayerRenderer::feedback() const
{
return mInterruptionChecker.get();
}

bool QgsVectorLayerRenderer::render()
{
@@ -239,7 +243,7 @@ bool QgsVectorLayerRenderer::render()
// slow fetchFeature() implementations, such as in the WFS provider, can
// check it, instead of relying on just the mContext.renderingStopped() check
// in drawRenderer()
fit.setInterruptionChecker( &mInterruptionChecker );
fit.setInterruptionChecker( mInterruptionChecker.get() );

if ( ( mRenderer->capabilities() & QgsFeatureRenderer::SymbolLevels ) && mRenderer->usingSymbolLevels() )
drawRendererLevels( fit );
@@ -76,6 +76,7 @@ class QgsVectorLayerRenderer : public QgsMapLayerRenderer
public:
QgsVectorLayerRenderer( QgsVectorLayer *layer, QgsRenderContext &context );
~QgsVectorLayerRenderer() override;
QgsFeedback *feedback() const override;

bool render() override;

@@ -107,7 +108,7 @@ class QgsVectorLayerRenderer : public QgsMapLayerRenderer

QgsRenderContext &mContext;

QgsVectorLayerRendererInterruptionChecker mInterruptionChecker;
std::unique_ptr< QgsVectorLayerRendererInterruptionChecker > mInterruptionChecker;

//! The rendered layer
QgsVectorLayer *mLayer = nullptr;

0 comments on commit f5ca7b7

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