QGIS API Documentation 4.1.0-Master (64dc32379c2)
Loading...
Searching...
No Matches
QgsRasterBlock Class Reference

Raster data container. More...

#include <qgsrasterblock.h>

Public Member Functions

 QgsRasterBlock ()
 QgsRasterBlock (Qgis::DataType dataType, int width, int height)
 Constructor which allocates data block in memory.
virtual ~QgsRasterBlock ()
void applyNoDataValues (const QgsRasterRangeList &rangeList)
void applyScaleOffset (double scale, double offset)
 Apply band scale and offset to raster block values.
char * bits ()
 Returns a pointer to block data.
char * bits (int row, int column)
 Returns a pointer to block data.
char * bits (qgssize index)
 Returns a pointer to block data.
const quint8 * byteData () const
 Gives direct access to the raster block data.
QRgb color (int row, int column) const
 Read a single color.
QRgb color (qgssize index) const
 Read a single value.
QRgb * colorData ()
 Gives direct read/write access to the raster RGB data.
const char * constBits () const
 Returns a const pointer to block data.
const char * constBits (qgssize index) const
 Returns a const pointer to block data.
bool convert (Qgis::DataType destDataType)
 Convert data to different type.
QByteArray data () const
 Gets access to raw data.
Qgis::DataType dataType () const
 Returns data type.
int dataTypeSize () const
 Data type size in bytes.
QgsError error () const
 Returns the last error.
bool fill (double value)
 Fills the whole block with a constant value.
bool hasNoData () const
 Returns true if the block may contain no data.
bool hasNoDataValue () const
 true if the block has no data value.
int height () const
 Returns the height (number of rows) of the raster block.
QImage image () const
 Returns an image containing the block data, if the block's data type is color.
bool isEmpty () const
 Returns true if block is empty, i.e.
bool isNoData (int row, int column) const
 Checks if value at position is no data.
bool isNoData (qgssize index) const
 Check if value at position is no data.
bool isNoData (qgssize row, qgssize column) const
 Check if value at position is no data.
bool isValid () const
 Returns true if the block is valid (correctly filled with data).
bool maximum (double &maximum, int &row, int &column) const
 Returns the maximum value present in the raster block.
bool minimum (double &minimum, int &row, int &column) const
 Returns the minimum value present in the raster block.
bool minimumMaximum (double &minimum, int &minimumRow, int &minimumColumn, double &maximum, int &maximumRow, int &maximumColumn) const
 Returns the minimum and maximum value present in the raster block.
double noDataValue () const
 Returns no data value.
bool reset (Qgis::DataType dataType, int width, int height)
 Reset block.
void resetNoDataValue ()
 Reset no data value: if there was a no data value previously set, it will be discarded.
bool setColor (int row, int column, QRgb color)
 Set color on position.
bool setColor (qgssize index, QRgb color)
 Set color on index (indexed line by line).
void setData (const QByteArray &data, int offset=0)
 Rewrite raw pixel data.
void setError (const QgsError &error)
 Sets the last error.
bool setImage (const QImage *image)
 Sets the block data via an image.
void setIsData (int row, int column)
 Remove no data flag on pixel.
void setIsData (qgssize index)
 Remove no data flag on pixel.
bool setIsNoData ()
 Set the whole block to no data.
bool setIsNoData (int row, int column)
 Set no data on pixel.
bool setIsNoData (qgssize index)
 Set no data on pixel.
bool setIsNoDataExcept (QRect exceptRect)
 Set the whole block to no data except specified rectangle.
void setNoDataValue (double noDataValue)
 Sets cell value that will be considered as "no data".
void setValid (bool valid)
 Mark block as valid or invalid.
bool setValue (int row, int column, double value)
 Set value on position.
bool setValue (qgssize index, double value)
 Set value on index (indexed line by line).
QString toString () const
double value (int row, int column) const
 Read a single value if type of block is numeric.
double value (qgssize index) const
 Reads a single value if type of block is numeric.
double valueAndNoData (int row, int column, bool &isNoData) const
 Reads a single value from the pixel at row and column, if type of block is numeric.
double valueAndNoData (qgssize index, bool &isNoData) const
 Reads a single value from the pixel at the specified data matrix index, if type of block is numeric.
int width () const
 Returns the width (number of columns) of the raster block.

Static Public Member Functions

static QString printValue (double value, bool localized=false)