Skip to content

Commit

Permalink
Address review
Browse files Browse the repository at this point in the history
  • Loading branch information
nirvn committed May 10, 2020
1 parent 9be36fd commit d0060fd
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 19 deletions.
1 change: 1 addition & 0 deletions python/core/auto_generated/qgstemporalproperty.sip.in
Expand Up @@ -24,6 +24,7 @@ Base class for temporal property.
#include "qgstemporalproperty.h"
%End
public:

enum Flag
{
NoFlags,
Expand Down
6 changes: 5 additions & 1 deletion src/core/qgstemporalproperty.h
Expand Up @@ -37,10 +37,14 @@ class CORE_EXPORT QgsTemporalProperty : public QObject
Q_OBJECT

public:

/**
* Flags attached to the temporal property.
*/
enum Flag
{
NoFlags = 0,
FlagDontInvalidateCachedRendersWhenRangeChanges = 1 //!< Any cached rendering will not be invalidated when temporal range context is modified
FlagDontInvalidateCachedRendersWhenRangeChanges = 1 //!< Any cached rendering will not be invalidated when temporal range context is modified.
};
Q_DECLARE_FLAGS( Flags, Flag )

Expand Down
27 changes: 11 additions & 16 deletions src/gui/qgsmapcanvas.cpp
Expand Up @@ -698,12 +698,12 @@ void QgsMapCanvas::rendererJobFinished()
{
mLastLayerRenderTime.insert( it.key()->id(), it.value() );
}
if ( mUsePreviewJobs && !mTemporalRefreshAfterJob )
if ( mUsePreviewJobs && !mRefreshAfterJob )
startPreviewJobs();
}
else
{
mTemporalRefreshAfterJob = false;
mRefreshAfterJob = false;
}

// now we are in a slot called from mJob - do not delete it immediately
Expand All @@ -713,9 +713,9 @@ void QgsMapCanvas::rendererJobFinished()

emit mapCanvasRefreshed();

if ( mTemporalRefreshAfterJob )
if ( mRefreshAfterJob )
{
mTemporalRefreshAfterJob = false;
mRefreshAfterJob = false;
clearTemporalCache();
refresh();
}
Expand Down Expand Up @@ -801,17 +801,12 @@ void QgsMapCanvas::setTemporalRange( const QgsDateTimeRange &dateTimeRange )

emit temporalRangeChanged();

// we need to discard any previously cached images which have temporal properties enabled, so that these will be updated when
// the canvas is redrawn
if ( !mJob )
{
// we need to discard any previously cached images which have temporal properties enabled, so that these will be updated when
// the canvas is redrawn
clearTemporalCache();
autoRefreshTriggered();
}
else
{
mTemporalRefreshAfterJob = true;
}

autoRefreshTriggered();
}

const QgsDateTimeRange &QgsMapCanvas::temporalRange() const
Expand Down Expand Up @@ -2059,9 +2054,9 @@ void QgsMapCanvas::autoRefreshTriggered()
{
if ( mJob )
{
// canvas is currently being redrawn, so we skip this auto refresh
// otherwise we could get stuck in the situation where an auto refresh is triggered
// too often to allow the canvas to ever finish rendering
// canvas is currently being redrawn, so we defer the last requested
// auto refresh until current rendering job finishes
mRefreshAfterJob = true;
return;
}

Expand Down
4 changes: 2 additions & 2 deletions src/gui/qgsmapcanvas.h
Expand Up @@ -1063,8 +1063,8 @@ class GUI_EXPORT QgsMapCanvas : public QGraphicsView
//! Flag that allows squashing multiple refresh() calls into just one delayed rendering job
bool mRefreshScheduled = false;

//! Flag that triggers a refresh after an ongoing rendering job finishes and clear cache for temporal-enabled layers
bool mTemporalRefreshAfterJob = false;
//! Flag that triggers a refresh after an ongoing rendering job triggered by autoRefresh
bool mRefreshAfterJob = false;

//! determines whether user has requested to suppress rendering
bool mRenderFlag = true;
Expand Down

0 comments on commit d0060fd

Please sign in to comment.