Add QgsRasterDataProvider::Capability::ReloadData for gdal, ams and wcs provider

This commit is contained in:
Matthias Kuhn 2020-12-12 14:31:27 +01:00 committed by Nyall Dawson
parent 14cdc672c0
commit 0d55e61145
7 changed files with 24 additions and 15 deletions

View File

@ -76,7 +76,8 @@ Base class for raster data providers.
ReadLayerMetadata,
WriteLayerMetadata,
ProviderHintBenefitsFromResampling,
ProviderHintCanPerformProviderResampling
ProviderHintCanPerformProviderResampling,
ReloadData
};
typedef QFlags<QgsRasterDataProvider::ProviderCapability> ProviderCapabilities;

View File

@ -1641,8 +1641,9 @@ QString QgsGdalProvider::description() const
QgsRasterDataProvider::ProviderCapabilities QgsGdalProvider::providerCapabilities() const
{
return QgsRasterDataProvider::ProviderHintBenefitsFromResampling |
QgsRasterDataProvider::ProviderHintCanPerformProviderResampling;
return ProviderCapability::ProviderHintBenefitsFromResampling |
ProviderCapability::ProviderHintCanPerformProviderResampling |
ProviderCapability::ReloadData;
}
// This is used also by global isValidRasterFileName

View File

@ -101,7 +101,8 @@ class CORE_EXPORT QgsRasterDataProvider : public QgsDataProvider, public QgsRast
ReadLayerMetadata = 1 << 1, //!< Provider can read layer metadata from data store. Since QGIS 3.0. See QgsDataProvider::layerMetadata()
WriteLayerMetadata = 1 << 2, //!< Provider can write layer metadata to the data store. Since QGIS 3.0. See QgsDataProvider::writeLayerMetadata()
ProviderHintBenefitsFromResampling = 1 << 3, //!< Provider benefits from resampling and should apply user default resampling settings (since QGIS 3.10)
ProviderHintCanPerformProviderResampling = 1 << 4 //!< Provider can perform resampling (to be opposed to post rendering resampling) (since QGIS 3.16)
ProviderHintCanPerformProviderResampling = 1 << 4, //!< Provider can perform resampling (to be opposed to post rendering resampling) (since QGIS 3.16)
ReloadData = 1 << 5 //!< Is able to force reload data / clear local caches. Since QGIS 3.18, see QgsDataProvider::reloadProviderData()
};
//! Provider capabilities

View File

@ -183,16 +183,16 @@ class CORE_EXPORT QgsRasterInterface
enum Capability
{
NoCapabilities = 0,
Size = 1 << 1, // original data source size (and thus resolution) is known, it is not always available, for example for WMS
Create = 1 << 2, // create new datasets
Remove = 1 << 3, // delete datasets
BuildPyramids = 1 << 4, // supports building of pyramids (overviews)
Identify = 1 << 5, // at least one identify format supported
IdentifyValue = 1 << 6, // numerical values
IdentifyText = 1 << 7, // WMS text
IdentifyHtml = 1 << 8, // WMS HTML
IdentifyFeature = 1 << 9, // WMS GML -> feature
Prefetch = 1 << 10, // allow prefetching of out-of-view images
Size = 1 << 1, //!< Original data source size (and thus resolution) is known, it is not always available, for example for WMS
Create = 1 << 2, //!< Create new datasets
Remove = 1 << 3, //!< Delete datasets
BuildPyramids = 1 << 4, //!< Supports building of pyramids (overviews)
Identify = 1 << 5, //!< At least one identify format supported
IdentifyValue = 1 << 6, //!< Numerical values
IdentifyText = 1 << 7, //!< WMS text
IdentifyHtml = 1 << 8, //!< WMS HTML
IdentifyFeature = 1 << 9, //!< WMS GML -> feature
Prefetch = 1 << 10, //!< Allow prefetching of out-of-view images
};
QgsRasterInterface( QgsRasterInterface *input = nullptr );

View File

@ -338,7 +338,7 @@ QgsAmsProvider::QgsAmsProvider( const QgsAmsProvider &other, const QgsDataProvid
QgsRasterDataProvider::ProviderCapabilities QgsAmsProvider::providerCapabilities() const
{
return QgsRasterDataProvider::ReadLayerMetadata;
return ProviderCapability::ReadLayerMetadata | ProviderCapability::ReloadData;
}
QString QgsAmsProvider::name() const { return AMS_PROVIDER_KEY; }

View File

@ -1595,6 +1595,11 @@ QString QgsWcsProvider::description() const
return WCS_DESCRIPTION;
}
QgsRasterDataProvider::ProviderCapabilities QgsWcsProvider::providerCapabilities() const
{
return ProviderCapability::ReloadData;
}
void QgsWcsProvider::reloadProviderData()
{
clearCache();

View File

@ -187,6 +187,7 @@ class QgsWcsProvider final: public QgsRasterDataProvider, QgsGdalProviderBase
QString lastErrorFormat() override;
QString name() const override;
QString description() const override;
QgsRasterDataProvider::ProviderCapabilities providerCapabilities() const override;
QList<QgsColorRampShader::ColorRampItem> colorTable( int bandNo )const override;
int colorInterpretation( int bandNo ) const override;