Skip to content

Commit

Permalink
Improve logic for automatic calculation of project temporal range
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Mar 12, 2020
1 parent 19499f3 commit 088696f
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/app/qgsprojectproperties.cpp
Expand Up @@ -2527,7 +2527,17 @@ void QgsProjectProperties::calculateFromLayersButton_clicked()
{
QgsRasterLayer *rasterLayer = qobject_cast<QgsRasterLayer *>( currentLayer );

QgsDateTimeRange layerRange = rasterLayer->temporalProperties()->fixedTemporalRange();
QgsDateTimeRange layerRange;
switch ( rasterLayer->temporalProperties()->mode() )
{
case QgsRasterLayerTemporalProperties::ModeFixedTemporalRange:
layerRange = rasterLayer->temporalProperties()->fixedTemporalRange();
break;

case QgsRasterLayerTemporalProperties::ModeTemporalRangeFromDataProvider:
layerRange = rasterLayer->dataProvider()->temporalCapabilities()->availableTemporalRange();
break;
}

if ( !minDate.isValid() || layerRange.begin() < minDate )
minDate = layerRange.begin();
Expand Down

0 comments on commit 088696f

Please sign in to comment.