Skip to content

Commit c7950bc

Browse files
author
g_j_m
committed
Fix for ticket #303 (tiffs with nulls display incorrectly). Just a few
missing checkes for NaN's. git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@5999 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 485ab82 commit c7950bc

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/raster/qgsrasterlayer.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -1620,7 +1620,7 @@ void QgsRasterLayer::drawSingleBandPseudoColor(QPainter * theQPainter,
16201620
myQImage.setAlphaBuffer(true);
16211621
myQImage.fill(qRgba(255,255,255,0 )); // fill transparent
16221622

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

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

28312831
if ( fabs(myDouble - noDataValueDouble) < myPrecision ||
2832-
myDouble < GDALminimum )
2832+
myDouble < GDALminimum || myDouble != myDouble)
28332833
{
28342834
continue; // NULL
28352835
}
@@ -2854,7 +2854,7 @@ const QgsRasterBandStats QgsRasterLayer::getRasterBandStats(int theBandNoInt)
28542854
myRasterBandStats.maxValDouble = myDouble;
28552855
}
28562856
//only increment the running total if it is not a nodata value
2857-
if (myDouble != noDataValueDouble)
2857+
if (myDouble != noDataValueDouble || myDouble != myDouble)
28582858
{
28592859
myRasterBandStats.sumDouble += myDouble;
28602860
++myRasterBandStats.elementCountInt;
@@ -2902,7 +2902,7 @@ const QgsRasterBandStats QgsRasterLayer::getRasterBandStats(int theBandNoInt)
29022902
double myDouble = readValue ( myData, myDataType, iX + iY * myXBlockSize );
29032903

29042904
if ( fabs(myDouble - noDataValueDouble) < myPrecision ||
2905-
myDouble < GDALminimum )
2905+
myDouble < GDALminimum || myDouble != myDouble)
29062906
{
29072907
continue; // NULL
29082908
}

0 commit comments

Comments
 (0)