Skip to content
Permalink
Browse files

saving and restoring temporal properties

  • Loading branch information
Samweli authored and nyalldawson committed Mar 4, 2020
1 parent 391f606 commit 1abbc2a5862403c8e2d88d4fd8013fc93ea15f42
@@ -50,44 +50,75 @@ Returns the fixed datetime range for these temporal properties.

void setFixedReferenceTemporalRange( const QgsDateTimeRange &dateTimeRange );
%Docstring
Sets the fixed reference datetime range for the temporal properties.
Sets the fixed 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`
%End

const QgsDateTimeRange &fixedReferenceTemporalRange() const;
%Docstring
Returns the fixed reference datetime range for these temporal properties.
Returns the fixed reference datetime range.

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

void setEnableTime( bool enabled );
void setRequestedTemporalRange( const QgsDateTimeRange &dateTimeRange );
%Docstring
Sets the time enabled status.
Sets the requested temporal range to retrieve when
returning data from the associated data provider.

.. seealso:: :py:func:`isTimeEnabled`
.. note::

this is not normally manually set, and is intended for use by
QgsRasterLayerRenderer to automatically set the requested temporal range
on a clone of the data provider during a render job.

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

bool isTimeEnabled() const;
const QgsDateTimeRange &requestedTemporalRange() const;
%Docstring
Returns the temporal property status.
Returns the requested temporal range.
Intended to be used by the provider in fetching data.

.. seealso:: :py:func:`setEnableTime`
.. seealso:: :py:func:`setRequestedTemporalRange`
%End

void setRequestedReferenceTemporalRange( const QgsDateTimeRange &dateTimeRange );
%Docstring
Sets the requested reference temporal range to retrieve when
returning data from the associated data provider.

.. note::

this is not normally manually set, and is intended for use by
QgsRasterLayerRenderer to automatically set the requested temporal range
on a clone of the data provider during a render job.

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

const QgsDateTimeRange &requestedReferenceTemporalRange() const;
%Docstring
Returns the requested reference temporal range.
Intended to be used by the provider in fetching data.

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

void setHasReference( bool enabled );
void setEnableTime( bool enabled );
%Docstring
Sets the reference range status.
Sets the time enabled status.

.. seealso:: :py:func:`hasReference`
.. seealso:: :py:func:`isTimeEnabled`
%End

bool hasReference() const;
bool isTimeEnabled() const;
%Docstring
Returns the reference range presence status.
Returns the temporal property status.

.. seealso:: :py:func:`setHasReference`
.. seealso:: :py:func:`setEnableTime`
%End

void setReferenceEnable( bool enabled );
@@ -66,6 +66,11 @@ with which the range of the render context intersects the specified ``range``.
This setting is only effective when mode() is
QgsRasterLayerTemporalProperties.ModeFixedTemporalRange

.. note::

This setting is not set by user. Provider can set this, if it is coming from there.


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

@@ -79,12 +84,50 @@ Returns the fixed temporal range for the layer.
QgsRasterLayerTemporalProperties.ModeFixedTemporalRange

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

void setFixedReferenceTemporalRange( const QgsDateTimeRange &range );
%Docstring
Sets a fixed reference temporal ``range`` to apply to the whole layer. All bands from
the raster layer will be rendered whenever the current datetime range of
a render context intersects the specified ``range``.

For the case of WMS-T layers, this set up will cause new WMS layer to be fetched
with which the range of the render context intersects the specified ``range``.

.. warning::

This setting is only effective when mode() is
QgsRasterLayerTemporalProperties.ModeFixedTemporalRange

.. note::

This setting is not set by user. Provider can set this, if it is coming from there.


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

const QgsDateTimeRange &fixedReferenceTemporalRange() const;
%Docstring
Returns the fixed reference temporal range for the layer.

.. warning::

To be used only when mode() is
QgsRasterLayerTemporalProperties.ModeFixedTemporalRange

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

void setTemporalRange( const QgsDateTimeRange &dateTimeRange );
%Docstring
Sets the current active datetime range for the temporal properties.

.. note::

This can be set by user, through raster layer properties widget.

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

@@ -99,7 +142,11 @@ Returns the current active datetime range for these temporal properties.
%Docstring
Sets the current active reference datetime range for the temporal properties.

This will be used by bi-temporal dimensional data providers.
This will be used by bi-temporal data.

.. note::

This can be set by user, through raster layer properties widget.

.. seealso:: :py:func:`referenceTemporalRange`
%End
@@ -518,13 +518,14 @@ void QgsRasterDataProvider::copyBaseSettings( const QgsRasterDataProvider &other
mExtent = other.mExtent;

// copy temporal properties
mTemporalCapabilities->setIsActive( other.mTemporalCapabilities->isActive() );
mTemporalCapabilities->setTemporalRange( other.mTemporalCapabilities->temporalRange() );
mTemporalCapabilities->setFixedTemporalRange( other.mTemporalCapabilities->fixedTemporalRange() );
mTemporalCapabilities->setEnableTime( other.mTemporalCapabilities->isTimeEnabled() );
mTemporalCapabilities->setHasReference( other.mTemporalCapabilities->hasReference() );
mTemporalCapabilities->setReferenceTemporalRange( other.mTemporalCapabilities->referenceTemporalRange() );
mTemporalCapabilities->setFixedReferenceTemporalRange( other.mTemporalCapabilities->fixedReferenceTemporalRange() );
if ( mTemporalCapabilities && other.mTemporalCapabilities )
{
mTemporalCapabilities->setIsActive( other.mTemporalCapabilities->isActive() );
mTemporalCapabilities->setFixedTemporalRange( other.mTemporalCapabilities->fixedTemporalRange() );
mTemporalCapabilities->setEnableTime( other.mTemporalCapabilities->isTimeEnabled() );
mTemporalCapabilities->setReferenceEnable( other.mTemporalCapabilities->isReferenceEnable() );
mTemporalCapabilities->setFixedReferenceTemporalRange( other.mTemporalCapabilities->fixedReferenceTemporalRange() );
}
}

// ENDS
@@ -28,7 +28,6 @@ void QgsRasterDataProviderTemporalCapabilities::setFixedTemporalRange( const Qgs
setIsActive( true );

mFixedRange = dateTimeRange;

}

const QgsDateTimeRange &QgsRasterDataProviderTemporalCapabilities::fixedTemporalRange() const
@@ -52,7 +51,6 @@ void QgsRasterDataProviderTemporalCapabilities::setFixedReferenceTemporalRange(
setIsActive( true );

mFixedReferenceRange = dateTimeRange;

}

const QgsDateTimeRange &QgsRasterDataProviderTemporalCapabilities::fixedReferenceTemporalRange() const
@@ -61,14 +59,26 @@ const QgsDateTimeRange &QgsRasterDataProviderTemporalCapabilities::fixedReferenc
}


void QgsRasterDataProviderTemporalCapabilities::setHasReference( bool enabled )
void QgsRasterDataProviderTemporalCapabilities::setRequestedTemporalRange( const QgsDateTimeRange &dateTimeRange )
{
if ( mFixedRange.contains( dateTimeRange ) )
mRequestedRange = dateTimeRange;
}

const QgsDateTimeRange &QgsRasterDataProviderTemporalCapabilities::requestedTemporalRange() const
{
mHasReferenceRange = enabled;
return mRequestedRange;
}

bool QgsRasterDataProviderTemporalCapabilities::hasReference() const
void QgsRasterDataProviderTemporalCapabilities::setRequestedReferenceTemporalRange( const QgsDateTimeRange &dateTimeRange )
{
return mHasReferenceRange;
if ( mFixedReferenceRange.contains( dateTimeRange ) )
mRequestedReferenceRange = dateTimeRange;
}

const QgsDateTimeRange &QgsRasterDataProviderTemporalCapabilities::requestedReferenceTemporalRange() const
{
return mRequestedReferenceRange;
}

void QgsRasterDataProviderTemporalCapabilities::setReferenceEnable( bool enabled )
@@ -80,4 +90,3 @@ bool QgsRasterDataProviderTemporalCapabilities::isReferenceEnable() const
{
return mReferenceEnable;
}

@@ -61,46 +61,73 @@ class CORE_EXPORT QgsRasterDataProviderTemporalCapabilities : public QgsDataProv
const QgsDateTimeRange &fixedTemporalRange() const;

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

/**
* Returns the fixed reference datetime range for these temporal properties.
* Returns the fixed reference datetime range.
*
* \see setFixedReferenceTemporalRange()
*/
const QgsDateTimeRange &fixedReferenceTemporalRange() const;

/**
* Sets the time enabled status.
* Sets the requested temporal range to retrieve when
* returning data from the associated data provider.
*
* \see isTimeEnabled()
*/
void setEnableTime( bool enabled );
* \note this is not normally manually set, and is intended for use by
* QgsRasterLayerRenderer to automatically set the requested temporal range
* on a clone of the data provider during a render job.
*
* \see requestedTemporalRange()
*/
void setRequestedTemporalRange( const QgsDateTimeRange &dateTimeRange );

/**
* Returns the temporal property status.
* Returns the requested temporal range.
* Intended to be used by the provider in fetching data.
*
* \see setEnableTime()
* \see setRequestedTemporalRange()
*/
bool isTimeEnabled() const;
const QgsDateTimeRange &requestedTemporalRange() const;

/**
* Sets the requested reference temporal range to retrieve when
* returning data from the associated data provider.
*
* \note this is not normally manually set, and is intended for use by
* QgsRasterLayerRenderer to automatically set the requested temporal range
* on a clone of the data provider during a render job.
*
* \see requestedReferenceTemporalRange()
*/
void setRequestedReferenceTemporalRange( const QgsDateTimeRange &dateTimeRange );

/**
* Sets the reference range status.
* Returns the requested reference temporal range.
* Intended to be used by the provider in fetching data.
*
* \see hasReference()
* \see setRequestedReferenceTemporalRange()
*/
const QgsDateTimeRange &requestedReferenceTemporalRange() const;

/**
* Sets the time enabled status.
*
* \see isTimeEnabled()
*/
void setHasReference( bool enabled );
void setEnableTime( bool enabled );

/**
* Returns the reference range presence status.
* Returns the temporal property status.
*
* \see setHasReference()
* \see setEnableTime()
*/
bool hasReference() const;
bool isTimeEnabled() const;

/**
* Sets the usage status of the reference range.
@@ -139,14 +166,17 @@ class CORE_EXPORT QgsRasterDataProviderTemporalCapabilities : public QgsDataProv
*/
bool mEnableTime = true;

//! Represents the requested temporal range.
QgsDateTimeRange mRequestedRange;

//! Represents the requested reference temporal range.
QgsDateTimeRange mRequestedReferenceRange;

/**
* Stores the fixed reference temporal range
*/
QgsDateTimeRange mFixedReferenceRange;

//! If these properties has reference temporal range
bool mHasReferenceRange = false;

//! If reference range has been enabled to be used in these properties
bool mReferenceEnable = false;

@@ -227,6 +227,16 @@ QgsRasterLayerRenderer::QgsRasterLayerRenderer( QgsRasterLayer *layer, QgsRender
QgsRasterRenderer *rasterRenderer = mPipe->renderer();
if ( rasterRenderer && !( rendererContext.flags() & QgsRenderContext::RenderPreviewJob ) )
layer->refreshRendererIfNeeded( rasterRenderer, rendererContext.extent() );

if ( layer && mPipe->provider() && mPipe->provider()->temporalCapabilities() )
{
mPipe->provider()->temporalCapabilities()->setRequestedTemporalRange( layer->temporalProperties()->temporalRange() );
mPipe->provider()->temporalCapabilities()->setRequestedReferenceTemporalRange( layer->temporalProperties()->referenceTemporalRange() );

layer->temporalProperties()->setFixedTemporalRange( mPipe->provider()->temporalCapabilities()->fixedTemporalRange() );
layer->temporalProperties()->setFixedReferenceTemporalRange( mPipe->provider()->temporalCapabilities()->fixedReferenceTemporalRange() );
}

}

QgsRasterLayerRenderer::~QgsRasterLayerRenderer()

0 comments on commit 1abbc2a

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