Skip to content

Commit

Permalink
fix #36463
Browse files Browse the repository at this point in the history
  • Loading branch information
vcloarec authored and nyalldawson committed May 20, 2020
1 parent d48c178 commit daab0ea
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/core/mesh/qgsmeshdataprovidertemporalcapabilities.cpp
Expand Up @@ -33,18 +33,21 @@ QgsMeshDatasetIndex QgsMeshDataProviderTemporalCapabilities::datasetIndexFromRel
const qint64 endTimeSinceGroupReference =
endTimeSinceGlobalReference - mGlobalReferenceDateTime.msecsTo( groupReference );

if ( startTimeSinceGroupReference >= datasetTimes.last() )
if ( startTimeSinceGroupReference > datasetTimes.last() )
return QgsMeshDatasetIndex();

if ( endTimeSinceGroupReference < datasetTimes.first() )
return QgsMeshDatasetIndex();

for ( int i = 0; i < datasetTimes.count(); ++i )
{
qint64 time = datasetTimes.at( i );
if ( startTimeSinceGroupReference <= time )
{
if ( endTimeSinceGroupReference <= time )
return QgsMeshDatasetIndex( group, i - 1 ); // invalid if i=0
if ( endTimeSinceGroupReference < time ) // Start and end of range are before the current time step
return QgsMeshDatasetIndex( group, i - 1 ); // --> return the previous time step, invalid if i=0
else
return QgsMeshDatasetIndex( group, i );
return QgsMeshDatasetIndex( group, i ); // current time step are included in [start,end] --> return current
}
}

Expand Down

0 comments on commit daab0ea

Please sign in to comment.