Skip to content

Commit

Permalink
Fix WMS DPI scale rounding error
Browse files Browse the repository at this point in the history
Backported from master PR #42292
  • Loading branch information
elpaso authored and nyalldawson committed Apr 17, 2021
1 parent 6eadd09 commit 0d736e1
Show file tree
Hide file tree
Showing 49 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/server/services/wms/qgswmsrendercontext.cpp
Expand Up @@ -167,7 +167,7 @@ qreal QgsWmsRenderContext::dotsPerMm() const
// Apply DPI parameter if present. This is an extension of QGIS Server
// compared to WMS 1.3.
// Because of backwards compatibility, this parameter is optional
int dpm = 1 / OGC_PX_M;
qreal dpm = 1 / OGC_PX_M;

if ( !mParameters.dpi().isEmpty() )
{
Expand Down
4 changes: 3 additions & 1 deletion src/server/services/wms/qgswmsrenderer.cpp
Expand Up @@ -1035,7 +1035,9 @@ namespace QgsWms
}

mapSettings.setOutputSize( QSize( paintDevice->width(), paintDevice->height() ) );
mapSettings.setOutputDpi( paintDevice->logicalDpiX() );
// Recalculate from input DPI: do not take the (integer) value from paint device
// because it loose precision!
mapSettings.setOutputDpi( mContext.dotsPerMm() * 25.4 );

//map extent
QgsRectangle mapExtent = mWmsParameters.bboxAsRectangle();
Expand Down
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 0d736e1

Please sign in to comment.