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 );
301 bool setImage(
const QImage * image );
313 void applyScaleOffset(
double scale,
double offset );
338 int width()
const {
return mWidth; }
354 static bool isNoDataValue(
double value,
double noDataValue );
359 bool isNoDataValue(
double value )
const;
363 bool createNoDataBitmap();
390 bool mHasNoDataValue;
395 static const QRgb mNoDataColor;
410 int mNoDataBitmapWidth;
423 return std::numeric_limits<double>::quiet_NaN();
429 return static_cast< double >((
static_cast< quint8 *
>( data ) )[
index] );
432 return static_cast< double >((
static_cast< quint16 *
>( data ) )[
index] );
435 return static_cast< double >((
static_cast< qint16 *
>( data ) )[
index] );
438 return static_cast< double >((
static_cast< quint32 *
>( data ) )[
index] );
441 return static_cast< double >((
static_cast< qint32 *
>( data ) )[
index] );
444 return static_cast< double >((
static_cast< float *
>( data ) )[
index] );
447 return static_cast< double >((
static_cast< double *
>( data ) )[
index] );
454 return std::numeric_limits<double>::quiet_NaN();
464 (
static_cast< quint8 *
>( data ) )[
index] =
static_cast< quint8
>( value );
467 (
static_cast< quint16 *
>( data ) )[
index] =
static_cast< quint16
>( value );
470 (
static_cast< qint16 *
>( data ) )[
index] =
static_cast< qint16
>( value );
473 (
static_cast< quint32 *
>( data ) )[
index] =
static_cast< quint32
>( value );
476 (
static_cast< qint32 *
>( data ) )[
index] =
static_cast< qint32
>( value );
479 (
static_cast< float *
>( data ) )[
index] =
static_cast< float >( value );
482 (
static_cast< double *
>( data ) )[
index] = value;
495 return std::numeric_limits<double>::quiet_NaN();
497 return readValue( mData, mDataType, index );
500 inline bool QgsRasterBlock::isNoDataValue(
double value )
const 502 return qIsNaN( value ) ||
qgsDoubleNear( value, mNoDataValue );
Eight bit unsigned integer (quint8)
A rectangle specified with double values.
int height() const
Returns the height (number of rows) of the raster block.
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.
int width() const
Returns the width (number of columns) of the raster block.
Thirty two bit floating point (float)
QGis::DataType dataType() const
Returns data type.
bool qgsDoubleNear(double a, double b, double epsilon=4 *DBL_EPSILON)
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)
double value(int row, int column) const
Read a single value if type of block is numeric.
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...
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.
QgsError is container for error messages (report).
DataType
Raster data types.
static double readValue(void *data, QGis::DataType type, qgssize index)
QgsError error() const
Get error.