Skip to content

Commit 038f6cc

Browse files
author
mhugent
committed
Fix for small raster shift introduced by my raster memory handling improvements
git-svn-id: http://svn.osgeo.org/qgis/trunk@12904 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 6b9f41d commit 038f6cc

File tree

1 file changed

+23
-6
lines changed

1 file changed

+23
-6
lines changed

src/core/raster/qgsrasterlayer.cpp

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1118,7 +1118,7 @@ QgsRasterLayer::RasterPyramidList QgsRasterLayer::buildPyramidList()
11181118
int myWidth = mWidth;
11191119
int myHeight = mHeight;
11201120
int myDivisor = 2;
1121-
1121+
11221122
if ( mDataProvider ) return mPyramidList;
11231123

11241124
GDALRasterBandH myGDALBand = GDALGetRasterBand( mGdalDataset, 1 ); //just use the first band
@@ -3227,7 +3227,7 @@ void QgsRasterLayer::setDataProvider( QString const & provider,
32273227
mDrawingStyle = MultiBandColor; //sensible default
32283228

32293229
// Setup source CRS
3230-
if ( mProviderKey == "wms" )
3230+
if ( mProviderKey == "wms" )
32313231
{
32323232
*mCRS = QgsCoordinateReferenceSystem();
32333233
mCRS->createFromOgcWmsCrs( crs );
@@ -5417,7 +5417,8 @@ bool QgsRasterLayer::update()
54175417

54185418
if ( mLastModified < QgsRasterLayer::lastModified( source() ) )
54195419
{
5420-
if ( !usesProvider() ) {
5420+
if ( !usesProvider() )
5421+
{
54215422
QgsDebugMsg( "Outdated -> reload" );
54225423
closeDataset();
54235424
return readFile( source() );
@@ -5600,9 +5601,25 @@ bool QgsRasterImageBuffer::createNextPartImage()
56005601
}
56015602
else
56025603
{
5603-
double xLeft = mViewPort->topLeftPoint.x();
5604-
double yTop = mViewPort->topLeftPoint.y() + fabs( mGeoTransform[5] ) * mCurrentPartRasterMin / mMapToPixel->mapUnitsPerPixel();
5605-
mPainter->drawImage( QPointF( xLeft, yTop + 0.5 ), *mCurrentImage );
5604+
int paintXoffset = static_cast<int>(
5605+
( mViewPort->rectXOffsetFloat -
5606+
mViewPort->rectXOffset )
5607+
/ mMapToPixel->mapUnitsPerPixel()
5608+
* fabs( mGeoTransform[1] )
5609+
);
5610+
5611+
int paintYoffset = static_cast<int>(
5612+
( mViewPort->rectYOffsetFloat -
5613+
mViewPort->rectYOffset )
5614+
/ mMapToPixel->mapUnitsPerPixel()
5615+
* fabs( mGeoTransform[5] )
5616+
);
5617+
5618+
mPainter->drawImage( static_cast<int>( mViewPort->topLeftPoint.x() + 0.5 ),
5619+
static_cast<int>( mViewPort->topLeftPoint.y() + 0.5 + fabs( mGeoTransform[5] ) * mCurrentPartRasterMin / mMapToPixel->mapUnitsPerPixel() ),
5620+
*mCurrentImage,
5621+
paintXoffset,
5622+
paintYoffset );
56065623
}
56075624
}
56085625
}

0 commit comments

Comments
 (0)