[QGIS Commit] r13308 - trunk/qgis/src/core/raster
svn_qgis at osgeo.org
svn_qgis at osgeo.org
Wed Apr 14 02:59:47 EDT 2010
Author: mhugent
Date: 2010-04-14 02:59:46 -0400 (Wed, 14 Apr 2010)
New Revision: 13308
Modified:
trunk/qgis/src/core/raster/qgsrasterlayer.cpp
Log:
Fix rounding for WMS stripes
Modified: trunk/qgis/src/core/raster/qgsrasterlayer.cpp
===================================================================
--- trunk/qgis/src/core/raster/qgsrasterlayer.cpp 2010-04-13 22:22:23 UTC (rev 13307)
+++ trunk/qgis/src/core/raster/qgsrasterlayer.cpp 2010-04-14 06:59:46 UTC (rev 13308)
@@ -364,7 +364,7 @@
if ( !( myGdalDriverExtension.isEmpty() || myGdalDriverLongName.isEmpty() ) )
{
// XXX add check for SDTS; in that case we want (*CATD.DDF)
- QString glob = "*." + myGdalDriverExtension.replace("/", " *.");
+ QString glob = "*." + myGdalDriverExtension.replace( "/", " *." );
// Add only the first JP2 driver found to the filter list (it's the one GDAL uses)
if ( myGdalDriverDescription == "JPEG2000" ||
myGdalDriverDescription.startsWith( "JP2" ) ) // JP2ECW, JP2KAK, JP2MrSID
@@ -1558,14 +1558,23 @@
int currentPixelOffsetY = 0; //top y-coordinate of current raster part
//the width of a WMS image part
- int pixelWidth = ( myRasterExtent.xMaximum() - myRasterExtent.xMinimum() ) / theQgsMapToPixel.mapUnitsPerPixel();
+ int pixelWidth = ( myRasterExtent.xMaximum() - myRasterExtent.xMinimum() ) / theQgsMapToPixel.mapUnitsPerPixel() + 0.5;
for ( int i = 0; i < numParts; ++i )
{
//fetch a small overlap of 2 pixels between two adjacent tiles to avoid white stripes
QgsRectangle rasterPartRect( myRasterExtent.xMinimum(), myRasterExtent.yMaximum() - ( currentPixelOffsetY + numRowsPerPart + 2 ) * theQgsMapToPixel.mapUnitsPerPixel(),
myRasterExtent.xMaximum(), myRasterExtent.yMaximum() - currentPixelOffsetY * theQgsMapToPixel.mapUnitsPerPixel() );
- int pixelHeight = rasterPartRect.height() / theQgsMapToPixel.mapUnitsPerPixel();
+ int pixelHeight = rasterPartRect.height() / theQgsMapToPixel.mapUnitsPerPixel() + 0.5;
+
+ /*
+ QgsDebugMsg( "**********WMS tile parameter***************" );
+ QgsDebugMsg( "pixelWidth: " + QString::number( pixelWidth ) );
+ QgsDebugMsg( "pixelHeight: " + QString::number( pixelHeight ) );
+ QgsDebugMsg( "mapWidth: " + QString::number( rasterPartRect.width() ) );
+ QgsDebugMsg( "mapHeight: " + QString::number( rasterPartRect.height(), 'f', 8 ) );
+ QgsDebugMsg( "mapUnitsPerPixel: " + QString::number( theQgsMapToPixel.mapUnitsPerPixel() ) );*/
+
QImage* image = mDataProvider->draw( rasterPartRect, pixelWidth, pixelHeight );
if ( !image )
More information about the QGIS-commit
mailing list