Skip to content

Commit

Permalink
logic for static temporal range updates when animation is in play
Browse files Browse the repository at this point in the history
  • Loading branch information
Samweli authored and nyalldawson committed Mar 29, 2020
1 parent b399e8a commit a623556
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
Expand Up @@ -50,8 +50,7 @@ const QgsDateTimeRange &QgsRasterDataProviderTemporalCapabilities::availableRefe

void QgsRasterDataProviderTemporalCapabilities::setRequestedTemporalRange( const QgsDateTimeRange &dateTimeRange )
{
if ( mAvailableTemporalRange.contains( dateTimeRange ) )
mRequestedRange = dateTimeRange;
mRequestedRange = dateTimeRange;
}

const QgsDateTimeRange &QgsRasterDataProviderTemporalCapabilities::requestedTemporalRange() const
Expand Down
2 changes: 2 additions & 0 deletions src/core/raster/qgsrasterlayerrenderer.cpp
Expand Up @@ -245,6 +245,8 @@ QgsRasterLayerRenderer::QgsRasterLayerRenderer( QgsRasterLayer *layer, QgsRender
break;
}
}
else if ( mPipe->provider()->temporalCapabilities() )
mPipe->provider()->temporalCapabilities()->setRequestedTemporalRange( QgsDateTimeRange() );
}

QgsRasterLayerRenderer::~QgsRasterLayerRenderer()
Expand Down
5 changes: 2 additions & 3 deletions src/gui/raster/qgsrasterlayerproperties.cpp
Expand Up @@ -1079,11 +1079,11 @@ void QgsRasterLayerProperties::apply()
//set the blend mode for the layer
mRasterLayer->setBlendMode( mBlendModeComboBox->blendMode() );

updateSourceStaticTime();

// Update temporal properties
mTemporalWidget->saveTemporalProperties();

updateSourceStaticTime();

//get the thumbnail for the layer
QPixmap thumbnail = QPixmap::fromImage( mRasterLayer->previewAsImage( pixmapThumbnail->size() ) );
pixmapThumbnail->setPixmap( thumbnail );
Expand Down Expand Up @@ -1213,7 +1213,6 @@ void QgsRasterLayerProperties::updateSourceStaticTime()
mRasterLayer->dataProvider()->setDataSourceUri( uri.encodedUri() );
mRasterLayer->setDataSource( mRasterLayer->dataProvider()->dataSourceUri(), mRasterLayer->name(), mRasterLayer->providerType(), QgsDataProvider::ProviderOptions() );


mRasterLayer->temporalProperties()->setIntervalHandlingMethod( static_cast< QgsRasterDataProviderTemporalCapabilities::IntervalHandlingMethod >(
mFetchModeComboBox->currentData().toInt() ) );
}
Expand Down
Expand Up @@ -99,7 +99,7 @@ void TestQgsRasterDataProviderTemporalCapabilities::checkTemporalRange()

// Test setting out of fixed temporal range limits, should not update the temporal range.
temporalCapabilities->setRequestedTemporalRange( outOfLimitsRange );
QCOMPARE( temporalCapabilities->requestedTemporalRange(), dateTimeRange );
QCOMPARE( temporalCapabilities->requestedTemporalRange(), outOfLimitsRange );

// Test if setting the requested temporal range with the fixed temporal range object,
// will result in to setting the requested temporal range with the fixed temporal range.
Expand Down

0 comments on commit a623556

Please sign in to comment.