QGIS API Documentation
2.6.0-Brighton
|
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 () |
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 | isValid () const |
Returns true if the block is valid (correctly filled with data). | |
void | setValid (bool valid) |
Mark block as valid or invalid. | |
bool | isEmpty () const |
Returns true if block is empty, i.e. | |
int | dataTypeSize () const |
QGis::DataType | dataType () const |
Returns data type. | |
bool | hasNoDataValue () const |
True if the block has no data value. | |
bool | hasNoData () const |
Returns true if the block may contain no data. | |
double | noDataValue () const |
Return no data value. | |
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. | |
QRgb | color (int row, int column) const |
Read a single color. | |
QRgb | color (qgssize index) const |
Read a single value. | |
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 | 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) | |
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) | |
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. | |
char * | bits (int row, int column) |
Get pointer to data. | |
char * | bits (qgssize index) |
Get pointer to data. | |
char * | bits () |
Get pointer to data. | |
bool | convert (QGis::DataType destDataType) |
Convert data to different type. | |
QImage | image () const |
Get image if type is color. | |
bool | setImage (const QImage *image) |
set image. | |
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 | |
QgsError | error () const |
Get error. | |
void | setError (const QgsError &theError) |
Set error. |
Static Public Member Functions | |
static int | typeSize (int dataType) |
static bool | typeIsNumeric (QGis::DataType type) |
Returns true if data type is numeric. | |
static bool | typeIsColor (QGis::DataType type) |
Returns true if data type is color. | |
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 QString | printValue (double value) |
Print double value with all necessary significant digits. | |
static double | readValue (void *data, QGis::DataType type, qgssize index) |
static void | writeValue (void *data, QGis::DataType type, qgssize index, double value) |
static QRect | subRect (const QgsRectangle &theExtent, int theWidth, int theHeight, const QgsRectangle &theSubExtent) |
For theExtent and theWidht, theHeight find rectangle covered by subextent. |
Raster data container.
QgsRasterBlock::QgsRasterBlock | ( | ) |
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 |
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) |
|
virtual |
void QgsRasterBlock::applyNoDataValues | ( | const QgsRasterRangeList & | rangeList | ) |
void QgsRasterBlock::applyScaleOffset | ( | double | scale, |
double | offset | ||
) |
apply band scale and offset to raster block values @note added in 2.3
char * QgsRasterBlock::bits | ( | int | row, |
int | column | ||
) |
Get pointer to data.
row | row index |
column | column index |
char * QgsRasterBlock::bits | ( | qgssize | index | ) |
Get pointer to data.
index | data matrix index (long type in Python) |
char * QgsRasterBlock::bits | ( | ) |
Get pointer to data.
QRgb QgsRasterBlock::color | ( | int | row, |
int | column | ||
) | const |
Read a single color.
row | row index |
column | column index |
QRgb QgsRasterBlock::color | ( | qgssize | index | ) | const |
Read a single value.
index | data matrix index (long type in Python) |
bool QgsRasterBlock::convert | ( | QGis::DataType | destDataType | ) |
Convert data to different type.
destDataType | dest data type |
|
inline |
Returns data type.
|
inline |
|
inline |
Get error.
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().
|
inline |
True if the block has no data value.
QImage QgsRasterBlock::image | ( | ) | const |
Get image if type is color.
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).
bool QgsRasterBlock::isNoData | ( | int | row, |
int | column | ||
) |
Check if value at position is no data.
row | row index |
column | column index |
bool QgsRasterBlock::isNoData | ( | qgssize | index | ) |
Check if value at position is no data.
index | data matrix index (long type in Python) |
|
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.
|
inline |
Return no data value.
If the block does not have a no data value the returned value is undefined.
|
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 |
|
inlinestatic |
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 |
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) |
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 |
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 |
|
inline |
Set error.
bool QgsRasterBlock::setImage | ( | const QImage * | image | ) |
set image.
image | image |
bool QgsRasterBlock::setIsNoData | ( | int | row, |
int | column | ||
) |
Set no data on pixel.
row | row index |
column | column index |
bool QgsRasterBlock::setIsNoData | ( | qgssize | index | ) |
Set no data on pixel.
index | data matrix index (long type in Python) |
bool QgsRasterBlock::setIsNoData | ( | ) |
Set the whole block to no data.
bool QgsRasterBlock::setIsNoDataExcept | ( | const QRect & | theExceptRect | ) |
Set the whole block to no data except specified rectangle.
|
inline |
Mark block as valid or invalid.
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 |
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 |
|
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 |
|
static |
Returns true if data type is color.
|
static |
Returns true if data type is numeric.
|
inlinestatic |
|
static |
For given data type returns wider type and sets no data value.
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 |
|
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) |
|
static |
Get byte array representing a value.
theDataType | data type |
theValue | value |
|
inlinestatic |