Skip to content

Commit

Permalink
Use screen dpi as reference dpi for computing wmts composer scale factor
Browse files Browse the repository at this point in the history
Ref: 813f818caef896a0f3b3e0ebed8436803ee908e4
  • Loading branch information
manisandro committed Dec 22, 2016
1 parent faa35ae commit 09a4cb0
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/core/raster/qgsrasterdrawer.cpp
Expand Up @@ -49,7 +49,9 @@ void QgsRasterDrawer::draw( QPainter* p, QgsRasterViewPort* viewPort, const QgsM

if ( ctx && ctx->customRenderFlags().split( ";" ).contains( "composer" ) && isWMTSLayer( mIterator->input() ) ) //wmts case, comply with standard pixel size of 0.28mm from specification
{
scaleFactor = ( 1.0 / 0.28 * 25.4 ) / p->device()->logicalDpiX();
QImage image( 1, 1, QImage::Format_ARGB32 );
scaleFactor = double( image.logicalDpiX() ) / p->device()->logicalDpiX();
QgsDebugMsg( QString( "Scale factor: %1 (device DPI: %2)" ).arg( scaleFactor ).arg( p->device()->logicalDpiX() ) );
width = width * scaleFactor;
height = height * scaleFactor;
mapToPixel.setParameters( ctx->extent().width() / width, ctx->extent().xMinimum(), ctx->extent().yMinimum(), height );
Expand Down

0 comments on commit 09a4cb0

Please sign in to comment.