QGIS API Documentation  2.99.0-Master (314842d)
qgsrasterdataprovider.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  qgsrasterdataprovider.cpp - DataProvider Interface for raster layers
3  --------------------------------------
4  Date : Mar 11, 2005
5  Copyright : (C) 2005 by Brendan Morley
6  email : morb at ozemail dot com dot au
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 
18 #include "qgsproviderregistry.h"
19 #include "qgsrasterdataprovider.h"
21 #include "qgsrasterprojector.h"
22 #include "qgslogger.h"
23 #include "qgsapplication.h"
24 
25 #include <QTime>
26 #include <QMap>
27 #include <QByteArray>
28 #include <QVariant>
29 
30 #include <qmath.h>
31 
32 #define ERR(message) QgsError(message, "Raster provider")
33 
35 {
36  if ( mUseSrcNoDataValue.size() < bandNo )
37  {
38  for ( int i = mUseSrcNoDataValue.size(); i < bandNo; i++ )
39  {
40  mUseSrcNoDataValue.append( false );
41  }
42  }
43  mUseSrcNoDataValue[bandNo - 1] = use;
44 }
45 
46 QgsRasterBlock *QgsRasterDataProvider::block( int bandNo, QgsRectangle const &boundingBox, int width, int height, QgsRasterBlockFeedback *feedback )
47 {
48  QgsDebugMsgLevel( QString( "bandNo = %1 width = %2 height = %3" ).arg( bandNo ).arg( width ).arg( height ), 4 );
49  QgsDebugMsgLevel( QString( "boundingBox = %1" ).arg( boundingBox.toString() ), 4 );
50 
51  QgsRasterBlock *block = new QgsRasterBlock( dataType( bandNo ), width, height );
52  if ( sourceHasNoDataValue( bandNo ) && useSourceNoDataValue( bandNo ) )
53  {
54  block->setNoDataValue( sourceNoDataValue( bandNo ) );
55  }
56 
57  if ( block->isEmpty() )
58  {
59  QgsDebugMsg( "Couldn't create raster block" );
60  return block;
61  }
62 
63  // Read necessary extent only
64  QgsRectangle tmpExtent = extent().intersect( &boundingBox );
65 
66  if ( tmpExtent.isEmpty() )
67  {
68  QgsDebugMsg( "Extent outside provider extent" );
69  block->setIsNoData();
70  return block;
71  }
72 
73  double xRes = boundingBox.width() / width;
74  double yRes = boundingBox.height() / height;
75  double tmpXRes, tmpYRes;
76  double providerXRes = 0;
77  double providerYRes = 0;
78  if ( capabilities() & Size )
79  {
80  providerXRes = extent().width() / xSize();
81  providerYRes = extent().height() / ySize();
82  tmpXRes = qMax( providerXRes, xRes );
83  tmpYRes = qMax( providerYRes, yRes );
84  if ( qgsDoubleNear( tmpXRes, xRes ) ) tmpXRes = xRes;
85  if ( qgsDoubleNear( tmpYRes, yRes ) ) tmpYRes = yRes;
86  }
87  else
88  {
89  tmpXRes = xRes;
90  tmpYRes = yRes;
91  }
92 
93  if ( tmpExtent != boundingBox ||
94  tmpXRes > xRes || tmpYRes > yRes )
95  {
96  // Read smaller extent or lower resolution
97 
98  if ( !extent().contains( boundingBox ) )
99  {
100  QRect subRect = QgsRasterBlock::subRect( boundingBox, width, height, extent() );
101  block->setIsNoDataExcept( subRect );
102  }
103 
104  // Calculate row/col limits (before tmpExtent is aligned)
105  int fromRow = qRound( ( boundingBox.yMaximum() - tmpExtent.yMaximum() ) / yRes );
106  int toRow = qRound( ( boundingBox.yMaximum() - tmpExtent.yMinimum() ) / yRes ) - 1;
107  int fromCol = qRound( ( tmpExtent.xMinimum() - boundingBox.xMinimum() ) / xRes );
108  int toCol = qRound( ( tmpExtent.xMaximum() - boundingBox.xMinimum() ) / xRes ) - 1;
109 
110  QgsDebugMsgLevel( QString( "fromRow = %1 toRow = %2 fromCol = %3 toCol = %4" ).arg( fromRow ).arg( toRow ).arg( fromCol ).arg( toCol ), 4 );
111 
112  if ( fromRow < 0 || fromRow >= height || toRow < 0 || toRow >= height ||
113  fromCol < 0 || fromCol >= width || toCol < 0 || toCol >= width )
114  {
115  // Should not happen
116  QgsDebugMsg( "Row or column limits out of range" );
117  return block;
118  }
119 
120  // If lower source resolution is used, the extent must beS aligned to original
121  // resolution to avoid possible shift due to resampling
122  if ( tmpXRes > xRes )
123  {
124  int col = floor( ( tmpExtent.xMinimum() - extent().xMinimum() ) / providerXRes );
125  tmpExtent.setXMinimum( extent().xMinimum() + col * providerXRes );
126  col = ceil( ( tmpExtent.xMaximum() - extent().xMinimum() ) / providerXRes );
127  tmpExtent.setXMaximum( extent().xMinimum() + col * providerXRes );
128  }
129  if ( tmpYRes > yRes )
130  {
131  int row = floor( ( extent().yMaximum() - tmpExtent.yMaximum() ) / providerYRes );
132  tmpExtent.setYMaximum( extent().yMaximum() - row * providerYRes );
133  row = ceil( ( extent().yMaximum() - tmpExtent.yMinimum() ) / providerYRes );
134  tmpExtent.setYMinimum( extent().yMaximum() - row * providerYRes );
135  }
136  int tmpWidth = qRound( tmpExtent.width() / tmpXRes );
137  int tmpHeight = qRound( tmpExtent.height() / tmpYRes );
138  tmpXRes = tmpExtent.width() / tmpWidth;
139  tmpYRes = tmpExtent.height() / tmpHeight;
140 
141  QgsDebugMsgLevel( QString( "Reading smaller block tmpWidth = %1 height = %2" ).arg( tmpWidth ).arg( tmpHeight ), 4 );
142  QgsDebugMsgLevel( QString( "tmpExtent = %1" ).arg( tmpExtent.toString() ), 4 );
143 
144  QgsRasterBlock *tmpBlock = new QgsRasterBlock( dataType( bandNo ), tmpWidth, tmpHeight );
145  if ( sourceHasNoDataValue( bandNo ) && useSourceNoDataValue( bandNo ) )
146  {
147  tmpBlock->setNoDataValue( sourceNoDataValue( bandNo ) );
148  }
149 
150  readBlock( bandNo, tmpExtent, tmpWidth, tmpHeight, tmpBlock->bits(), feedback );
151 
152  int pixelSize = dataTypeSize( bandNo );
153 
154  double xMin = boundingBox.xMinimum();
155  double yMax = boundingBox.yMaximum();
156  double tmpXMin = tmpExtent.xMinimum();
157  double tmpYMax = tmpExtent.yMaximum();
158 
159  for ( int row = fromRow; row <= toRow; row++ )
160  {
161  double y = yMax - ( row + 0.5 ) * yRes;
162  int tmpRow = floor( ( tmpYMax - y ) / tmpYRes );
163 
164  for ( int col = fromCol; col <= toCol; col++ )
165  {
166  double x = xMin + ( col + 0.5 ) * xRes;
167  int tmpCol = floor( ( x - tmpXMin ) / tmpXRes );
168 
169  if ( tmpRow < 0 || tmpRow >= tmpHeight || tmpCol < 0 || tmpCol >= tmpWidth )
170  {
171  QgsDebugMsg( "Source row or column limits out of range" );
172  block->setIsNoData(); // so that the problem becomes obvious and fixed
173  delete tmpBlock;
174  return block;
175  }
176 
177  qgssize tmpIndex = static_cast< qgssize >( tmpRow ) * static_cast< qgssize >( tmpWidth ) + tmpCol;
178  qgssize index = row * static_cast< qgssize >( width ) + col;
179 
180  char *tmpBits = tmpBlock->bits( tmpIndex );
181  char *bits = block->bits( index );
182  if ( !tmpBits )
183  {
184  QgsDebugMsg( QString( "Cannot get input block data tmpRow = %1 tmpCol = %2 tmpIndex = %3." ).arg( tmpRow ).arg( tmpCol ).arg( tmpIndex ) );
185  continue;
186  }
187  if ( !bits )
188  {
189  QgsDebugMsg( "Cannot set output block data." );
190  continue;
191  }
192  memcpy( bits, tmpBits, pixelSize );
193  }
194  }
195 
196  delete tmpBlock;
197  }
198  else
199  {
200  readBlock( bandNo, boundingBox, width, height, block->bits(), feedback );
201  }
202 
203  // apply scale and offset
204  block->applyScaleOffset( bandScale( bandNo ), bandOffset( bandNo ) );
205  // apply user no data values
206  block->applyNoDataValues( userNoDataValues( bandNo ) );
207  return block;
208 }
209 
211  : QgsRasterInterface( nullptr )
212  , mDpi( -1 )
213 {
214 }
215 
217  : QgsDataProvider( uri )
218  , QgsRasterInterface( nullptr )
219  , mDpi( -1 )
220 {
221 }
222 
223 //
224 //Random Static convenience function
225 //
227 // convenience function for building metadata() HTML table cells
228 // convenience function for creating a string list from a C style string list
229 QStringList QgsRasterDataProvider::cStringList2Q_( char **stringList )
230 {
231  QStringList strings;
232 
233  // presume null terminated string list
234  for ( qgssize i = 0; stringList[i]; ++i )
235  {
236  strings.append( stringList[i] );
237  }
238 
239  return strings;
240 
241 } // cStringList2Q_
242 
243 QString QgsRasterDataProvider::makeTableCell( QString const &value )
244 {
245  return "<p>\n" + value + "</p>\n";
246 } // makeTableCell_
247 
248 // convenience function for building metadata() HTML table cells
249 QString QgsRasterDataProvider::makeTableCells( QStringList const &values )
250 {
251  QString s( QStringLiteral( "<tr>" ) );
252 
253  for ( QStringList::const_iterator i = values.begin();
254  i != values.end();
255  ++i )
256  {
258  }
259 
260  s += QLatin1String( "</tr>" );
261 
262  return s;
263 } // makeTableCell_
264 
266 {
267  QString s;
268  return s;
269 }
270 
271 // Default implementation for values
272 QgsRasterIdentifyResult QgsRasterDataProvider::identify( const QgsPoint &point, QgsRaster::IdentifyFormat format, const QgsRectangle &boundingBox, int width, int height, int /*dpi*/ )
273 {
274  QgsDebugMsgLevel( "Entered", 4 );
275  QMap<int, QVariant> results;
276 
277  if ( format != QgsRaster::IdentifyFormatValue || !( capabilities() & IdentifyValue ) )
278  {
279  QgsDebugMsg( "Format not supported" );
280  return QgsRasterIdentifyResult( ERR( tr( "Format not supported" ) ) );
281  }
282 
283  if ( !extent().contains( point ) )
284  {
285  // Outside the raster
286  for ( int bandNo = 1; bandNo <= bandCount(); bandNo++ )
287  {
288  results.insert( bandNo, QVariant() );
289  }
291  }
292 
293  QgsRectangle finalExtent = boundingBox;
294  if ( finalExtent.isEmpty() )
295  finalExtent = extent();
296 
297  if ( width == 0 )
298  {
299  width = capabilities() & Size ? xSize() : 1000;
300  }
301  if ( height == 0 )
302  {
303  height = capabilities() & Size ? ySize() : 1000;
304  }
305 
306  // Calculate the row / column where the point falls
307  double xres = ( finalExtent.width() ) / width;
308  double yres = ( finalExtent.height() ) / height;
309 
310  int col = static_cast< int >( floor( ( point.x() - finalExtent.xMinimum() ) / xres ) );
311  int row = static_cast< int >( floor( ( finalExtent.yMaximum() - point.y() ) / yres ) );
312 
313  double xMin = finalExtent.xMinimum() + col * xres;
314  double xMax = xMin + xres;
315  double yMax = finalExtent.yMaximum() - row * yres;
316  double yMin = yMax - yres;
317  QgsRectangle pixelExtent( xMin, yMin, xMax, yMax );
318 
319  for ( int i = 1; i <= bandCount(); i++ )
320  {
321  QgsRasterBlock *myBlock = block( i, pixelExtent, 1, 1 );
322 
323  if ( myBlock )
324  {
325  double value = myBlock->value( 0 );
326 
327  results.insert( i, value );
328  delete myBlock;
329  }
330  else
331  {
332  results.insert( i, QVariant() );
333  }
334  }
336 }
337 
339 {
340  return QStringLiteral( "text/plain" );
341 }
342 
343 bool QgsRasterDataProvider::writeBlock( QgsRasterBlock *block, int band, int xOffset, int yOffset )
344 {
345  if ( !block )
346  return false;
347  if ( !isEditable() )
348  {
349  QgsDebugMsg( "writeBlock() called on read-only provider." );
350  return false;
351  }
352  return write( block->bits(), band, block->width(), block->height(), xOffset, yOffset );
353 }
354 
355 typedef QList<QPair<QString, QString> > *pyramidResamplingMethods_t();
356 QList<QPair<QString, QString> > QgsRasterDataProvider::pyramidResamplingMethods( const QString &providerKey )
357 {
358  pyramidResamplingMethods_t *pPyramidResamplingMethods = reinterpret_cast< pyramidResamplingMethods_t * >( cast_to_fptr( QgsProviderRegistry::instance()->function( providerKey, "pyramidResamplingMethods" ) ) );
359  if ( pPyramidResamplingMethods )
360  {
361  QList<QPair<QString, QString> > *methods = pPyramidResamplingMethods();
362  if ( !methods )
363  {
364  QgsDebugMsg( "provider pyramidResamplingMethods returned no methods" );
365  }
366  else
367  {
368  return *methods;
369  }
370  }
371  else
372  {
373  QgsDebugMsg( "Could not resolve pyramidResamplingMethods provider library" );
374  }
375  return QList<QPair<QString, QString> >();
376 }
377 
379 {
380  QList<QgsRasterPyramid> myPyramidList = buildPyramidList();
381 
382  if ( myPyramidList.isEmpty() )
383  return false;
384 
385  QList<QgsRasterPyramid>::iterator myRasterPyramidIterator;
386  for ( myRasterPyramidIterator = myPyramidList.begin();
387  myRasterPyramidIterator != myPyramidList.end();
388  ++myRasterPyramidIterator )
389  {
390  if ( myRasterPyramidIterator->exists )
391  {
392  return true;
393  }
394  }
395  return false;
396 }
397 
399 {
400  if ( bandNo >= mUserNoDataValue.size() )
401  {
402  for ( int i = mUserNoDataValue.size(); i < bandNo; i++ )
403  {
405  }
406  }
407  QgsDebugMsgLevel( QString( "set %1 band %1 no data ranges" ).arg( noData.size() ), 4 );
408 
409  if ( mUserNoDataValue[bandNo - 1] != noData )
410  {
411  // Clear statistics
412  int i = 0;
413  while ( i < mStatistics.size() )
414  {
415  if ( mStatistics.value( i ).bandNumber == bandNo )
416  {
417  mStatistics.removeAt( i );
418  mHistograms.removeAt( i );
419  }
420  else
421  {
422  i++;
423  }
424  }
425  mUserNoDataValue[bandNo - 1] = noData;
426  }
427 }
428 
429 typedef QgsRasterDataProvider *createFunction_t( const QString &,
430  const QString &, int,
432  int, int, double *,
434  QStringList );
435 
437  const QString &uri,
438  const QString &format, int nBands,
439  Qgis::DataType type,
440  int width, int height, double *geoTransform,
442  const QStringList &createOptions )
443 {
444  createFunction_t *createFn = reinterpret_cast< createFunction_t * >( cast_to_fptr( QgsProviderRegistry::instance()->function( providerKey, "create" ) ) );
445  if ( !createFn )
446  {
447  QgsDebugMsg( "Cannot resolve 'create' function in " + providerKey + " provider" );
448  // TODO: it would be good to return invalid QgsRasterDataProvider
449  // with QgsError set, but QgsRasterDataProvider has pure virtual methods
450  return nullptr;
451  }
452  return createFn( uri, format, nBands, type, width, height, geoTransform, crs, createOptions );
453 }
454 
456 {
457  switch ( format )
458  {
460  return QStringLiteral( "Value" );
462  return QStringLiteral( "Text" );
464  return QStringLiteral( "Html" );
466  return QStringLiteral( "Feature" );
467  default:
468  return QStringLiteral( "Undefined" );
469  }
470 }
471 
473 {
474  switch ( format )
475  {
477  return tr( "Value" );
479  return tr( "Text" );
481  return tr( "Html" );
483  return tr( "Feature" );
484  default:
485  return QStringLiteral( "Undefined" );
486  }
487 }
488 
490 {
491  if ( formatName == QLatin1String( "Value" ) ) return QgsRaster::IdentifyFormatValue;
492  if ( formatName == QLatin1String( "Text" ) ) return QgsRaster::IdentifyFormatText;
493  if ( formatName == QLatin1String( "Html" ) ) return QgsRaster::IdentifyFormatHtml;
494  if ( formatName == QLatin1String( "Feature" ) ) return QgsRaster::IdentifyFormatFeature;
496 }
497 
499 {
500  switch ( format )
501  {
503  return IdentifyValue;
505  return IdentifyText;
507  return IdentifyHtml;
509  return IdentifyFeature;
510  default:
511  return NoCapabilities;
512  }
513 }
514 
515 bool QgsRasterDataProvider::userNoDataValuesContains( int bandNo, double value ) const
516 {
517  QgsRasterRangeList rangeList = mUserNoDataValue.value( bandNo - 1 );
518  return QgsRasterRange::contains( value, rangeList );
519 }
520 
522 {
523  mDpi = other.mDpi;
528  mExtent = other.mExtent;
529 }
530 
531 // ENDS
virtual QgsRectangle extent() const override=0
Returns the extent of the layer.
bool hasPyramids()
Returns true if raster has at least one populated histogram.
virtual int bandCount() const =0
Get number of bands.
void setNoDataValue(double noDataValue)
Sets cell value that will be considered as "no data".
virtual void readBlock(int bandNo, int xBlock, int yBlock, void *data)
Read block of data.
static unsigned index
IdentifyFormat
Definition: qgsraster.h:72
static QgsProviderRegistry * instance(const QString &pluginPath=QString::null)
Means of accessing canonical single instance.
A rectangle specified with double values.
Definition: qgsrectangle.h:36
double y
Definition: qgspoint.h:42
void copyBaseSettings(const QgsRasterDataProvider &other)
Copy member variables from other raster data provider. Useful for implementation of clone() method in...
virtual void setUseSourceNoDataValue(int bandNo, bool use)
Set source nodata value usage.
virtual QgsRasterIdentifyResult identify(const QgsPoint &point, QgsRaster::IdentifyFormat format, const QgsRectangle &boundingBox=QgsRectangle(), int width=0, int height=0, int dpi=96)
Identify raster value(s) found on the point position.
static bool contains(double value, const QgsRasterRangeList &rangeList)
Test if value is within the list of ranges.
void setXMaximum(double x)
Set the maximum x value.
Definition: qgsrectangle.h:180
#define QgsDebugMsg(str)
Definition: qgslogger.h:36
virtual double bandOffset(int bandNo) const
Read band offset for raster value.
bool userNoDataValuesContains(int bandNo, double value) const
Returns true if user no data contains value.
void applyNoDataValues(const QgsRasterRangeList &rangeList)
bool setIsNoDataExcept(QRect exceptRect)
Set the whole block to no data except specified rectangle.
int height() const
Returns the height (number of rows) of the raster block.
static QString makeTableCell(const QString &value)
DataType
Raster data types.
Definition: qgis.h:61
virtual int ySize() const
Capability
If you add to this, please also add to capabilitiesString()
static Capability identifyFormatToCapability(QgsRaster::IdentifyFormat format)
QgsRectangle intersect(const QgsRectangle *rect) const
return the intersection with the given rectangle
Abstract base class for spatial data provider implementations.
virtual double sourceNoDataValue(int bandNo) const
Value representing no data value.
bool qgsDoubleNear(double a, double b, double epsilon=4 *DBL_EPSILON)
Compare two doubles (but allow some difference)
Definition: qgis.h:198
static QRect subRect(const QgsRectangle &extent, int width, int height, const QgsRectangle &subExtent)
For extent and width, height find rectangle covered by subextent.
static QString identifyFormatName(QgsRaster::IdentifyFormat format)
QgsRasterDataProvider * createFunction_t(const QString &, const QString &, int, Qgis::DataType, int, int, double *, const QgsCoordinateReferenceSystem &, QStringList)
bool setIsNoData(int row, int column)
Set no data on pixel.
virtual QString lastErrorFormat()
Returns the format of the error text for the last error in this provider.
Raster identify results container.
virtual Qgis::DataType dataType(int bandNo) const override=0
Returns data type for the band specified by number.
Raster data container.
#define QgsDebugMsgLevel(str, level)
Definition: qgslogger.h:37
bool isEmpty() const
test if rectangle is empty.
virtual QList< QgsRasterPyramid > buildPyramidList(QList< int > overviewList=QList< int >())
Accessor for the raster layers pyramid list.
static QgsRaster::IdentifyFormat identifyFormatFromName(const QString &formatName)
virtual int capabilities() const
Returns a bitmask containing the supported capabilities.
virtual QgsCoordinateReferenceSystem crs() const =0
Returns the coordinate system for the data source.
double width() const
Width of the rectangle.
Definition: qgsrectangle.h:215
void setYMinimum(double y)
Set the minimum y value.
Definition: qgsrectangle.h:185
QList< QgsRasterHistogram > mHistograms
List of cached histograms, all bands mixed.
QString toString(int precision=16) const
returns a string representation of form xmin,ymin : xmax,ymax Coordinates will be truncated to the sp...
QList< bool > mSrcHasNoDataValue
Source no data value exists.
bool isEmpty() const
Returns true if block is empty, i.e.
#define cast_to_fptr(f)
Definition: qgis.h:128
Base class for processing filters like renderers, reprojector, resampler etc.
virtual bool isEditable() const
Checks whether the provider is in editing mode, i.e.
A class to represent a point.
Definition: qgspoint.h:37
virtual bool sourceHasNoDataValue(int bandNo) const
Return true if source band has no data value.
unsigned long long qgssize
Qgssize is used instead of size_t, because size_t is stdlib type, unknown by SIP, and it would be har...
Definition: qgis.h:349
QList< double > mSrcNoDataValue
Source no data value is available and is set to be used or internal no data is available.
int width() const
Returns the width (number of columns) of the raster block.
double yMinimum() const
Get the y minimum value (bottom side of rectangle)
Definition: qgsrectangle.h:210
static QList< QPair< QString, QString > > pyramidResamplingMethods(const QString &providerKey)
Returns a list of pyramid resampling method name and label pairs for given provider.
double xMaximum() const
Get the x maximum value (right side of rectangle)
Definition: qgsrectangle.h:195
QList< QPair< QString, QString > > * pyramidResamplingMethods_t()
virtual QgsRasterBlock * block(int bandNo, const QgsRectangle &boundingBox, int width, int height, QgsRasterBlockFeedback *feedback=nullptr) override
Read block of data using given extent and size.
char * bits(int row, int column)
Get pointer to data.
QList< QgsRasterRange > QgsRasterRangeList
void applyScaleOffset(double scale, double offset)
Apply band scale and offset to raster block values @note added in 2.3.
void setYMaximum(double y)
Set the maximum y value.
Definition: qgsrectangle.h:190
virtual QString metadata()=0
Get metadata in a format suitable for feeding directly into a subset of the GUI raster properties "Me...
static QString makeTableCells(const QStringList &values)
This class represents a coordinate reference system (CRS).
double value(int row, int column) const
Read a single value if type of block is numeric.
int dataTypeSize(int bandNo)
double xMinimum() const
Get the x minimum value (left side of rectangle)
Definition: qgsrectangle.h:200
virtual QgsRasterRangeList userNoDataValues(int bandNo) const
Get list of user no data value ranges.
static QStringList cStringList2Q_(char **stringList)
double yMaximum() const
Get the y maximum value (top side of rectangle)
Definition: qgsrectangle.h:205
virtual bool write(void *data, int band, int width, int height, int xOffset, int yOffset)
Writes into the provider datasource.
virtual bool useSourceNoDataValue(int bandNo) const
Get source nodata value usage.
QList< QgsRasterBandStats > mStatistics
List of cached statistics, all bands mixed.
virtual void setUserNoDataValue(int bandNo, const QgsRasterRangeList &noData)
bool writeBlock(QgsRasterBlock *block, int band, int xOffset=0, int yOffset=0)
Writes pixel data from a raster block into the provider data source.
Feedback object tailored for raster block reading.
static QString identifyFormatLabel(QgsRaster::IdentifyFormat format)
virtual int xSize() const
Get raster size.
#define ERR(message)
void setXMinimum(double x)
Set the minimum x value.
Definition: qgsrectangle.h:175
double height() const
Height of the rectangle.
Definition: qgsrectangle.h:220
Base class for raster data providers.
static QgsRasterDataProvider * create(const QString &providerKey, const QString &uri, const QString &format, int nBands, Qgis::DataType type, int width, int height, double *geoTransform, const QgsCoordinateReferenceSystem &crs, const QStringList &createOptions=QStringList())
Creates a new dataset with mDataSourceURI.
QList< QgsRasterRangeList > mUserNoDataValue
List of lists of user defined additional no data values for each band, indexed from 0...
QList< bool > mUseSrcNoDataValue
Use source nodata value.
double x
Definition: qgspoint.h:41
virtual double bandScale(int bandNo) const
Read band scale for raster value.