[Qgis-developer] QgsRasterLayer::drawMultiBandColor

Marco Hugentobler marco.hugentobler at karto.baug.ethz.ch
Thu Aug 16 14:05:15 EDT 2007


Hi,

In QgsRasterLayer::drawMultiBandColor there is a section of code (line 2463) 
that is problematic for some files:

if ( myRedValueDouble == noDataValueDouble || myRedValueDouble != 
myRedValueDouble)
      {
#ifdef QGISDEBUG
        //	QgsLogger::debug("myRedValueDouble", myRedValueDouble, __FILE__, 
__FUNCTION__, __LINE__, 1);
        //	QgsLogger::debug("noDataValueDouble", noDataValueDouble, __FILE__, 
__FUNCTION__, __LINE__, 1);
#endif
        continue;
      }

I have a file where the noDataValueDouble for the first band is 0, so the 
method does not set pixel colors where red component is 0. This results in an 
image displayed in wrong colors. Is it ok if I replace the if-statement with:

if(myRedValueDouble == noDataValueDouble && myGreenValueDouble == 
noDataValueDouble && myBlueValueDouble == noDataValueDouble)
?

My example image shows correctly like this.

Regards,
Marco

-- 
Dr. Marco Hugentobler
Institute of Cartography
ETH Zurich
Technical Advisor QGIS Project Steering Committee
marco.hugentobler at karto.baug.ethz.ch



More information about the Qgis-developer mailing list