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 f54cc37258beb266423e64f70037a18223f6139e
@@ -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.
You can’t perform that action at this time.