Skip to content

Commit

Permalink
Ignoring color ramps from 0.0 to 0.0 to be able to draw malformed TIF…
Browse files Browse the repository at this point in the history
…Fs. Fixes #643

git-svn-id: http://svn.osgeo.org/qgis/branches/Release-0_8_0@6794 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
homann committed Mar 11, 2007
1 parent a171307 commit 8db6a97
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/raster/qgsrasterlayer.cpp
Expand Up @@ -4441,10 +4441,13 @@ void QgsRasterLayer::readColorTable ( GDALRasterBand *gdalBand, QgsColorTable *t
{
continue;
}
theColorTable->add ( min, max,
(unsigned char)min_c1, (unsigned char)min_c2, (unsigned char)min_c3, 0,
(unsigned char)max_c1, (unsigned char)max_c2, (unsigned char)max_c3, 0 );
found = true;
if ( (min > 0.0) || (max > 0.0) ) { // A quick hack for malformed GDALMetadata
theColorTable->add ( min, max,
(unsigned char)min_c1, (unsigned char)min_c2, (unsigned char)min_c3, 0,
(unsigned char)max_c1, (unsigned char)max_c2, (unsigned char)max_c3, 0 );
found = true;
}

}
++metadata;
}
Expand Down Expand Up @@ -4514,6 +4517,12 @@ void *QgsRasterLayer::readData ( GDALRasterBand *gdalBand, QgsRasterViewPort *vi
viewPort->drawableAreaXDimInt,
viewPort->drawableAreaYDimInt,
type, 0, 0 );
if (myErr != CPLE_None)
{
// Couldn't read the raster, print the reason on debug.
// We should notify the user somehow
QgsDebugMsg("RasterIO failed and returned (see cpl_error.h) : " + QString::number(myErr));
}

}
return data;
Expand Down

0 comments on commit 8db6a97

Please sign in to comment.