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;
176 double value(
size_t index )
const;
182 QRgb color(
int row,
int column )
const;
187 QRgb color(
size_t index )
const;
193 bool isNoData(
int row,
int column );
198 bool isNoData(
size_t index );
205 bool setValue(
int row,
int column,
double value );
211 bool setValue(
size_t index,
double value );
218 bool setColor(
int row,
int column, QRgb color );
224 bool setColor(
size_t index, QRgb color );
230 bool setIsNoData(
int row,
int column );
235 bool setIsNoData(
size_t index );
243 bool setIsNoDataExcept(
const QRect & theExceptRect );
251 char * bits(
int row,
int column );
258 char * bits(
size_t index );
270 static QString printValue(
double value );
279 QImage image()
const;
284 bool setImage(
const QImage * image );
287 inline static double readValue(
void *data,
QGis::DataType type,
size_t index );
290 inline static void writeValue(
void *data,
QGis::DataType type,
size_t index,
double value );
309 static QRect subRect(
const QgsRectangle &theExtent,
int theWidth,
int theHeight,
const QgsRectangle &theSubExtent );
319 static bool isNoDataValue(
double value,
double noDataValue );
324 bool isNoDataValue(
double value )
const;
328 bool createNoDataBitmap();
386 return std::numeric_limits<double>::quiet_NaN();
392 return (
double )(( quint8 * )data )[index];
395 return (
double )(( quint16 * )data )[index];
398 return (
double )(( qint16 * )data )[index];
401 return (
double )(( quint32 * )data )[index];
404 return (
double )(( qint32 * )data )[index];
407 return (
double )((
float * )data )[index];
410 return (
double )((
double * )data )[index];
413 QgsDebugMsg( QString(
"Data type %1 is not supported" ).arg( type ) );
417 return std::numeric_limits<double>::quiet_NaN();
427 (( quint8 * )data )[index] = ( quint8 ) value;
430 (( quint16 * )data )[index] = ( quint16 ) value;
433 (( qint16 * )data )[index] = ( qint16 ) value;
436 (( quint32 * )data )[index] = ( quint32 ) value;
439 (( qint32 * )data )[index] = ( qint32 ) value;
442 ((
float * )data )[index] = ( float ) value;
445 ((
double * )data )[index] =
value;
448 QgsDebugMsg( QString(
"Data type %1 is not supported" ).arg( type ) );
458 return std::numeric_limits<double>::quiet_NaN();