Skip to content

Commit

Permalink
Fix for ticket #303 (tiffs with nulls display incorrectly). Just a few
Browse files Browse the repository at this point in the history
missing checkes for NaN's.


git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@5999 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
g_j_m committed Oct 23, 2006
1 parent 485ab82 commit c7950bc
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/raster/qgsrasterlayer.cpp
Expand Up @@ -1620,7 +1620,7 @@ void QgsRasterLayer::drawSingleBandPseudoColor(QPainter * theQPainter,
myQImage.setAlphaBuffer(true);
myQImage.fill(qRgba(255,255,255,0 )); // fill transparent

//calculate the adjusted matrix stats - which come into affect if the user has chosen
//calculate the adjusted matrix stats - which come into effect if the user has chosen
QgsRasterBandStats myAdjustedRasterBandStats = getRasterBandStats(theBandNoInt);

int myRedInt = 0;
Expand Down Expand Up @@ -2829,7 +2829,7 @@ const QgsRasterBandStats QgsRasterLayer::getRasterBandStats(int theBandNoInt)
double myDouble = readValue ( myData, myDataType, iX + iY * myXBlockSize );

if ( fabs(myDouble - noDataValueDouble) < myPrecision ||
myDouble < GDALminimum )
myDouble < GDALminimum || myDouble != myDouble)
{
continue; // NULL
}
Expand All @@ -2854,7 +2854,7 @@ const QgsRasterBandStats QgsRasterLayer::getRasterBandStats(int theBandNoInt)
myRasterBandStats.maxValDouble = myDouble;
}
//only increment the running total if it is not a nodata value
if (myDouble != noDataValueDouble)
if (myDouble != noDataValueDouble || myDouble != myDouble)
{
myRasterBandStats.sumDouble += myDouble;
++myRasterBandStats.elementCountInt;
Expand Down Expand Up @@ -2902,7 +2902,7 @@ const QgsRasterBandStats QgsRasterLayer::getRasterBandStats(int theBandNoInt)
double myDouble = readValue ( myData, myDataType, iX + iY * myXBlockSize );

if ( fabs(myDouble - noDataValueDouble) < myPrecision ||
myDouble < GDALminimum )
myDouble < GDALminimum || myDouble != myDouble)
{
continue; // NULL
}
Expand Down

0 comments on commit c7950bc

Please sign in to comment.