Skip to content
Permalink
Browse files
Ported WMS fix r6755 from 0.8 to trunk.
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@6759 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
homann committed Mar 4, 2007
1 parent e7d2bca commit 9834716061fec19725eb4bedfa18aa04db566113
Showing with 27 additions and 20 deletions.
  1. +27 −20 src/core/raster/qgsrasterlayer.cpp
@@ -1121,14 +1121,6 @@ bool QgsRasterLayer::draw(QPainter * theQPainter,

// /\/\/\ - added to handle zoomed-in rasters

if ((myRasterViewPort->drawableAreaXDimInt) > 4000 && (myRasterViewPort->drawableAreaYDimInt > 4000))
{
// We have scale one raster pixel to more than 4000 screen pixels. What's the point of showing this layer?
// Instead, we just stop displaying the layer. Prevents allocating the entire world of memory for showing
// The pixel in all its glory.
QgsDebugMsg("Too zoomed out! Raster will not display");
return TRUE;
}

// Provider mode: See if a provider key is specified, and if so use the provider instead

@@ -1142,10 +1134,16 @@ bool QgsRasterLayer::draw(QPainter * theQPainter,

QImage* image =
dataProvider->draw(
myRasterExtent,
myRasterViewPort->drawableAreaXDimInt,
myRasterViewPort->drawableAreaYDimInt
);
myRasterExtent,
// Below should calculate to the actual pixel size of the
// part of the layer that's visible.
static_cast<int>( fabs( (myRasterViewPort->clippedXMaxDouble - myRasterViewPort->clippedXMinDouble)
/ theQgsMapToPixel->mapUnitsPerPixel() * adfGeoTransform[1]) + 1),
static_cast<int>( fabs( (myRasterViewPort->clippedYMaxDouble - myRasterViewPort->clippedYMinDouble)
/ theQgsMapToPixel->mapUnitsPerPixel() * adfGeoTransform[5]) + 1)
// myRasterViewPort->drawableAreaXDimInt,
// myRasterViewPort->drawableAreaYDimInt
);

if (!image)
{
@@ -1195,15 +1193,24 @@ bool QgsRasterLayer::draw(QPainter * theQPainter,
}
else
{
// Otherwise use the old-fashioned GDAL direct-drawing style
// TODO: Move into its own GDAL provider.

// \/\/\/ - commented-out to handle zoomed-in rasters
if ((myRasterViewPort->drawableAreaXDimInt) > 4000 && (myRasterViewPort->drawableAreaYDimInt > 4000))
{
// We have scaled one raster pixel to more than 4000 screen pixels. What's the point of showing this layer?
// Instead, we just stop displaying the layer. Prevents allocating the entire world of memory for showing
// very few pixels.
// (Alternatively, we have a very big screen > 2000 x 2000)
QgsDebugMsg("Too zoomed in! Displaying raster requires too much memory. Raster will not display");
} else {
// Otherwise use the old-fashioned GDAL direct-drawing style
// TODO: Move into its own GDAL provider.

// \/\/\/ - commented-out to handle zoomed-in rasters
// draw(theQPainter,myRasterViewPort);
// /\/\/\ - commented-out to handle zoomed-in rasters
// \/\/\/ - added to handle zoomed-in rasters
draw(theQPainter, myRasterViewPort, theQgsMapToPixel);
// /\/\/\ - added to handle zoomed-in rasters
// /\/\/\ - commented-out to handle zoomed-in rasters
// \/\/\/ - added to handle zoomed-in rasters
draw(theQPainter, myRasterViewPort, theQgsMapToPixel);
// /\/\/\ - added to handle zoomed-in rasters
}

}

0 comments on commit 9834716

Please sign in to comment.