Skip to content
Permalink
Browse files
fix server issue for devicePixelRatio leading to DPI requests with de…
…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.
@@ -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
@@ -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.
@@ -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 );

0 comments on commit f54cc37

Please sign in to comment.