Skip to content
Permalink
Browse files

Rename some methods for clarity

  • Loading branch information
nyalldawson committed Mar 12, 2020
1 parent 46267fd commit f894ca41cc63dfd2bf52454298b26de8807121e9
@@ -78,33 +78,34 @@ layers or bands in the data provider.
.. seealso:: :py:func:`intervalHandlingMethod`
%End

void setFixedTemporalRange( const QgsDateTimeRange &range );
void setAvailableTemporalRange( const QgsDateTimeRange &range );
%Docstring
Sets the fixed datetime ``range`` for the temporal properties.
Sets the datetime ``range`` extent from which temporal data is available from the provider.

.. seealso:: :py:func:`fixedTemporalRange`
.. seealso:: :py:func:`availableTemporalRange`
%End

const QgsDateTimeRange &fixedTemporalRange() const;
const QgsDateTimeRange &availableTemporalRange() const;
%Docstring
Returns the fixed datetime range for these temporal properties.
Returns the datetime range extent from which temporal data is available from the provider.

.. seealso:: :py:func:`setFixedTemporalRange`
.. seealso:: :py:func:`setAvailableTemporalRange`
%End

void setFixedReferenceTemporalRange( const QgsDateTimeRange &range );
void setAvailableReferenceTemporalRange( const QgsDateTimeRange &range );
%Docstring
Sets the fixed reference datetime ``range``. This is to be used for
Sets the available reference datetime ``range``. This is to be used for
bi-temporal based data. Where data can have both nominal and reference times.

.. seealso:: :py:func:`fixedReferenceTemporalRange`
.. seealso:: :py:func:`availableReferenceTemporalRange`
%End

const QgsDateTimeRange &fixedReferenceTemporalRange() const;
const QgsDateTimeRange &availableReferenceTemporalRange() const;
%Docstring
Returns the fixed reference datetime range.
Returns the available reference datetime range, which indicates the maximum
extent of datetime values available for reference temporal ranges from the provider.

.. seealso:: :py:func:`setFixedReferenceTemporalRange`
.. seealso:: :py:func:`setAvailableReferenceTemporalRange`
%End

void setRequestedTemporalRange( const QgsDateTimeRange &range );
@@ -22,15 +22,15 @@ QgsRasterDataProviderTemporalCapabilities::QgsRasterDataProviderTemporalCapabili
{
}

void QgsRasterDataProviderTemporalCapabilities::setFixedTemporalRange( const QgsDateTimeRange &dateTimeRange )
void QgsRasterDataProviderTemporalCapabilities::setAvailableTemporalRange( const QgsDateTimeRange &dateTimeRange )
{
if ( !hasTemporalCapabilities() )
setHasTemporalCapabilities( true );

mFixedRange = dateTimeRange;
}

const QgsDateTimeRange &QgsRasterDataProviderTemporalCapabilities::fixedTemporalRange() const
const QgsDateTimeRange &QgsRasterDataProviderTemporalCapabilities::availableTemporalRange() const
{
return mFixedRange;
}
@@ -45,15 +45,15 @@ bool QgsRasterDataProviderTemporalCapabilities::isTimeEnabled() const
return mEnableTime;
}

void QgsRasterDataProviderTemporalCapabilities::setFixedReferenceTemporalRange( const QgsDateTimeRange &dateTimeRange )
void QgsRasterDataProviderTemporalCapabilities::setAvailableReferenceTemporalRange( const QgsDateTimeRange &dateTimeRange )
{
if ( !hasTemporalCapabilities() )
setHasTemporalCapabilities( true );

mFixedReferenceRange = dateTimeRange;
}

const QgsDateTimeRange &QgsRasterDataProviderTemporalCapabilities::fixedReferenceTemporalRange() const
const QgsDateTimeRange &QgsRasterDataProviderTemporalCapabilities::availableReferenceTemporalRange() const
{
return mFixedReferenceRange;
}
@@ -98,33 +98,34 @@ class CORE_EXPORT QgsRasterDataProviderTemporalCapabilities : public QgsDataProv
void setIntervalHandlingMethod( IntervalHandlingMethod method );

/**
* Sets the fixed datetime \a range for the temporal properties.
* Sets the datetime \a range extent from which temporal data is available from the provider.
*
* \see fixedTemporalRange()
* \see availableTemporalRange()
*/
void setFixedTemporalRange( const QgsDateTimeRange &range );
void setAvailableTemporalRange( const QgsDateTimeRange &range );

/**
* Returns the fixed datetime range for these temporal properties.
* Returns the datetime range extent from which temporal data is available from the provider.
*
* \see setFixedTemporalRange()
* \see setAvailableTemporalRange()
*/
const QgsDateTimeRange &fixedTemporalRange() const;
const QgsDateTimeRange &availableTemporalRange() const;

/**
* Sets the fixed reference datetime \a range. This is to be used for
* Sets the available reference datetime \a range. This is to be used for
* bi-temporal based data. Where data can have both nominal and reference times.
*
* \see fixedReferenceTemporalRange()
* \see availableReferenceTemporalRange()
*/
void setFixedReferenceTemporalRange( const QgsDateTimeRange &range );
void setAvailableReferenceTemporalRange( const QgsDateTimeRange &range );

/**
* Returns the fixed reference datetime range.
* Returns the available reference datetime range, which indicates the maximum
* extent of datetime values available for reference temporal ranges from the provider.
*
* \see setFixedReferenceTemporalRange()
* \see setAvailableReferenceTemporalRange()
*/
const QgsDateTimeRange &fixedReferenceTemporalRange() const;
const QgsDateTimeRange &availableReferenceTemporalRange() const;

/**
* Sets the requested temporal \a range to retrieve when
@@ -185,8 +185,8 @@ QDomElement QgsRasterLayerTemporalProperties::writeXml( QDomElement &element, QD

void QgsRasterLayerTemporalProperties::setDefaultsFromDataProviderTemporalCapabilities( QgsRasterDataProviderTemporalCapabilities *capabilities )
{
setFixedTemporalRange( capabilities->fixedTemporalRange() );
setFixedReferenceTemporalRange( capabilities->fixedReferenceTemporalRange() );
setFixedTemporalRange( capabilities->availableTemporalRange() );
setFixedReferenceTemporalRange( capabilities->availableReferenceTemporalRange() );

if ( capabilities->isTimeEnabled() )
{
@@ -104,9 +104,9 @@ void QgsRasterLayerTemporalPropertiesWidget::setDateTimeInputsLimit()
layer->temporalProperties()->setMode(
QgsRasterLayerTemporalProperties::ModeTemporalRangeFromDataProvider );
layer->temporalProperties()->setFixedTemporalRange(
layer->dataProvider()->temporalCapabilities()->fixedTemporalRange() );
layer->dataProvider()->temporalCapabilities()->availableTemporalRange() );
layer->temporalProperties()->setFixedReferenceTemporalRange(
layer->dataProvider()->temporalCapabilities()->fixedReferenceTemporalRange() );
layer->dataProvider()->temporalCapabilities()->availableReferenceTemporalRange() );
}

QgsDateTimeRange fixedRange = layer->temporalProperties()->fixedTemporalRange();
@@ -156,7 +156,7 @@ QgsWmsProvider::QgsWmsProvider( QString const &uri, const ProviderOptions &optio
{
Q_ASSERT_X( temporalCapabilities(), "QgsWmsProvider::QgsWmsProvider()", "Data provider temporal capabilities object does not exist" );
temporalCapabilities()->setHasTemporalCapabilities( true );
temporalCapabilities()->setFixedTemporalRange( mSettings.mFixedRange );
temporalCapabilities()->setAvailableTemporalRange( mSettings.mFixedRange );

temporalCapabilities()->setMode(
QgsRasterDataProviderTemporalCapabilities::ModeTemporalRangeFromDataProvider );
@@ -165,7 +165,7 @@ QgsWmsProvider::QgsWmsProvider( QString const &uri, const ProviderOptions &optio

if ( mSettings.mIsBiTemporal )
{
temporalCapabilities()->setFixedReferenceTemporalRange( mSettings.mFixedReferenceRange );
temporalCapabilities()->setAvailableReferenceTemporalRange( mSettings.mFixedReferenceRange );
}
}
}
@@ -268,9 +268,9 @@ void TestQgsProjectProperties::testTimeSettings()

// Test setting Project temporal range using temporal layers

QgsRasterLayer *firstLayer = new QgsRasterLayer( "", "firstLayer", "wms" );
QgsRasterLayer *secondLayer = new QgsRasterLayer( "", "secondLayer", "wms" );
QgsRasterLayer *thirdLayer = new QgsRasterLayer( "", "thirdLayer", "wms" );
QgsRasterLayer *firstLayer = new QgsRasterLayer( QString(), QStringLiteral( "firstLayer" ), QStringLiteral( "wms" ) );
QgsRasterLayer *secondLayer = new QgsRasterLayer( QString(), QStringLiteral( "secondLayer" ), QStringLiteral( "wms" ) );
QgsRasterLayer *thirdLayer = new QgsRasterLayer( QString(), QStringLiteral( "thirdLayer" ), QStringLiteral( "wms" ) );

QgsDateTimeRange firstRange = QgsDateTimeRange( QDateTime( QDate( 2020, 1, 1 ), QTime(), Qt::UTC ),
QDateTime( QDate( 2020, 3, 31 ), QTime(), Qt::UTC ) );
@@ -92,10 +92,10 @@ void TestQgsRasterDataProviderTemporalCapabilities::checkTemporalRange()
QgsDateTimeRange outOfLimitsRange = QgsDateTimeRange( QDateTime( QDate( 2019, 1, 1 ) ),
QDateTime( QDate( 2021, 3, 1 ) ) );

temporalCapabilities->setFixedTemporalRange( fixedDateTimeRange );
temporalCapabilities->setAvailableTemporalRange( fixedDateTimeRange );
temporalCapabilities->setRequestedTemporalRange( dateTimeRange );

QCOMPARE( temporalCapabilities->fixedTemporalRange(), fixedDateTimeRange );
QCOMPARE( temporalCapabilities->availableTemporalRange(), fixedDateTimeRange );
QCOMPARE( temporalCapabilities->requestedTemporalRange(), dateTimeRange );

// Test setting out of fixed temporal range limits, should not update the temporal range.
@@ -117,10 +117,10 @@ void TestQgsRasterDataProviderTemporalCapabilities::checkReferenceTemporalRange(
QgsDateTimeRange outOfLimitsRange = QgsDateTimeRange( QDateTime( QDate( 2019, 1, 1 ) ),
QDateTime( QDate( 2021, 3, 1 ) ) );

temporalCapabilities->setFixedReferenceTemporalRange( fixedDateTimeRange );
temporalCapabilities->setAvailableReferenceTemporalRange( fixedDateTimeRange );
temporalCapabilities->setRequestedReferenceTemporalRange( dateTimeRange );

QCOMPARE( temporalCapabilities->fixedReferenceTemporalRange(), fixedDateTimeRange );
QCOMPARE( temporalCapabilities->availableReferenceTemporalRange(), fixedDateTimeRange );
QCOMPARE( temporalCapabilities->requestedReferenceTemporalRange(), dateTimeRange );

temporalCapabilities->setRequestedReferenceTemporalRange( outOfLimitsRange );

0 comments on commit f894ca4

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