Skip to content
Permalink
Browse files

Fix WMS DPI scale rounding error

Backported from master PR #42292
  • Loading branch information
elpaso authored and nyalldawson committed Mar 19, 2021
1 parent 202f1bf commit 520331c745228ee484de610977a8bbf2c1acd027
Showing with 4 additions and 2 deletions.
  1. +1 −1 src/server/services/wms/qgswmsrendercontext.cpp
  2. +3 −1 src/server/services/wms/qgswmsrenderer.cpp
  3. BIN ...faultMapUnitsPerMillimeter/WMS_GetLegendGraphic_ScaleSymbol_DefaultMapUnitsPerMillimeter_mask.png
  4. BIN ...ultMapUnitsPerMillimeter/WMS_GetLegendGraphic_ScaleSymbol_DefaultMapUnitsPerMillimeter_result.png
  5. BIN ...Graphic_ScaleSymbol_DefaultScale_2056/WMS_GetLegendGraphic_ScaleSymbol_DefaultScale_2056_mask.png
  6. BIN tests/testdata/control_images/qgis_server/WMS_GetMap_Annotations/WMS_GetMap_Annotations_mask.png
  7. BIN tests/testdata/control_images/qgis_server/WMS_GetMap_Background/WMS_GetMap_Background_mask.png
  8. BIN .../testdata/control_images/qgis_server/WMS_GetMap_Background_Hex/WMS_GetMap_Background_Hex_mask.png
  9. BIN tests/testdata/control_images/qgis_server/WMS_GetMap_Basic/WMS_GetMap_Basic_mask.png
  10. BIN tests/testdata/control_images/qgis_server/WMS_GetMap_Basic2/WMS_GetMap_Basic2_mask.png
  11. BIN tests/testdata/control_images/qgis_server/WMS_GetMap_Basic3/WMS_GetMap_Basic3_mask.png
  12. BIN tests/testdata/control_images/qgis_server/WMS_GetMap_Basic4/WMS_GetMap_Basic4_mask.png
  13. BIN tests/testdata/control_images/qgis_server/WMS_GetMap_Basic5/WMS_GetMap_Basic5_mask.png
  14. BIN ...tdata/control_images/qgis_server/WMS_GetMap_ContextRendering/WMS_GetMap_ContextRendering_mask.png
  15. BIN tests/testdata/control_images/qgis_server/WMS_GetMap_Diagrams/WMS_GetMap_Diagrams_mask.png
  16. BIN ...rol_images/qgis_server/WMS_GetMap_Dimension_All_NoValue/WMS_GetMap_Dimension_All_NoValue_mask.png
  17. BIN ...server/WMS_GetMap_Dimension_Elevation_MixValues/WMS_GetMap_Dimension_Elevation_MixValues_mask.png
  18. BIN ...er/WMS_GetMap_Dimension_Elevation_MultiValues/WMS_GetMap_Dimension_Elevation_MultiValues_mask.png
  19. BIN ...rver/WMS_GetMap_Dimension_Elevation_RangeValue/WMS_GetMap_Dimension_Elevation_RangeValue_mask.png
  20. BIN ...p_Dimension_Elevation_RangeValue_Filter/WMS_GetMap_Dimension_Elevation_RangeValue_Filter_mask.png
  21. BIN ...es/qgis_server/WMS_GetMap_Dimension_Elevation_Value/WMS_GetMap_Dimension_Elevation_Value_mask.png
  22. BIN tests/testdata/control_images/qgis_server/WMS_GetMap_Filter/WMS_GetMap_Filter_mask.png
  23. BIN tests/testdata/control_images/qgis_server/WMS_GetMap_Filter2/WMS_GetMap_Filter2_mask.png
  24. BIN tests/testdata/control_images/qgis_server/WMS_GetMap_Filter3/WMS_GetMap_Filter3_mask.png
  25. BIN tests/testdata/control_images/qgis_server/WMS_GetMap_Filter4/WMS_GetMap_Filter4_mask.png
  26. BIN tests/testdata/control_images/qgis_server/WMS_GetMap_Filter_OGC/WMS_GetMap_Filter_OGC_mask.png
  27. BIN tests/testdata/control_images/qgis_server/WMS_GetMap_Filter_OGC2/WMS_GetMap_Filter_OGC2_mask.png
  28. BIN tests/testdata/control_images/qgis_server/WMS_GetMap_Filter_OGC3/WMS_GetMap_Filter_OGC3_mask.png
  29. BIN tests/testdata/control_images/qgis_server/WMS_GetMap_Filter_OGC_V2/WMS_GetMap_Filter_OGC_V2_mask.png
  30. BIN tests/testdata/control_images/qgis_server/WMS_GetMap_Highlight/WMS_GetMap_Highlight_mask.png
  31. BIN .../testdata/control_images/qgis_server/WMS_GetMap_Highlight_Line/WMS_GetMap_Highlight_Line_mask.png
  32. BIN ...estdata/control_images/qgis_server/WMS_GetMap_Highlight_Point/WMS_GetMap_Highlight_Point_mask.png
  33. BIN ...s/testdata/control_images/qgis_server/WMS_GetMap_LabelingSettings/WMS_GetMap_LabelingSettings.png
  34. BIN ...tdata/control_images/qgis_server/WMS_GetMap_LabelingSettings/WMS_GetMap_LabelingSettings_mask.png
  35. BIN ...tdata/control_images/qgis_server/WMS_GetMap_Labeling_Complex/WMS_GetMap_Labeling_Complex_mask.png
  36. BIN tests/testdata/control_images/qgis_server/WMS_GetMap_LayerOrder/WMS_GetMap_LayerOrder_mask.png
  37. BIN tests/testdata/control_images/qgis_server/WMS_GetMap_Opacities/WMS_GetMap_Opacities_mask.png
  38. BIN tests/testdata/control_images/qgis_server/WMS_GetMap_Opacities2/WMS_GetMap_Opacities2_mask.png
  39. BIN tests/testdata/control_images/qgis_server/WMS_GetMap_Opacities3/WMS_GetMap_Opacities3_mask.png
  40. BIN tests/testdata/control_images/qgis_server/WMS_GetMap_SLDRestored/WMS_GetMap_SLDRestored_mask.png
  41. BIN tests/testdata/control_images/qgis_server/WMS_GetMap_SRS/WMS_GetMap_SRS_mask.png
  42. BIN tests/testdata/control_images/qgis_server/WMS_GetMap_Selection/WMS_GetMap_Selection_mask.png
  43. BIN tests/testdata/control_images/qgis_server/WMS_GetMap_StyleCustom/WMS_GetMap_StyleCustom_mask.png
  44. BIN tests/testdata/control_images/qgis_server/WMS_GetMap_StyleDefault/WMS_GetMap_StyleDefault_mask.png
  45. BIN tests/testdata/control_images/qgis_server/WMS_GetMap_StyleMixed/WMS_GetMap_StyleMixed_mask.png
  46. BIN ...rol_images/qgis_server/WMS_GetMap_StyleMixed_LayerOrder/WMS_GetMap_StyleMixed_LayerOrder_mask.png
  47. BIN tests/testdata/control_images/qgis_server/WMS_GetMap_Transparent/WMS_GetMap_Transparent.png
  48. BIN tests/testdata/control_images/qgis_server_accesscontrol/WMS_GetMap/WMS_GetMap_mask.png
  49. BIN ...images/qgis_server_accesscontrol/WMS_GetMap_projectsubstring/WMS_GetMap_projectsubstring_mask.png
@@ -172,7 +172,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() )
{
@@ -1096,7 +1096,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();
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.

0 comments on commit 520331c

Please sign in to comment.