23 #ifndef QGSRASTERDATAPROVIDER_H 24 #define QGSRASTERDATAPROVIDER_H 70 virtual void start() = 0;
75 void finish(
const QImage& legend );
77 void progress( qint64 received, qint64 total );
79 void error(
const QString& msg );
109 virtual QImage* draw(
const QgsRectangle & viewExtent,
int pixelWidth,
int pixelHeight ) = 0;
127 Q_UNUSED( theBandNo );
134 switch ( colorInterpretation )
196 return colorName( colorInterpretation( theBandNo ) );
202 virtual double bandScale(
int bandNo )
const { Q_UNUSED( bandNo );
return 1.0; }
206 virtual double bandOffset(
int bandNo )
const { Q_UNUSED( bandNo );
return 0.0; }
215 virtual bool srcHasNoDataValue(
int bandNo )
const {
return mSrcHasNoDataValue.value( bandNo -1 ); }
218 virtual bool useSrcNoDataValue(
int bandNo )
const {
return mUseSrcNoDataValue.value( bandNo -1 ); }
221 virtual void setUseSrcNoDataValue(
int bandNo,
bool use );
224 virtual double srcNoDataValue(
int bandNo )
const {
return mSrcNoDataValue.value( bandNo -1 ); }
255 Q_UNUSED( forceRefresh );
256 Q_UNUSED( visibleExtent );
275 Q_UNUSED( mapSettings );
281 const QString & theResamplingMethod =
"NEAREST",
285 Q_UNUSED( thePyramidList );
286 Q_UNUSED( theResamplingMethod );
287 Q_UNUSED( theFormat );
288 Q_UNUSED( theConfigOptions );
289 return "FAILED_NOT_SUPPORTED";
309 virtual QString metadata() = 0;
346 virtual QString lastErrorTitle() = 0;
357 virtual QString lastError() = 0;
360 virtual QString lastErrorFormat();
363 int dpi()
const {
return mDpi; }
376 virtual bool write(
void* data,
int band,
int width,
int height,
int xOffset,
int yOffset )
390 const QString& format,
int nBands,
392 int width,
int height,
double* geoTransform,
400 virtual bool setNoDataValue(
int bandNo,
double noDataValue ) { Q_UNUSED( bandNo ); Q_UNUSED( noDataValue );
return false; }
403 virtual bool remove() {
return false; }
415 { Q_UNUSED( createOptions ); Q_UNUSED( format );
return QString(); }
422 { Q_UNUSED( pyramidsFormat ); Q_UNUSED( theConfigOptions ); Q_UNUSED( fileFormat );
return QString(); }
432 void progress(
int theType,
double theProgress,
const QString& theMessage );
433 void progressUpdate(
int theProgress );
438 void statusChanged(
const QString& );
444 virtual void readBlock(
int bandNo,
int xBlock,
int yBlock,
void *data )
445 { Q_UNUSED( bandNo ); Q_UNUSED( xBlock ); Q_UNUSED( yBlock ); Q_UNUSED( data ); }
451 { Q_UNUSED( bandNo ); Q_UNUSED( viewExtent ); Q_UNUSED( width ); Q_UNUSED( height ); Q_UNUSED( data ); Q_UNUSED( feedback ); }
454 bool userNoDataValuesContains(
int bandNo,
double value )
const;
460 static QStringList cStringList2Q_(
char ** stringList );
virtual void readBlock(int bandNo, int xBlock, int yBlock, void *data)
Read block of data.
A rectangle specified with double values.
bool setInput(QgsRasterInterface *input) override
Set input.
virtual QDateTime timestamp() const override
Time stamp of data source in the moment when data/metadata were loaded by provider.
Black band of CMLY image.
Handles asynchronous download of images.
virtual QString validatePyramidsConfigOptions(QgsRaster::RasterPyramidsFormat pyramidsFormat, const QStringList &theConfigOptions, const QString &fileFormat)
Validates pyramid creation options for a specific dataset and destination format. ...
virtual QList< QgsColorRampShader::ColorRampItem > colorTable(int bandNo) const
static QStringList mPyramidResamplingListGdal
virtual double bandOffset(int bandNo) const
Read band offset for raster value.
virtual ~QgsRasterDataProvider()
QDateTime mTimestamp
Timestamp of data in the moment when the data were loaded by provider.
virtual QgsImageFetcher * getLegendGraphicFetcher(const QgsMapSettings *mapSettings)
Get an image downloader for the raster legend.
Capability
If you add to this, please also add to capabilitiesString()
virtual QImage getLegendGraphic(double scale=0, bool forceRefresh=false, const QgsRectangle *visibleExtent=nullptr)
Returns the legend rendered as pixmap.
virtual bool supportsLegendGraphic() const
Returns whether the provider supplies a legend graphic.
virtual bool setNoDataValue(int bandNo, double noDataValue)
Set no data value on created dataset.
Abstract base class for spatial data provider implementations.
virtual QgsRasterBlock * block2(int bandNo, const QgsRectangle &extent, int width, int height, QgsRasterBlockFeedback *feedback=nullptr)
Read block of data using given extent and size.
The QgsMapSettings class contains configuration for rendering of the map.
Raster identify results container.
Lightness band of HLS image.
int dpi() const
Returns the dpi of the output device.
Paletted (see associated color table)
Alpha (0=transparent, 255=opaque)
Green band of RGBA image.
virtual QList< QgsRasterPyramid > buildPyramidList(QList< int > overviewList=QList< int >())
Accessor for ths raster layers pyramid list.
virtual QStringList subLayers() const override
Returns the sublayers of this layer - useful for providers that manage their own layers, such as WMS.
virtual bool reload()
Reload data (data could change)
QList< bool > mSrcHasNoDataValue
Source no data value exists.
virtual QGis::DataType srcDataType(int bandNo) const
Returns source data type for the band specified by number, source data type may be shorter than dataT...
virtual QGis::DataType dataType(int bandNo) const =0
Returns data type for the band specified by number.
virtual void readBlock(int bandNo, QgsRectangle const &viewExtent, int width, int height, void *data, QgsRasterBlockFeedback *feedback=nullptr)
Read block of data using give extent and size.
Base class for processing filters like renderers, reprojector, resampler etc.
A class to represent a point.
virtual bool useSrcNoDataValue(int bandNo) const
Get source nodata value usage.
Saturation band of HLS image.
QList< double > mSrcNoDataValue
Source no data value is available and is set to be used or internal no data is available.
virtual QString colorInterpretationName(int theBandNo) const
virtual QgsRectangle extent()=0
Get the extent of the layer.
QString colorName(int colorInterpretation) const
virtual ~QgsImageFetcher()
Destructor.
virtual QgsRasterInterface * clone() const =0
Clone itself, create deep copy.
Class for storing a coordinate reference system (CRS)
DataType
Raster data types.
virtual QgsRasterBlock * block(int bandNo, const QgsRectangle &extent, int width, int height)=0
Read block of data using given extent and size.
virtual int colorInterpretation(int theBandNo) const
Returns data type for the band specified by number.
virtual QgsRasterRangeList userNoDataValues(int bandNo) const
Get list of user no data value ranges.
virtual QString buildPyramids(const QList< QgsRasterPyramid > &thePyramidList, const QString &theResamplingMethod="NEAREST", QgsRaster::RasterPyramidsFormat theFormat=QgsRaster::PyramidsGTiff, const QStringList &theConfigOptions=QStringList())
Create pyramid overviews.
Magenta band of CMYK image.
virtual QString validateCreationOptions(const QStringList &createOptions, const QString &format)
Validates creation options for a specific dataset and destination format.
virtual bool write(void *data, int band, int width, int height, int xOffset, int yOffset)
Writes into the provider datasource.
virtual bool srcHasNoDataValue(int bandNo) const
Return true if source band has no data value.
virtual double srcNoDataValue(int bandNo) const
Value representing no data value.
Feedback object tailored for raster block reading.
void setDpi(int dpi)
Sets the output device resolution.
virtual QDateTime dataTimestamp() const override
Current time stamp of data source.
QgsImageFetcher(QObject *parent=0)
Constructor.
Base class for raster data providers.
QList< QgsRasterRangeList > mUserNoDataValue
List of lists of user defined additional no data values for each band, indexed from 0...
static QgsStringMap mPyramidResamplingMapGdal
QList< bool > mUseSrcNoDataValue
Use source nodata value.
Yellow band of CMYK image.
virtual double bandScale(int bandNo) const
Read band scale for raster value.