Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WMS-T layers temporal constrains support #34497

Merged
merged 16 commits into from
Mar 5, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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

Expand All @@ -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
Expand Down
15 changes: 8 additions & 7 deletions src/core/raster/qgsrasterdataprovider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
23 changes: 16 additions & 7 deletions src/core/raster/qgsrasterdataprovidertemporalcapabilities.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ void QgsRasterDataProviderTemporalCapabilities::setFixedTemporalRange( const Qgs
setIsActive( true );

mFixedRange = dateTimeRange;

}

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

mFixedReferenceRange = dateTimeRange;

}

const QgsDateTimeRange &QgsRasterDataProviderTemporalCapabilities::fixedReferenceTemporalRange() const
Expand All @@ -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 )
Expand All @@ -80,4 +90,3 @@ bool QgsRasterDataProviderTemporalCapabilities::isReferenceEnable() const
{
return mReferenceEnable;
}

66 changes: 48 additions & 18 deletions src/core/raster/qgsrasterdataprovidertemporalcapabilities.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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;

Expand Down
10 changes: 10 additions & 0 deletions src/core/raster/qgsrasterlayerrenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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() )
Samweli marked this conversation as resolved.
Show resolved Hide resolved
{
mPipe->provider()->temporalCapabilities()->setRequestedTemporalRange( layer->temporalProperties()->temporalRange() );
Samweli marked this conversation as resolved.
Show resolved Hide resolved
mPipe->provider()->temporalCapabilities()->setRequestedReferenceTemporalRange( layer->temporalProperties()->referenceTemporalRange() );

layer->temporalProperties()->setFixedTemporalRange( mPipe->provider()->temporalCapabilities()->fixedTemporalRange() );
layer->temporalProperties()->setFixedReferenceTemporalRange( mPipe->provider()->temporalCapabilities()->fixedReferenceTemporalRange() );
Samweli marked this conversation as resolved.
Show resolved Hide resolved
}

}

QgsRasterLayerRenderer::~QgsRasterLayerRenderer()
Expand Down
Loading