Skip to content
Permalink
Browse files

Minor API tweak

  • Loading branch information
nyalldawson committed Mar 12, 2020
1 parent ea16cc7 commit ee2b94f23c60cf1df7639e6e3ac0285f2ba6a443
@@ -11,6 +11,7 @@




class QgsMapLayerTemporalProperties : QgsTemporalProperty
{
%Docstring
@@ -71,6 +72,12 @@ Sets the temporal properties temporal range ``source``.
virtual bool isVisibleInTemporalRange( const QgsDateTimeRange &range ) const;
%Docstring
Returns ``True`` if the layer should be visible and rendered for the specified time ``range``.
%End

virtual void setDefaultsFromDataProviderTemporalCapabilities( const QgsDataProviderTemporalCapabilities *capabilities ) = 0;
%Docstring
Sets the layers temporal settings to appropriate defaults based on
a provider's temporal ``capabilities``.
%End

};
@@ -195,9 +195,6 @@ their own layers, such as WMS

virtual QgsRasterDataProviderTemporalCapabilities *temporalCapabilities();

%Docstring
Returns temporal capabilities associated with the data provider.
%End

virtual bool supportsLegendGraphic() const;
%Docstring
@@ -165,11 +165,8 @@ Returns the current active reference datetime range for these temporal propertie
virtual bool readXml( const QDomElement &element, const QgsReadWriteContext &context );


void setDefaultsFromDataProviderTemporalCapabilities( QgsRasterDataProviderTemporalCapabilities *capabilities );
%Docstring
Sets the layers temporal settings to appropriate defaults based on
a provider's temporal ``capabilities``.
%End
virtual void setDefaultsFromDataProviderTemporalCapabilities( const QgsDataProviderTemporalCapabilities *capabilities );


};

@@ -27,6 +27,8 @@

#include <QDomElement>

class QgsDataProviderTemporalCapabilities;

/**
* \class QgsMapLayerTemporalProperties
* \ingroup core
@@ -92,6 +94,12 @@ class CORE_EXPORT QgsMapLayerTemporalProperties : public QgsTemporalProperty
*/
virtual bool isVisibleInTemporalRange( const QgsDateTimeRange &range ) const;

/**
* Sets the layers temporal settings to appropriate defaults based on
* a provider's temporal \a capabilities.
*/
virtual void setDefaultsFromDataProviderTemporalCapabilities( const QgsDataProviderTemporalCapabilities *capabilities ) = 0;

private:

//! Source of the properties temporal range
@@ -261,9 +261,6 @@ class CORE_EXPORT QgsRasterDataProvider : public QgsDataProvider, public QgsRast
return QStringList();
}

/**
* Returns temporal capabilities associated with the data provider.
*/
QgsRasterDataProviderTemporalCapabilities *temporalCapabilities() override;

//! \brief Returns whether the provider supplies a legend graphic
@@ -199,15 +199,18 @@ QDomElement QgsRasterLayerTemporalProperties::writeXml( QDomElement &element, QD
return element;
}

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

if ( capabilities->hasTemporalCapabilities() )
if ( const QgsRasterDataProviderTemporalCapabilities *rasterCaps = dynamic_cast< const QgsRasterDataProviderTemporalCapabilities *>( capabilities ) )
{
setMode( ModeTemporalRangeFromDataProvider );
}
setFixedTemporalRange( rasterCaps->availableTemporalRange() );
setFixedReferenceTemporalRange( rasterCaps->availableReferenceTemporalRange() );

mIntervalHandlingMethod = capabilities->intervalHandlingMethod();
if ( rasterCaps->hasTemporalCapabilities() )
{
setMode( ModeTemporalRangeFromDataProvider );
}

mIntervalHandlingMethod = rasterCaps->intervalHandlingMethod();
}
}
@@ -168,11 +168,7 @@ class CORE_EXPORT QgsRasterLayerTemporalProperties : public QgsMapLayerTemporalP

bool readXml( const QDomElement &element, const QgsReadWriteContext &context ) override;

/**
* Sets the layers temporal settings to appropriate defaults based on
* a provider's temporal \a capabilities.
*/
void setDefaultsFromDataProviderTemporalCapabilities( QgsRasterDataProviderTemporalCapabilities *capabilities );
void setDefaultsFromDataProviderTemporalCapabilities( const QgsDataProviderTemporalCapabilities *capabilities ) override;

private:

0 comments on commit ee2b94f

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