Navigation Menu

Skip to content

Commit

Permalink
fix server issue for devicePixelRatio leading to DPI requests with de…
Browse files Browse the repository at this point in the history
…cimals

Some requests send the DPI parameters with decimals due to
devicePixelRatio and the Server doesn't cope with that. This fixes it.
  • Loading branch information
tudorbarascu committed Feb 7, 2018
1 parent 2cbf139 commit f54cc37
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/server/services/wms/qgswmsparameters.cpp
Expand Up @@ -685,9 +685,9 @@ namespace QgsWms
return value( ParameterName::DPI ).toString();
}

int QgsWmsParameters::dpiAsInt() const
double QgsWmsParameters::dpiAsDouble() const
{
return toInt( ParameterName::DPI );
return toDouble( ParameterName::DPI );
}

QString QgsWmsParameters::version() const
Expand Down
2 changes: 1 addition & 1 deletion src/server/services/wms/qgswmsparameters.h
Expand Up @@ -892,7 +892,7 @@ namespace QgsWms
* \returns dpi parameter
* \throws QgsBadRequestException
*/
int dpiAsInt() const;
double dpiAsDouble() const;

/**
* Returns TEMPLATE parameter or an empty string if not defined.
Expand Down
2 changes: 1 addition & 1 deletion src/server/services/wms/qgswmsrenderer.cpp
Expand Up @@ -1046,7 +1046,7 @@ namespace QgsWms
double OGC_PX_M = 0.00028; // OGC reference pixel size in meter, also used by qgis
int dpm = 1 / OGC_PX_M;
if ( !mWmsParameters.dpi().isEmpty() )
dpm = mWmsParameters.dpiAsInt() / 0.0254;
dpm = mWmsParameters.dpiAsDouble() / 0.0254;

image->setDotsPerMeterX( dpm );
image->setDotsPerMeterY( dpm );
Expand Down

0 comments on commit f54cc37

Please sign in to comment.