Skip to content
Permalink
Browse files
inline more raster block methods
  • Loading branch information
mhugent committed Dec 10, 2012
1 parent eb79e21 commit fe7d4fbfcadab7668f25e7de9a197cb270104a14
Showing with 22 additions and 22 deletions.
  1. +0 −22 src/core/raster/qgsrasterblock.cpp
  2. +22 −0 src/core/raster/qgsrasterblock.h
@@ -239,28 +239,6 @@ bool QgsRasterBlock::isNoDataValue( double value, double noDataValue )
return false;
}

bool QgsRasterBlock::isNoDataValue( double value ) const
{
// More precise would be qIsNaN(value) && qIsNaN(noDataValue(bandNo)), but probably
// not important and slower
if ( qIsNaN( value ) ||
doubleNear( value, mNoDataValue ) )
{
return true;
}
return false;
}

double QgsRasterBlock::value( size_t index ) const
{
if ( index >= ( size_t )mWidth*mHeight )
{
QgsDebugMsg( QString( "Index %1 out of range (%2 x %3)" ).arg( index ).arg( mWidth ).arg( mHeight ) );
return mNoDataValue;
}
return readValue( mData, mDataType, index );
}

double QgsRasterBlock::value( int row, int column ) const
{
return value(( size_t )row*mWidth + column );
@@ -430,6 +430,28 @@ inline bool QgsRasterBlock::valueInRange( double value, const QList<QgsRasterBlo
return false;
}

inline double QgsRasterBlock::value( size_t index ) const
{
/*if ( index >= ( size_t )mWidth*mHeight )
{
QgsDebugMsg( QString( "Index %1 out of range (%2 x %3)" ).arg( index ).arg( mWidth ).arg( mHeight ) );
return mNoDataValue;
}*/
return readValue( mData, mDataType, index );
}

inline bool QgsRasterBlock::isNoDataValue( double value ) const
{
// More precise would be qIsNaN(value) && qIsNaN(noDataValue(bandNo)), but probably
// not important and slower
if ( qIsNaN( value ) ||
doubleNear( value, mNoDataValue ) )
{
return true;
}
return false;
}

#endif


0 comments on commit fe7d4fb

Please sign in to comment.