Skip to content
Permalink
Browse files

Push all available temporal ranges to temporal controller when

it changes
  • Loading branch information
nyalldawson committed Mar 25, 2021
1 parent d443e4a commit 9c1ddfcf783affc5bb30588ce4d69d6ffc438969
@@ -90,6 +90,30 @@ Returns the navigation temporal extents, which dictate the earliest
and latest date time possible in the animation.

.. seealso:: :py:func:`setTemporalExtents`
%End

void setAvailableTemporalRanges( const QList< QgsDateTimeRange > &ranges );
%Docstring
Sets the list of all available temporal ``ranges`` which have data available.

The ``ranges`` list can be a list of non-contiguous ranges (i.e. containing gaps)
which together describe the complete range of times which contain data.

.. seealso:: :py:func:`availableTemporalRanges`

.. versionadded:: 3.20
%End

QList< QgsDateTimeRange > availableTemporalRanges() const;
%Docstring
Returns the list of all available temporal ranges which have data available.

The ranges list can be a list of non-contiguous ranges (i.e. containing gaps)
which together describe the complete range of times which contain data.

.. seealso:: :py:func:`setAvailableTemporalRanges`

.. versionadded:: 3.20
%End

void setCurrentFrameNumber( long long frame );
@@ -169,6 +169,16 @@ QgsDateTimeRange QgsTemporalNavigationObject::temporalExtents() const
return mTemporalExtents;
}

void QgsTemporalNavigationObject::setAvailableTemporalRanges( const QList<QgsDateTimeRange> &ranges )
{
mAllRanges = ranges;
}

QList<QgsDateTimeRange> QgsTemporalNavigationObject::availableTemporalRanges() const
{
return mAllRanges;
}

void QgsTemporalNavigationObject::setCurrentFrameNumber( long long frameNumber )
{
if ( mCurrentFrameNumber != frameNumber )
@@ -109,6 +109,28 @@ class CORE_EXPORT QgsTemporalNavigationObject : public QgsTemporalController, pu
*/
QgsDateTimeRange temporalExtents() const;

/**
* Sets the list of all available temporal \a ranges which have data available.
*
* The \a ranges list can be a list of non-contiguous ranges (i.e. containing gaps)
* which together describe the complete range of times which contain data.
*
* \see availableTemporalRanges()
* \since QGIS 3.20
*/
void setAvailableTemporalRanges( const QList< QgsDateTimeRange > &ranges );

/**
* Returns the list of all available temporal ranges which have data available.
*
* The ranges list can be a list of non-contiguous ranges (i.e. containing gaps)
* which together describe the complete range of times which contain data.
*
* \see setAvailableTemporalRanges()
* \since QGIS 3.20
*/
QList< QgsDateTimeRange > availableTemporalRanges() const;

/**
* Sets the current animation \a frame number.
*
@@ -298,6 +320,9 @@ class CORE_EXPORT QgsTemporalNavigationObject : public QgsTemporalController, pu
//! The controller temporal navigation extent range.
QgsDateTimeRange mTemporalExtents;

//! Complete list of time ranges with data available
QList< QgsDateTimeRange > mAllRanges;

NavigationMode mNavigationMode = NavigationOff;

//! The current set frame value
@@ -410,6 +410,7 @@ void QgsTemporalControllerWidget::onLayersAdded( const QList<QgsMapLayer *> &lay
{
mHasTemporalLayersLoaded = true;
firstTemporalLayerLoaded( layer );
mNavigationObject->setAvailableTemporalRanges( QgsTemporalUtils::usedTemporalRangesForProject( QgsProject::instance() ) );
}
} );
}
@@ -418,6 +419,8 @@ void QgsTemporalControllerWidget::onLayersAdded( const QList<QgsMapLayer *> &lay
}
}
}

mNavigationObject->setAvailableTemporalRanges( QgsTemporalUtils::usedTemporalRangesForProject( QgsProject::instance() ) );
}

void QgsTemporalControllerWidget::firstTemporalLayerLoaded( QgsMapLayer *layer )
@@ -636,6 +639,8 @@ void QgsTemporalControllerWidget::setDatesToAllLayers()
{
QgsDateTimeRange range;
range = QgsTemporalUtils::calculateTemporalRangeForProject( QgsProject::instance() );
mNavigationObject->setAvailableTemporalRanges( QgsTemporalUtils::usedTemporalRangesForProject( QgsProject::instance() ) );

setDates( range );
}

@@ -653,6 +658,8 @@ void QgsTemporalControllerWidget::setDatesToProjectTime()
range = QgsTemporalUtils::calculateTemporalRangeForProject( QgsProject::instance() );
}

mNavigationObject->setAvailableTemporalRanges( QgsTemporalUtils::usedTemporalRangesForProject( QgsProject::instance() ) );

setDates( range );
}

0 comments on commit 9c1ddfc

Please sign in to comment.