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 );
296 void applyScaleOffset(
double scale,
double offset );
313 static QRect subRect(
const QgsRectangle &theExtent,
int theWidth,
int theHeight,
const QgsRectangle &theSubExtent );
323 static bool isNoDataValue(
double value,
double noDataValue );
328 bool isNoDataValue(
double value )
const;
332 bool createNoDataBitmap();
392 return std::numeric_limits<double>::quiet_NaN();
398 return (
double )(( quint8 * )data )[
index];
401 return (
double )(( quint16 * )data )[
index];
404 return (
double )(( qint16 * )data )[
index];
407 return (
double )(( quint32 * )data )[
index];
410 return (
double )(( qint32 * )data )[
index];
413 return (
double )((
float * )data )[
index];
416 return (
double )((
double * )data )[
index];
419 QgsDebugMsg( QString(
"Data type %1 is not supported" ).arg( type ) );
423 return std::numeric_limits<double>::quiet_NaN();
433 (( quint8 * )data )[
index] = ( quint8 ) value;
436 (( quint16 * )data )[
index] = ( quint16 ) value;
439 (( qint16 * )data )[
index] = ( qint16 ) value;
442 (( quint32 * )data )[
index] = ( quint32 ) value;
445 (( qint32 * )data )[
index] = ( qint32 ) value;
448 ((
float * )data )[
index] = ( float ) value;
454 QgsDebugMsg( QString(
"Data type %1 is not supported" ).arg( type ) );
464 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.