QGIS API Documentation
2.8.2-Wien
|
Raster data container. More...
#include <qgsrasterblock.h>
Public Member Functions | |
QgsRasterBlock () | |
QgsRasterBlock (QGis::DataType theDataType, int theWidth, int theHeight) | |
Constructor which allocates data block in memory. | |
QgsRasterBlock (QGis::DataType theDataType, int theWidth, int theHeight, double theNoDataValue) | |
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 @note added in 2.3 | |
char * | bits (int row, int column) |
Get pointer to data. | |
char * | bits (qgssize index) |
Get pointer to data. | |
char * | bits () |
Get pointer to data. | |
QRgb | color (int row, int column) const |
Read a single color. | |
QRgb | color (qgssize index) const |
Read a single value. | |
bool | convert (QGis::DataType destDataType) |
Convert data to different type. | |
QGis::DataType | dataType () const |
Returns data type. | |
int | dataTypeSize () const |
QgsError | error () const |
Get error. | |
bool | hasNoData () const |
Returns true if the block may contain no data. | |
bool | hasNoDataValue () const |
True if the block has no data value. | |
QImage | image () const |
Get image if type is color. | |
bool | isEmpty () const |
Returns true if block is empty, i.e. | |
bool | isNoData (int row, int column) |
Check if value at position is no data. | |
bool | isNoData (qgssize index) |
Check if value at position is no data. | |
bool | isValid () const |
Returns true if the block is valid (correctly filled with data). | |
double | noDataValue () const |
Return no data value. | |
bool | reset (QGis::DataType theDataType, int theWidth, int theHeight) |
Reset block. | |
bool | reset (QGis::DataType theDataType, int theWidth, int theHeight, double theNoDataValue) |
Reset block. | |
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 | setError (const QgsError &theError) |
Set error. | |
bool | setImage (const QImage *image) |
set image. | |
bool | setIsNoData (int row, int column) |
Set no data on pixel. | |
bool | setIsNoData (qgssize index) |
Set no data on pixel. | |
bool | setIsNoData () |
Set the whole block to no data. | |
bool | setIsNoDataExcept (const QRect &theExceptRect) |
Set the whole block to no data except specified rectangle. | |
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) | |
double | value (int row, int column) const |
Read a single value if type of block is numeric. | |
double | value (qgssize index) const |
Read a single value if type of block is numeric. |
Static Public Member Functions | |
static QString | printValue (double value) |
Print double value with all necessary significant digits. | |
static double | readValue (void *data, QGis::DataType type, qgssize index) |
static QRect | subRect (const QgsRectangle &theExtent, int theWidth, int theHeight, const QgsRectangle &theSubExtent) |
For theExtent and theWidht, theHeight find rectangle covered by subextent. | |
static bool | typeIsColor (QGis::DataType type) |
Returns true if data type is color. | |
static bool | typeIsNumeric (QGis::DataType type) |
Returns true if data type is numeric. | |
static int | typeSize (int dataType) |
static QGis::DataType | typeWithNoDataValue (QGis::DataType dataType, double *noDataValue) |
For given data type returns wider type and sets no data value. | |
static QByteArray | valueBytes (QGis::DataType theDataType, double theValue) |
Get byte array representing a value. | |
static void | writeValue (void *data, QGis::DataType type, qgssize index, double value) |
Raster data container.
Definition at line 32 of file qgsrasterblock.h.
QgsRasterBlock::QgsRasterBlock | ( | ) |
Definition at line 29 of file qgsrasterblock.cpp.
QgsRasterBlock::QgsRasterBlock | ( | QGis::DataType | theDataType, |
int | theWidth, | ||
int | theHeight | ||
) |
Constructor which allocates data block in memory.
theDataType | raster data type |
theWidth | width of data matrix |
theHeight | height of data matrix |
Definition at line 45 of file qgsrasterblock.cpp.
QgsRasterBlock::QgsRasterBlock | ( | QGis::DataType | theDataType, |
int | theWidth, | ||
int | theHeight, | ||
double | theNoDataValue | ||
) |
Constructor which allocates data block in memory.
theDataType | raster data type |
theWidth | width of data matrix |
theHeight | height of data matrix |
theNoDataValue | the value representing no data (NULL) |
Definition at line 62 of file qgsrasterblock.cpp.
|
virtual |
Definition at line 79 of file qgsrasterblock.cpp.
void QgsRasterBlock::applyNoDataValues | ( | const QgsRasterRangeList & | rangeList | ) |
Definition at line 724 of file qgsrasterblock.cpp.
void QgsRasterBlock::applyScaleOffset | ( | double | scale, |
double | offset | ||
) |
apply band scale and offset to raster block values @note added in 2.3
Definition at line 710 of file qgsrasterblock.cpp.
char * QgsRasterBlock::bits | ( | int | row, |
int | column | ||
) |
Get pointer to data.
row | row index |
column | column index |
Definition at line 656 of file qgsrasterblock.cpp.
char * QgsRasterBlock::bits | ( | qgssize | index | ) |
Get pointer to data.
index | data matrix index (long type in Python) |
Definition at line 636 of file qgsrasterblock.cpp.
char * QgsRasterBlock::bits | ( | ) |
Get pointer to data.
Definition at line 661 of file qgsrasterblock.cpp.
QRgb QgsRasterBlock::color | ( | int | row, |
int | column | ||
) | const |
Read a single color.
row | row index |
column | column index |
Definition at line 304 of file qgsrasterblock.cpp.
QRgb QgsRasterBlock::color | ( | qgssize | index | ) | const |
Read a single value.
index | data matrix index (long type in Python) |
Definition at line 297 of file qgsrasterblock.cpp.
bool QgsRasterBlock::convert | ( | QGis::DataType | destDataType | ) |
Convert data to different type.
destDataType | dest data type |
Definition at line 675 of file qgsrasterblock.cpp.
|
inline |
Returns data type.
Definition at line 139 of file qgsrasterblock.h.
|
inline |
Definition at line 127 of file qgsrasterblock.h.
|
inline |
Get error.
Definition at line 299 of file qgsrasterblock.h.
bool QgsRasterBlock::hasNoData | ( | ) | const |
Returns true if the block may contain no data.
It does not guarantee that it really contains any no data. It can be used to speed up processing. Not the difference between this method and hasNoDataValue().
Definition at line 274 of file qgsrasterblock.cpp.
|
inline |
True if the block has no data value.
Definition at line 146 of file qgsrasterblock.h.
QImage QgsRasterBlock::image | ( | ) | const |
bool QgsRasterBlock::isEmpty | ( | ) | const |
Returns true if block is empty, i.e.
its size is 0 (zero rows or cols). This method does not return true if size is not zero and all values are 'no data' (null).
Definition at line 178 of file qgsrasterblock.cpp.
bool QgsRasterBlock::isNoData | ( | int | row, |
int | column | ||
) |
Check if value at position is no data.
row | row index |
column | column index |
Definition at line 341 of file qgsrasterblock.cpp.
bool QgsRasterBlock::isNoData | ( | qgssize | index | ) |
Check if value at position is no data.
index | data matrix index (long type in Python) |
Definition at line 311 of file qgsrasterblock.cpp.
|
inline |
Returns true if the block is valid (correctly filled with data).
An empty block may still be valid (if zero size block was requested). If the block is not valid, error may be retrieved by error() method.
Definition at line 79 of file qgsrasterblock.h.
|
inline |
Return no data value.
If the block does not have a no data value the returned value is undefined.
Definition at line 157 of file qgsrasterblock.h.
|
static |
Print double value with all necessary significant digits.
It is ensured that conversion back to double gives the same number.
value | the value to be printed |
Definition at line 767 of file qgsrasterblock.cpp.
|
inlinestatic |
Definition at line 388 of file qgsrasterblock.h.
bool QgsRasterBlock::reset | ( | QGis::DataType | theDataType, |
int | theWidth, | ||
int | theHeight | ||
) |
Reset block.
theDataType | raster data type |
theWidth | width of data matrix |
theHeight | height of data matrix |
Definition at line 87 of file qgsrasterblock.cpp.
bool QgsRasterBlock::reset | ( | QGis::DataType | theDataType, |
int | theWidth, | ||
int | theHeight, | ||
double | theNoDataValue | ||
) |
Reset block.
theDataType | raster data type |
theWidth | width of data matrix |
theHeight | height of data matrix |
theNoDataValue | the value representing no data (NULL) |
Definition at line 99 of file qgsrasterblock.cpp.
bool QgsRasterBlock::setColor | ( | int | row, |
int | column, | ||
QRgb | color | ||
) |
Set color on position.
row | row index |
column | column index |
color | the color to be set, QRgb value |
Definition at line 367 of file qgsrasterblock.cpp.
bool QgsRasterBlock::setColor | ( | qgssize | index, |
QRgb | color | ||
) |
Set color on index (indexed line by line)
index | data matrix index (long type in Python) |
color | the color to be set, QRgb value |
Definition at line 372 of file qgsrasterblock.cpp.
|
inline |
Set error.
Definition at line 302 of file qgsrasterblock.h.
bool QgsRasterBlock::setImage | ( | const QImage * | image | ) |
set image.
image | image |
Definition at line 752 of file qgsrasterblock.cpp.
bool QgsRasterBlock::setIsNoData | ( | int | row, |
int | column | ||
) |
Set no data on pixel.
row | row index |
column | column index |
Definition at line 392 of file qgsrasterblock.cpp.
bool QgsRasterBlock::setIsNoData | ( | qgssize | index | ) |
Set no data on pixel.
index | data matrix index (long type in Python) |
Definition at line 397 of file qgsrasterblock.cpp.
bool QgsRasterBlock::setIsNoData | ( | ) |
Set the whole block to no data.
Definition at line 424 of file qgsrasterblock.cpp.
bool QgsRasterBlock::setIsNoDataExcept | ( | const QRect & | theExceptRect | ) |
Set the whole block to no data except specified rectangle.
Definition at line 476 of file qgsrasterblock.cpp.
|
inline |
Mark block as valid or invalid.
Definition at line 82 of file qgsrasterblock.h.
bool QgsRasterBlock::setValue | ( | int | row, |
int | column, | ||
double | value | ||
) |
Set value on position.
row | row index |
column | column index |
value | the value to be set |
Definition at line 362 of file qgsrasterblock.cpp.
bool QgsRasterBlock::setValue | ( | qgssize | index, |
double | value | ||
) |
Set value on index (indexed line by line)
index | data matrix index (long type in Python) |
value | the value to be set |
Definition at line 346 of file qgsrasterblock.cpp.
|
static |
For theExtent and theWidht, theHeight find rectangle covered by subextent.
The output rect has x oriented from left to right and y from top to bottom (upper-left to lower-right orientation).
theExtent | extent, usually the larger |
theWidth | numbers of columns in theExtent |
theHeight | numbers of rows in theExtent |
theSubExtent | extent, usually smaller than theExtent |
Definition at line 884 of file qgsrasterblock.cpp.
|
static |
Returns true if data type is color.
Definition at line 215 of file qgsrasterblock.cpp.
|
static |
Returns true if data type is numeric.
Definition at line 190 of file qgsrasterblock.cpp.
|
inlinestatic |
Definition at line 91 of file qgsrasterblock.h.
|
static |
For given data type returns wider type and sets no data value.
Definition at line 240 of file qgsrasterblock.cpp.
double QgsRasterBlock::value | ( | int | row, |
int | column | ||
) | const |
Read a single value if type of block is numeric.
If type is color, returned value is undefined.
row | row index |
column | column index |
Definition at line 292 of file qgsrasterblock.cpp.
|
inline |
Read a single value if type of block is numeric.
If type is color, returned value is undefined.
index | data matrix index (long type in Python) |
Definition at line 459 of file qgsrasterblock.h.
|
static |
Get byte array representing a value.
theDataType | data type |
theValue | value |
Definition at line 820 of file qgsrasterblock.cpp.
|
inlinestatic |
Definition at line 426 of file qgsrasterblock.h.