Skip to content

Commit

Permalink
inline more raster block methods
Browse files Browse the repository at this point in the history
  • Loading branch information
mhugent committed Dec 10, 2012
1 parent eb79e21 commit fe7d4fb
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 22 deletions.
22 changes: 0 additions & 22 deletions src/core/raster/qgsrasterblock.cpp
Expand Up @@ -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 );
Expand Down
22 changes: 22 additions & 0 deletions src/core/raster/qgsrasterblock.h
Expand Up @@ -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.