20 #ifndef QGSRASTERDATAPROVIDER_H
21 #define QGSRASTERDATAPROVIDER_H
76 virtual QImage* draw(
const QgsRectangle & viewExtent,
int pixelWidth,
int pixelHeight ) = 0;
92 Q_UNUSED( theBandNo );
99 switch ( colorInterpretation )
161 return colorName( colorInterpretation( theBandNo ) );
166 virtual double bandScale(
int bandNo )
const { Q_UNUSED( bandNo );
return 1.0; }
169 virtual double bandOffset(
int bandNo )
const { Q_UNUSED( bandNo );
return 0.0; }
177 virtual bool srcHasNoDataValue(
int bandNo )
const {
return mSrcHasNoDataValue.value( bandNo -1 ); }
180 virtual bool useSrcNoDataValue(
int bandNo )
const {
return mUseSrcNoDataValue.value( bandNo -1 ); }
183 virtual void setUseSrcNoDataValue(
int bandNo,
bool use );
186 virtual double srcNoDataValue(
int bandNo )
const {
return mSrcNoDataValue.value( bandNo -1 ); }
193 virtual QList<QgsColorRampShader::ColorRampItem>
colorTable(
int bandNo )
const
194 { Q_UNUSED( bandNo );
return QList<QgsColorRampShader::ColorRampItem>(); }
200 return QStringList();
208 Q_UNUSED( forceRefresh );
213 virtual QString
buildPyramids(
const QList<QgsRasterPyramid> & thePyramidList,
214 const QString & theResamplingMethod =
"NEAREST",
216 const QStringList & theConfigOptions = QStringList() )
218 Q_UNUSED( thePyramidList ); Q_UNUSED( theResamplingMethod );
219 Q_UNUSED( theFormat ); Q_UNUSED( theConfigOptions );
220 return "FAILED_NOT_SUPPORTED";
231 { Q_UNUSED( overviewList );
return QList<QgsRasterPyramid>(); };
240 virtual QString metadata() = 0;
276 virtual QString lastErrorTitle() = 0;
287 virtual QString lastError() = 0;
294 virtual QString lastErrorFormat();
298 int dpi()
const {
return mDpi; }
312 virtual bool write(
void* data,
int band,
int width,
int height,
int xOffset,
int yOffset )
326 const QString& format,
int nBands,
328 int width,
int height,
double* geoTransform,
330 QStringList createOptions = QStringList() );
336 virtual bool setNoDataValue(
int bandNo,
double noDataValue ) { Q_UNUSED( bandNo ); Q_UNUSED( noDataValue );
return false; }
339 virtual bool remove() {
return false; }
343 static QList<QPair<QString, QString> > pyramidResamplingMethods( QString providerKey );
349 { Q_UNUSED( createOptions ); Q_UNUSED( format );
return QString(); }
354 const QStringList & theConfigOptions,
const QString & fileFormat )
355 { Q_UNUSED( pyramidsFormat ); Q_UNUSED( theConfigOptions ); Q_UNUSED( fileFormat );
return QString(); }
365 void progress(
int theType,
double theProgress, QString theMessage );
366 void progressUpdate(
int theProgress );
371 virtual void readBlock(
int bandNo,
int xBlock,
int yBlock,
void *data )
372 { Q_UNUSED( bandNo ); Q_UNUSED( xBlock ); Q_UNUSED( yBlock ); Q_UNUSED( data ); }
377 { Q_UNUSED( bandNo ); Q_UNUSED( viewExtent ); Q_UNUSED( width ); Q_UNUSED( height ); Q_UNUSED( data ); }
380 bool userNoDataValuesContains(
int bandNo,
double value )
const;
385 static QStringList cStringList2Q_(
char ** stringList );
387 static QString makeTableCell(
const QString & value );
388 static QString makeTableCells(
const QStringList & values );
416 static void initPyramidResamplingDefs();
virtual void readBlock(int bandNo, int xBlock, int yBlock, void *data)
Read block of data.
virtual QStringList subLayers() const
Returns the sublayers of this layer - useful for providers that manage their own layers, such as WMS.
A rectangle specified with double values.
virtual QString validatePyramidsConfigOptions(QgsRaster::RasterPyramidsFormat pyramidsFormat, const QStringList &theConfigOptions, const QString &fileFormat)
Validates pyramid creation options for a specific dataset and destination format. ...
static QStringList mPyramidResamplingListGdal
virtual ~QgsRasterDataProvider()
virtual double bandOffset(int bandNo) const
Read band offset for raster value @note added in 2.3.
virtual double srcNoDataValue(int bandNo) const
Value representing no data value.
QDateTime mTimestamp
Timestamp of data in the moment when the data were loaded by provider.
virtual QgsRasterRangeList userNoDataValues(int bandNo) const
Get list of user no data value ranges.
virtual bool setNoDataValue(int bandNo, double noDataValue)
Set no data value on created dataset.
Abstract base class for spatial data provider implementations.
QMap< QString, QString > QgsStringMap
virtual QDateTime dataTimestamp() const
Current time stamp of data source.
virtual bool useSrcNoDataValue(int bandNo) const
Get source nodata value usage.
Raster identify results container.
virtual void readBlock(int bandNo, QgsRectangle const &viewExtent, int width, int height, void *data)
Read block of data using give extent and size.
virtual QList< QgsRasterPyramid > buildPyramidList(QList< int > overviewList=QList< int >())
Accessor for ths raster layers pyramid list.
virtual bool reload()
Reload data (data could change)
QList< bool > mSrcHasNoDataValue
Source no data value exists.
bool setInput(QgsRasterInterface *input)
Set input.
virtual QGis::DataType dataType(int bandNo) const =0
Returns data type for the band specified by number.
Base class for processing filters like renderers, reprojector, resampler etc.
A class to represent a point geometry.
virtual QString colorInterpretationName(int theBandNo) const
QList< double > mSrcNoDataValue
Source no data value is available and is set to be used or internal no data is available.
virtual int colorInterpretation(int theBandNo) const
Returns data type for the band specified by number.
virtual double bandScale(int bandNo) const
Read band scale for raster value @note added in 2.3.
virtual QImage getLegendGraphic(double scale=0, bool forceRefresh=false)
Returns the legend rendered as pixmap useful for that layer that need to get legend layer remotly as ...
QString colorName(int colorInterpretation) const
virtual QgsRectangle extent()=0
Get the extent of the layer.
QList< QgsRasterRange > QgsRasterRangeList
virtual QgsRasterInterface * clone() const =0
Clone itself, create deep copy.
virtual QDateTime timestamp() const
Time stamp of data source in the moment when data/metadata were loaded by provider.
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 QString validateCreationOptions(const QStringList &createOptions, QString format)
Validates creation options for a specific dataset and destination format.
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 QString buildPyramids(const QList< QgsRasterPyramid > &thePyramidList, const QString &theResamplingMethod="NEAREST", QgsRaster::RasterPyramidsFormat theFormat=QgsRaster::PyramidsGTiff, const QStringList &theConfigOptions=QStringList())
Create pyramid overviews.
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
int dpi() const
Returns the dpi of the output device.
virtual QList< QgsColorRampShader::ColorRampItem > colorTable(int bandNo) const
void setDpi(int dpi)
Sets the output device resolution.
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.