Skip to content

Commit df47f65

Browse files
author
mhugent
committedApr 14, 2010
Fix rounding for WMS stripes
git-svn-id: http://svn.osgeo.org/qgis/trunk@13308 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 44091ae commit df47f65

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed
 

‎src/core/raster/qgsrasterlayer.cpp

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ void QgsRasterLayer::buildSupportedRasterFileFilter( QString & theFileFiltersStr
364364
if ( !( myGdalDriverExtension.isEmpty() || myGdalDriverLongName.isEmpty() ) )
365365
{
366366
// XXX add check for SDTS; in that case we want (*CATD.DDF)
367-
QString glob = "*." + myGdalDriverExtension.replace("/", " *.");
367+
QString glob = "*." + myGdalDriverExtension.replace( "/", " *." );
368368
// Add only the first JP2 driver found to the filter list (it's the one GDAL uses)
369369
if ( myGdalDriverDescription == "JPEG2000" ||
370370
myGdalDriverDescription.startsWith( "JP2" ) ) // JP2ECW, JP2KAK, JP2MrSID
@@ -1558,14 +1558,23 @@ bool QgsRasterLayer::draw( QgsRenderContext& rendererContext )
15581558

15591559
int currentPixelOffsetY = 0; //top y-coordinate of current raster part
15601560
//the width of a WMS image part
1561-
int pixelWidth = ( myRasterExtent.xMaximum() - myRasterExtent.xMinimum() ) / theQgsMapToPixel.mapUnitsPerPixel();
1561+
int pixelWidth = ( myRasterExtent.xMaximum() - myRasterExtent.xMinimum() ) / theQgsMapToPixel.mapUnitsPerPixel() + 0.5;
15621562
for ( int i = 0; i < numParts; ++i )
15631563
{
15641564
//fetch a small overlap of 2 pixels between two adjacent tiles to avoid white stripes
15651565
QgsRectangle rasterPartRect( myRasterExtent.xMinimum(), myRasterExtent.yMaximum() - ( currentPixelOffsetY + numRowsPerPart + 2 ) * theQgsMapToPixel.mapUnitsPerPixel(),
15661566
myRasterExtent.xMaximum(), myRasterExtent.yMaximum() - currentPixelOffsetY * theQgsMapToPixel.mapUnitsPerPixel() );
15671567

1568-
int pixelHeight = rasterPartRect.height() / theQgsMapToPixel.mapUnitsPerPixel();
1568+
int pixelHeight = rasterPartRect.height() / theQgsMapToPixel.mapUnitsPerPixel() + 0.5;
1569+
1570+
/*
1571+
QgsDebugMsg( "**********WMS tile parameter***************" );
1572+
QgsDebugMsg( "pixelWidth: " + QString::number( pixelWidth ) );
1573+
QgsDebugMsg( "pixelHeight: " + QString::number( pixelHeight ) );
1574+
QgsDebugMsg( "mapWidth: " + QString::number( rasterPartRect.width() ) );
1575+
QgsDebugMsg( "mapHeight: " + QString::number( rasterPartRect.height(), 'f', 8 ) );
1576+
QgsDebugMsg( "mapUnitsPerPixel: " + QString::number( theQgsMapToPixel.mapUnitsPerPixel() ) );*/
1577+
15691578
QImage* image = mDataProvider->draw( rasterPartRect, pixelWidth, pixelHeight );
15701579

15711580
if ( !image )

0 commit comments

Comments
 (0)
Please sign in to comment.