From Jason Beverage, "This patch should fix Gert's problem that he posted on osg-users. I downloaded the sample he posted, reproduced the error, and added an additional check to make sure the GDAL window size was valid. Now his example works fine. Changes made against current CVS.

"
This commit is contained in:
Robert Osfield
2006-07-27 16:41:22 +00:00
parent a5ea4e0b33
commit f5b5f7f527

View File

@@ -225,9 +225,9 @@ float getInterpolatedValue(GDALRasterBand *band, double x, double y)
int numCols = band->GetXSize();
int rowMin = osg::maximum((int)floor(r), 0);
int rowMax = osg::minimum((int)ceil(r), numRows-1);
int rowMax = osg::maximum(osg::minimum((int)ceil(r), numRows-1), 0);
int colMin = osg::maximum((int)floor(c), 0);
int colMax = osg::minimum((int)ceil(c), numCols-1);
int colMax = osg::maximum(osg::minimum((int)ceil(c), numCols-1), 0);
if (rowMin > rowMax) rowMin = rowMax;
if (colMin > colMax) colMin = colMax;