Address review

This commit is contained in:
nirvn 2020-05-09 11:17:05 +07:00 committed by Mathieu Pellerin
parent 9be36fdbf3
commit d0060fd89a
4 changed files with 19 additions and 19 deletions

View File

@ -24,6 +24,7 @@ Base class for temporal property.
#include "qgstemporalproperty.h"
%End
public:
enum Flag
{
NoFlags,

View File

@ -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 )

View File

@ -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
@ -713,9 +713,9 @@ void QgsMapCanvas::rendererJobFinished()
emit mapCanvasRefreshed();
if ( mTemporalRefreshAfterJob )
if ( mRefreshAfterJob )
{
mTemporalRefreshAfterJob = false;
mRefreshAfterJob = false;
clearTemporalCache();
refresh();
}
@ -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
@ -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;
}

View File

@ -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;