Skip to content
Permalink
Browse files

fix #36463

  • Loading branch information
vcloarec authored and nyalldawson committed May 17, 2020
1 parent d48c178 commit daab0eace46f6203338d27163d7498558dd81920
Showing with 7 additions and 4 deletions.
  1. +7 −4 src/core/mesh/qgsmeshdataprovidertemporalcapabilities.cpp
@@ -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
}
}

0 comments on commit daab0ea

Please sign in to comment.
You can’t perform that action at this time.