[QGIS Commit] r13750 - trunk/qgis/src/core/raster

svn_qgis at osgeo.org svn_qgis at osgeo.org
Sat Jun 19 10:48:13 EDT 2010


Author: jef
Date: 2010-06-19 14:48:13 +0000 (Sat, 19 Jun 2010)
New Revision: 13750

Modified:
   trunk/qgis/src/core/raster/qgsrasterlayer.cpp
   trunk/qgis/src/core/raster/qgsrasterlayer.h
Log:
fix #2457

Modified: trunk/qgis/src/core/raster/qgsrasterlayer.cpp
===================================================================
--- trunk/qgis/src/core/raster/qgsrasterlayer.cpp	2010-06-18 20:30:31 UTC (rev 13749)
+++ trunk/qgis/src/core/raster/qgsrasterlayer.cpp	2010-06-19 14:48:13 UTC (rev 13750)
@@ -4507,7 +4507,9 @@
   {
     for ( int i = 0; i < theRasterViewPort->drawableAreaXDim; ++i )
     {
-      myRedValue = 0; myGreenValue = 0; myBlueValue = 0;
+      myRedValue = 0;
+      myGreenValue = 0;
+      myBlueValue = 0;
       myPixelValue = readValue( rasterScanLine, ( GDALDataType )myDataType, i );
 
       if ( mValidNoDataValue && ( fabs( myPixelValue - mNoDataValue ) <= TINY_VALUE || myPixelValue != myPixelValue ) )
@@ -5404,7 +5406,8 @@
  */
 double QgsRasterLayer::readValue( void *data, GDALDataType type, int index )
 {
-  double val;
+  if ( !data )
+    return mValidNoDataValue ? mNoDataValue : 0.0;
 
   switch ( type )
   {
@@ -5427,13 +5430,13 @@
       return ( double )(( float * )data )[index];
       break;
     case GDT_Float64:
-      val = (( double * )data )[index];
       return ( double )(( double * )data )[index];
       break;
     default:
       QgsLogger::warning( "GDAL data type is not supported" );
   }
-  return 0.0;
+
+  return mValidNoDataValue ? mNoDataValue : 0.0;
 }
 
 bool QgsRasterLayer::update()
@@ -5599,7 +5602,7 @@
 
   ++mCurrentPartImageRow;
   ++mCurrentRow;
-  return true;
+  return !mWritingEnabled || *imageScanLine;
 }
 
 bool QgsRasterImageBuffer::createNextPartImage()

Modified: trunk/qgis/src/core/raster/qgsrasterlayer.h
===================================================================
--- trunk/qgis/src/core/raster/qgsrasterlayer.h	2010-06-18 20:30:31 UTC (rev 13749)
+++ trunk/qgis/src/core/raster/qgsrasterlayer.h	2010-06-19 14:48:13 UTC (rev 13750)
@@ -6,7 +6,7 @@
  email                : tim at linfiniti.com
 ***************************************************************************/
 /*
- * Peter J. Ersts - contirbuted to the refactoring and maintenance of this class
+ * Peter J. Ersts - contributed to the refactoring and maintenance of this class
  * B. Morley - added functions to convert this class to a data provider interface
  * Frank Warmerdam - contributed bug fixes and migrated class to use all GDAL_C_API calls
  */



More information about the QGIS-commit mailing list