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;
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 );
252 void setIsData(
int row,
int column );
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 (
double )(( quint8 * )data )[
index];
432 return (
double )(( quint16 * )data )[
index];
435 return (
double )(( qint16 * )data )[
index];
438 return (
double )(( quint32 * )data )[
index];
441 return (
double )(( qint32 * )data )[
index];
444 return (
double )((
float * )data )[
index];
447 return (
double )((
double * )data )[
index];
454 return std::numeric_limits<double>::quiet_NaN();
464 (( quint8 * )data )[
index] = ( quint8 ) value;
467 (( quint16 * )data )[
index] = ( quint16 ) value;
470 (( qint16 * )data )[
index] = ( qint16 ) value;
473 (( quint32 * )data )[
index] = ( quint32 ) value;
476 (( qint32 * )data )[
index] = ( qint32 ) value;
479 ((
float * )data )[
index] = ( float ) 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 );
Sixty four bit floating point (double)
Sixteen bit signed integer (qint16)
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.
Eight bit unsigned integer (quint8)
Sixteen bit unsigned integer (quint16)
double noDataValue() const
Return no data value.
int width() const
Returns the width (number of columns) of the raster block.
QGis::DataType dataType() const
Returns data type.
bool qgsDoubleNear(double a, double b, double epsilon=4 *DBL_EPSILON)
Thirty two bit floating point (float)
double value(int row, int column) const
Read a single value if type of block is numeric.
static int typeSize(int dataType)
DataType
Raster data types.
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.
Thirty two bit signed integer (qint32)
QgsError is container for error messages (report).
static double readValue(void *data, QGis::DataType type, qgssize index)
Color, alpha, red, green, blue, 4 bytes the same as QImage::Format_ARGB32.
QgsError error() const
Get error.
Color, alpha, red, green, blue, 4 bytes the same as QImage::Format_ARGB32_Premultiplied.
Thirty two bit unsigned integer (quint32)