23#ifndef QGSRASTERDATAPROVIDER_H
24#define QGSRASTERDATAPROVIDER_H
47using namespace Qt::StringLiterals;
83 void progress( qint64 received, qint64 total );
85 void error(
const QString &msg );
181 QString colorInterpretationName(
int bandNo )
const override;
222 virtual void setUseSourceNoDataValue(
int bandNo,
bool use );
232 virtual QList<QgsColorRampShader::ColorRampItem>
colorTable(
int bandNo )
const
235 return QList<QgsColorRampShader::ColorRampItem>();
242 QStringList
subLayers()
const override {
return QStringList(); }
266 Q_UNUSED( forceRefresh )
267 Q_UNUSED( visibleExtent )
285 Q_UNUSED( mapSettings )
306 const QList<QgsRasterPyramid> &pyramidList,
307 const QString &resamplingMethod =
"NEAREST",
309 const QStringList &configOptions = QStringList(),
313 Q_UNUSED( pyramidList )
314 Q_UNUSED( resamplingMethod )
316 Q_UNUSED( configOptions )
318 return u
"FAILED_NOT_SUPPORTED"_s;
339 virtual QList<QgsRasterPyramid>
buildPyramidList(
const QList<int> &overviewList = QList<int>() )
341 Q_UNUSED( overviewList )
342 return QList<QgsRasterPyramid>();
461 virtual bool write(
const void *data,
int band,
int width,
int height,
int xOffset,
int yOffset )
488 bool writeBlock(
QgsRasterBlock *block,
int band,
int xOffset = 0,
int yOffset = 0 );
494 const QString &providerKey,
496 const QString &format,
501 double *geoTransform,
503 const QStringList &createOptions = QStringList()
514 Q_UNUSED( noDataValue );
525 static QList<QPair<QString, QString> > pyramidResamplingMethods(
const QString &providerKey );
577 Q_UNUSED( createOptions )
588 Q_UNUSED( pyramidsFormat )
589 Q_UNUSED( configOptions );
590 Q_UNUSED( fileFormat );
638 virtual QList< double > nativeResolutions()
const;
646 virtual bool ignoreExtents()
const;
670 virtual QgsPoint transformCoordinates(
const QgsPoint &point, TransformType type );
753 void readXml(
const QDomElement &filterElem )
override;
755 void writeXml( QDomDocument &doc, QDomElement &parentElem )
const override;
780 void removeAttributeTable(
int bandNumber );
789 bool writeFileBasedAttributeTable(
int bandNumber,
const QString &path, QString *errorMessage
SIP_OUT =
nullptr )
const;
797 bool readFileBasedAttributeTable(
int bandNumber,
const QString &path, QString *errorMessage
SIP_OUT =
nullptr );
809 virtual bool writeNativeAttributeTable( QString *errorMessage
SIP_OUT =
nullptr );
819 virtual bool readNativeAttributeTable( QString *errorMessage
SIP_OUT =
nullptr );
827 virtual QString bandDescription(
int bandNumber );
861 Q_UNUSED( viewExtent );
865 Q_UNUSED( feedback );
870 bool userNoDataValuesContains(
int bandNo,
double value )
const;
924 std::unique_ptr< QgsRasterDataProviderTemporalCapabilities > mTemporalCapabilities;
926 std::unique_ptr< QgsRasterDataProviderElevationProperties > mElevationProperties;
928 std::map<int, std::unique_ptr<QgsRasterAttributeTable>> mAttributeTables;
Provides global constants and enumerations for use throughout the application.
RasterPyramidFormat
Raster pyramid formats.
@ GeoTiff
Geotiff .ovr (external).
RasterResamplingMethod
Resampling method for raster provider-level resampling.
@ Nearest
Nearest-neighbour resampling.
RasterInterfaceCapability
Raster interface capabilities.
QFlags< DataProviderReadFlag > DataProviderReadFlags
Flags which control data provider construction.
DataType
Raster data types.
RasterColorInterpretation
Raster color interpretation.
RasterIdentifyFormat
Raster identify formats.
Represents a coordinate reference system (CRS).
virtual Qgis::DataProviderFlags flags() const
Returns the generic data provider flags.
QDateTime mTimestamp
Timestamp of data in the moment when the data were loaded by provider.
QgsDataProvider(const QString &uri=QString(), const QgsDataProvider::ProviderOptions &providerOptions=QgsDataProvider::ProviderOptions(), Qgis::DataProviderReadFlags flags=Qgis::DataProviderReadFlags())
Create a new dataprovider with the specified in the uri.
QgsDataSourceUri uri() const
Gets the data source specification.
Base class for feedback objects to be used for cancellation of something running in a worker thread.
Container of fields for a vector layer.
Handles asynchronous download of images.
QgsImageFetcher(QObject *parent=nullptr)
Constructor.
void progress(qint64 received, qint64 total)
Emitted to report progress.
void error(const QString &msg)
Emitted when an error occurs.
void finish(const QImage &legend)
Emitted when the download completes.
virtual void start()=0
Starts the image download.
Contains configuration for rendering maps.
Point geometry type, with support for z-dimension and m-values.
Represents a Raster Attribute Table (RAT).
Feedback object tailored for raster block reading.
Handles elevation related properties for a raster data provider.
Implementation of data provider temporal properties for QgsRasterDataProviders.
Base class for raster data providers.
virtual QgsFields fields() const
Returns the fields of the raster layer for data providers that expose them, the default implementatio...
double mMaxOversampling
Maximum boundary for oversampling (to avoid too much data traffic). Default: 2.0.
virtual bool write(const void *data, int band, int width, int height, int xOffset, int yOffset)
Writes into the provider datasource.
QList< bool > mUseSrcNoDataValue
Use source nodata value.
TransformType
Types of transformation in transformCoordinates() function.
@ TransformLayerToImage
Transforms layer (georeferenced) coordinates to image coordinates.
@ TransformImageToLayer
Transforms image coordinates to layer (georeferenced) coordinates.
QgsRasterDataProvider * clone() const override=0
Clone itself, create deep copy.
virtual bool sourceHasNoDataValue(int bandNo) const
Returns true if source band has no data value.
static QString encodeVirtualRasterProviderUri(const VirtualRasterParameters &parts)
Encodes the URI starting from the struct .
virtual bool setNoDataValue(int bandNo, double noDataValue)
Set no data value on created dataset.
virtual double bandOffset(int bandNo) const
Read band offset for raster value.
virtual QString lastErrorFormat()
Returns the format of the error text for the last error in this provider.
bool mProviderResamplingEnabled
Whether provider resampling is enabled.
Qgis::RasterResamplingMethod zoomedInResamplingMethod() const
Returns resampling method for zoomed-in operations.
virtual QString buildPyramids(const QList< QgsRasterPyramid > &pyramidList, const QString &resamplingMethod="NEAREST", Qgis::RasterPyramidFormat format=Qgis::RasterPyramidFormat::GeoTiff, const QStringList &configOptions=QStringList(), QgsRasterBlockFeedback *feedback=nullptr)
Creates pyramid overviews.
virtual bool readBlock(int bandNo, QgsRectangle const &viewExtent, int width, int height, void *data, QgsRasterBlockFeedback *feedback=nullptr)
Reads a block of raster data into data, using the given extent and size.
virtual QSize maximumTileSize() const
Returns the maximum tile size in pixels for the data provider.
virtual bool useSourceNoDataValue(int bandNo) const
Returns the source nodata value usage.
virtual QString validateCreationOptions(const QStringList &createOptions, const QString &format)
Validates creation options for a specific dataset and destination format.
virtual QString lastError()=0
Returns the verbose error text for the last error in this provider.
static QgsRasterDataProvider::VirtualRasterParameters decodeVirtualRasterProviderUri(const QString &uri, bool *ok=nullptr)
Decodes the URI returning a struct with all the parameters for QgsVirtualRasterProvider class.
Qgis::DataType sourceDataType(int bandNo) const override=0
Returns source data type for the band specified by number, source data type may be shorter than dataT...
bool isProviderResamplingEnabled() const
Returns whether provider-level resampling is enabled.
virtual bool setZoomedInResamplingMethod(Qgis::RasterResamplingMethod method)
Set resampling method to apply for zoomed-in operations.
virtual bool remove()
Remove dataset.
virtual double sourceNoDataValue(int bandNo) const
Value representing no data value.
virtual QImage getLegendGraphic(double scale=0, bool forceRefresh=false, const QgsRectangle *visibleExtent=nullptr)
Returns the legend rendered as pixmap.
virtual bool reload()
Reload data (data could change).
QList< QgsRasterRangeList > mUserNoDataValue
List of lists of user defined additional no data values for each band, indexed from 0.
virtual bool isEditable() const
Checks whether the provider is in editing mode, i.e.
QString colorName(Qgis::RasterColorInterpretation colorInterpretation) const
Returns a string color name representation of a color interpretation.
virtual bool setZoomedOutResamplingMethod(Qgis::RasterResamplingMethod method)
Set resampling method to apply for zoomed-out operations.
Qgis::RasterResamplingMethod mZoomedInResamplingMethod
Resampling method for zoomed in pixel extraction.
virtual bool enableProviderResampling(bool enable)
Enable or disable provider-level resampling.
void setDpi(int dpi)
Sets the output device resolution.
QDateTime timestamp() const override
Time stamp of data source in the moment when data/metadata were loaded by provider.
virtual bool closeWithProgress(QgsFeedback *feedback)
Close the provider with feedback.
virtual bool hasReportsDuringClose() const
Returns whether closeWithProgress() will actually report closing progress.
QgsRectangle extent() const override=0
Returns the extent of the layer.
virtual bool setMaxOversampling(double factor)
Sets maximum oversampling factor for zoomed-out operations.
Qgis::DataType dataType(int bandNo) const override=0
Returns data type for the band specified by number.
virtual QString validatePyramidsConfigOptions(Qgis::RasterPyramidFormat pyramidsFormat, const QStringList &configOptions, const QString &fileFormat)
Validates pyramid creation options for a specific dataset and destination format.
double maxOversampling() const
Returns maximum oversampling factor for zoomed-out operations.
QStringList subLayers() const override
Returns the sublayers of this layer - useful for providers that manage their own layers,...
virtual double bandScale(int bandNo) const
Read band scale for raster value.
int dpi() const
Returns the dpi of the output device.
Qgis::RasterResamplingMethod zoomedOutResamplingMethod() const
Returns resampling method for zoomed-out operations.
virtual Qgis::RasterColorInterpretation colorInterpretation(int bandNo) const
Returns data type for the band specified by number.
QDateTime dataTimestamp() const override
Current time stamp of data source.
virtual QList< QgsColorRampShader::ColorRampItem > colorTable(int bandNo) const
QList< double > mSrcNoDataValue
Source no data value is available and is set to be used or internal no data is available.
virtual QgsImageFetcher * getLegendGraphicFetcher(const QgsMapSettings *mapSettings)
Returns a new image downloader for the raster legend.
virtual bool readBlock(int bandNo, int xBlock, int yBlock, void *data)
Reads a block of raster data into data.
virtual Qgis::RasterProviderCapabilities providerCapabilities() const
Returns flags containing the supported capabilities of the data provider.
bool setInput(QgsRasterInterface *input) override
Set input.
QList< bool > mSrcHasNoDataValue
Source no data value exists.
Qgis::RasterResamplingMethod mZoomedOutResamplingMethod
Resampling method for zoomed out pixel extraction.
void statusChanged(const QString &) const
Emit a message to be displayed on status bar, usually used by network providers (WMS,...
virtual QgsRasterRangeList userNoDataValues(int bandNo) const
Returns a list of user no data value ranges.
virtual int stepHeight() const
Step height for raster iterations.
virtual bool setEditable(bool enabled)
Turns on/off editing mode of the provider.
virtual int stepWidth() const
Step width for raster iterations.
virtual QString lastErrorTitle()=0
Returns the caption error text for the last error in this provider.
virtual bool supportsLegendGraphic() const
Returns whether the provider supplies a legend graphic.
virtual QList< QgsRasterPyramid > buildPyramidList(const QList< int > &overviewList=QList< int >())
Returns the raster layers pyramid list.
Raster identify results container.
QgsRasterInterface(QgsRasterInterface *input=nullptr)
virtual QgsRasterInterface * input() const
Current input.
static const int DEFAULT_MAXIMUM_TILE_WIDTH
Default maximum tile width.
static const int DEFAULT_MAXIMUM_TILE_HEIGHT
Default maximum tile height.
A rectangle specified with double values.
QList< QgsRasterRange > QgsRasterRangeList
Setting options for creating vector data providers.
Struct that stores the information about the parameters that should be given to the QgsVirtualRasterP...
QList< QgsRasterDataProvider::VirtualRasterInputLayers > rInputLayers
QgsCoordinateReferenceSystem crs