Skip to content

Commit

Permalink
[quick] Insure that group layers with temporal children are invalidat…
Browse files Browse the repository at this point in the history
…ed when needed
  • Loading branch information
nirvn committed Mar 12, 2024
1 parent 4ae7d5a commit 3036618
Showing 1 changed file with 35 additions and 4 deletions.
39 changes: 35 additions & 4 deletions src/quickgui/qgsquickmapcanvasmap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,19 @@
#include <QScreen>

#include "qgis.h"
#include "qgsannotationlayer.h"
#include "qgsexpressioncontextutils.h"
#include "qgsgrouplayer.h"
#include "qgslabelingresults.h"
#include "qgsmaplayerelevationproperties.h"
#include "qgsmaplayertemporalproperties.h"
#include "qgsmaprenderercache.h"
#include "qgsmaprendererparalleljob.h"
#include "qgsmessagelog.h"
#include "qgspallabeling.h"
#include "qgsproject.h"
#include "qgsannotationlayer.h"
#include "qgssymbollayerutils.h"
#include "qgsvectorlayer.h"
#include "qgslabelingresults.h"

#include "qgsquickmapcanvasmap.h"
#include "qgsquickmapsettings.h"
Expand Down Expand Up @@ -513,9 +514,23 @@ void QgsQuickMapCanvasMap::clearTemporalCache()
const QList<QgsMapLayer *> layerList = mMapSettings->mapSettings().layers();
for ( QgsMapLayer *layer : layerList )
{
bool alreadyInvalidatedThisLayer = false;
if ( QgsVectorLayer *vl = qobject_cast< QgsVectorLayer * >( layer ) )
{
if ( vl->renderer() && QgsSymbolLayerUtils::rendererFrameRate( vl->renderer() ) > -1 )
{
// layer has an animated symbol assigned, so we have to redraw it regardless of whether
// or not it has temporal settings
mCache->invalidateCacheForLayer( layer );
alreadyInvalidatedThisLayer = true;
// we can't shortcut and "continue" here, as we still need to check whether the layer
// will cause label invalidation using the logic below
}
}

if ( layer->temporalProperties() && layer->temporalProperties()->isActive() )
{
if ( QgsVectorLayer *vl = qobject_cast<QgsVectorLayer *>( layer ) )
if ( QgsVectorLayer *vl = qobject_cast< QgsVectorLayer * >( layer ) )
{
if ( vl->labelsEnabled() || vl->diagramsEnabled() )
invalidateLabels = true;
Expand All @@ -524,7 +539,23 @@ void QgsQuickMapCanvasMap::clearTemporalCache()
if ( layer->temporalProperties()->flags() & QgsTemporalProperty::FlagDontInvalidateCachedRendersWhenRangeChanges )
continue;

mCache->invalidateCacheForLayer( layer );
if ( !alreadyInvalidatedThisLayer )
mCache->invalidateCacheForLayer( layer );
}
else if ( QgsGroupLayer *gl = qobject_cast<QgsGroupLayer *>( layer ) )
{
const QList<QgsMapLayer *> childLayerList = gl->childLayers();
for ( QgsMapLayer *childLayer : childLayerList )
{
if ( childLayer->temporalProperties() && childLayer->temporalProperties()->isActive() )
{
if ( childLayer->temporalProperties()->flags() & QgsTemporalProperty::FlagDontInvalidateCachedRendersWhenRangeChanges )
continue;

mCache->invalidateCacheForLayer( layer );
break;
}
}
}
}

Expand Down

0 comments on commit 3036618

Please sign in to comment.