18 #ifndef QGSRASTERBLOCK_H
19 #define QGSRASTERBLOCK_H
62 bool reset(
QGis::DataType theDataType,
int theWidth,
int theHeight );
71 bool reset(
QGis::DataType theDataType,
int theWidth,
int theHeight,
double theNoDataValue );
82 void setValid(
bool valid ) { mValid = valid; }
129 return typeSize( mDataType );
152 bool hasNoData()
const;
163 static QByteArray valueBytes(
QGis::DataType theDataType,
double theValue );
170 double value(
int row,
int column )
const;
182 QRgb color(
int row,
int column )
const;
193 bool isNoData(
int row,
int column );
205 bool setValue(
int row,
int column,
double value );
218 bool setColor(
int row,
int column, QRgb color );
230 bool setIsNoData(
int row,
int column );
243 bool setIsNoDataExcept(
const QRect & theExceptRect );
251 char * bits(
int row,
int column );
270 static QString printValue(
double value );
279 QImage image()
const;
284 bool setImage(
const QImage * image );
309 static QRect subRect(
const QgsRectangle &theExtent,
int theWidth,
int theHeight,
const QgsRectangle &theSubExtent );
319 static bool isNoDataValue(
double value,
double noDataValue );
324 bool isNoDataValue(
double value )
const;
328 bool createNoDataBitmap();
388 return std::numeric_limits<double>::quiet_NaN();
394 return (
double )(( quint8 * )data )[
index];
397 return (
double )(( quint16 * )data )[
index];
400 return (
double )(( qint16 * )data )[
index];
403 return (
double )(( quint32 * )data )[
index];
406 return (
double )(( qint32 * )data )[
index];
409 return (
double )((
float * )data )[
index];
412 return (
double )((
double * )data )[
index];
415 QgsDebugMsg( QString(
"Data type %1 is not supported" ).arg( type ) );
419 return std::numeric_limits<double>::quiet_NaN();
429 (( quint8 * )data )[
index] = ( quint8 ) value;
432 (( quint16 * )data )[
index] = ( quint16 ) value;
435 (( qint16 * )data )[
index] = ( qint16 ) value;
438 (( quint32 * )data )[
index] = ( quint32 ) value;
441 (( qint32 * )data )[
index] = ( qint32 ) value;
444 ((
float * )data )[
index] = ( float ) value;
450 QgsDebugMsg( QString(
"Data type %1 is not supported" ).arg( type ) );
460 return std::numeric_limits<double>::quiet_NaN();
static const QRgb mNoDataColor
A rectangle specified with double values.
bool isValid() const
Returns true if the block is valid (correctly filled with data).
void setError(const QgsError &theError)
Set error.
double noDataValue() const
Return no data value.
QGis::DataType dataType() const
Returns data type.
bool qgsDoubleNear(double a, double b, double epsilon=4 *DBL_EPSILON)
double value(int row, int column) const
Read a single value if type of block is numeric.
static bool isNoDataValue(double value, double noDataValue)
Test if value is nodata comparing to noDataValue.
static int typeSize(int dataType)
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...
static void writeValue(void *data, QGis::DataType type, qgssize index, double value)
void setValid(bool valid)
Mark block as valid or invalid.
bool hasNoDataValue() const
True if the block has no data value.
QList< QgsRasterRange > QgsRasterRangeList
QgsError is container for error messages (report).
DataType
Raster data types.
qgssize mNoDataBitmapSize
static double readValue(void *data, QGis::DataType type, qgssize index)
QgsError error() const
Get error.