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;
170 double value(
int row,
int column )
const;
182 QRgb color(
int row,
int column )
const;
187 QRgb color(
qgssize index )
const;
193 bool isNoData(
int row,
int column );
198 bool isNoData(
qgssize index );
205 bool setValue(
int row,
int column,
double value );
211 bool setValue(
qgssize index,
double value );
218 bool setColor(
int row,
int column, QRgb color );
224 bool setColor(
qgssize index, QRgb color );
230 bool setIsNoData(
int row,
int column );
235 bool setIsNoData(
qgssize index );
243 bool setIsNoDataExcept(
QRect theExceptRect );
252 void setIsData(
int row,
int column );
260 void setIsData(
qgssize index );
268 char * bits(
int row,
int column );
287 static QString printValue(
double value );
296 static QString printValue(
float value );
310 bool setImage(
const QImage * image );
322 void applyScaleOffset(
double scale,
double offset );
347 int width()
const {
return mWidth; }
363 static bool isNoDataValue(
double value,
double noDataValue );
368 bool isNoDataValue(
double value )
const;
372 bool createNoDataBitmap();
399 bool mHasNoDataValue;
404 static const QRgb mNoDataColor;
419 int mNoDataBitmapWidth;
432 return std::numeric_limits<double>::quiet_NaN();
438 return static_cast< double >((
static_cast< quint8 *
>( data ) )[
index] );
441 return static_cast< double >((
static_cast< quint16 *
>( data ) )[
index] );
444 return static_cast< double >((
static_cast< qint16 *
>( data ) )[
index] );
447 return static_cast< double >((
static_cast< quint32 *
>( data ) )[
index] );
450 return static_cast< double >((
static_cast< qint32 *
>( data ) )[
index] );
453 return static_cast< double >((
static_cast< float *
>( data ) )[
index] );
456 return static_cast< double >((
static_cast< double *
>( data ) )[
index] );
463 return std::numeric_limits<double>::quiet_NaN();
473 (
static_cast< quint8 *
>( data ) )[
index] =
static_cast< quint8
>( value );
476 (
static_cast< quint16 *
>( data ) )[
index] =
static_cast< quint16
>( value );
479 (
static_cast< qint16 *
>( data ) )[
index] =
static_cast< qint16
>( value );
482 (
static_cast< quint32 *
>( data ) )[
index] =
static_cast< quint32
>( value );
485 (
static_cast< qint32 *
>( data ) )[
index] =
static_cast< qint32
>( value );
488 (
static_cast< float *
>( data ) )[
index] =
static_cast< float >( value );
491 (
static_cast< double *
>( data ) )[
index] = value;
504 return std::numeric_limits<double>::quiet_NaN();
506 return readValue( mData, mDataType, index );
509 inline bool QgsRasterBlock::isNoDataValue(
double value )
const 511 return qIsNaN( value ) ||
qgsDoubleNear( value, mNoDataValue );
Eight bit unsigned integer (quint8)
A rectangle specified with double values.
void setError(const QgsError &theError)
Set error.
bool isValid() const
Returns true if the block is valid (correctly filled with data).
int height() const
Returns the height (number of rows) of the raster block.
Thirty two bit floating point (float)
bool qgsDoubleNear(double a, double b, double epsilon=4 *DBL_EPSILON)
Compare two doubles (but allow some difference)
QgsError error() const
Get error.
Sixteen bit unsigned integer (quint16)
Sixty four bit floating point (double)
Color, alpha, red, green, blue, 4 bytes the same as QImage::Format_ARGB32_Premultiplied.
Thirty two bit signed integer (qint32)
Thirty two bit unsigned integer (quint32)
Color, alpha, red, green, blue, 4 bytes the same as QImage::Format_ARGB32.
static int typeSize(int dataType)
Sixteen bit signed integer (qint16)
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...
int width() const
Returns the width (number of columns) of the raster block.
static void writeValue(void *data, QGis::DataType type, qgssize index, double value)
void setValid(bool valid)
Mark block as valid or invalid.
QGis::DataType dataType() const
Returns data type.
QgsError is container for error messages (report).
DataType
Raster data types.
double value(int row, int column) const
Read a single value if type of block is numeric.
bool hasNoDataValue() const
True if the block has no data value.
static double readValue(void *data, QGis::DataType type, qgssize index)
double noDataValue() const
Return no data value.