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; }
91 static int typeSize(
int dataType )
127 int dataTypeSize()
const
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();
359 bool mHasNoDataValue;
364 static const QRgb mNoDataColor;
379 int mNoDataBitmapWidth;
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();
466 return readValue( mData, mDataType, index );
469 inline bool QgsRasterBlock::isNoDataValue(
double value )
const
471 return qIsNaN( value ) ||
qgsDoubleNear( value, mNoDataValue );