Skip to content
Permalink
Browse files

Use a DPI parameter in the WMS request. This allows printing with QGI…

…S from QGIS mapserver (and is ignored by the other WMS servers)

git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@10885 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent
mhugent committed Jun 5, 2009
1 parent 6881ec7 commit b416b630ce9324cbbe3dbb0419602135573c114d
@@ -120,6 +120,14 @@ public:
*/
virtual QString lastError() = 0;

/**Returns the dpi of the output device.
@note: this method was added in version 1.2*/
int dpi();

/**Sets the output device resolution.
@note: this method was added in version 1.2*/
void setDpi(int dpi);


protected:

@@ -19,13 +19,13 @@
#include "qgsrasterdataprovider.h"
#include "qgslogger.h"

QgsRasterDataProvider::QgsRasterDataProvider()
QgsRasterDataProvider::QgsRasterDataProvider(): mDpi(-1)
{
}


QgsRasterDataProvider::QgsRasterDataProvider( QString const & uri )
: QgsDataProvider( uri )
: QgsDataProvider( uri ), mDpi(-1)
{
}

@@ -152,8 +152,20 @@ class CORE_EXPORT QgsRasterDataProvider : public QgsDataProvider
*/
virtual QString lastError() = 0;

/**Returns the dpi of the output device.
@note: this method was added in version 1.2*/
int dpi() const {return mDpi;}

/**Sets the output device resolution.
@note: this method was added in version 1.2*/
void setDpi(int dpi){mDpi = dpi;}


protected:
/**Dots per intch. Extended WMS (e.g. QGIS mapserver) support DPI dependent output and therefore
are suited for printing. A value of -1 means it has not been set
@note: this member has been added in version 1.2*/
int mDpi;

};

@@ -454,6 +454,12 @@ QImage* QgsWmsProvider::draw( QgsRectangle const & viewExtent, int pixelWidth,
url += "&";
url += "FORMAT=" + imageMimeType;

//DPI parameter is accepted by QGIS mapserver (and ignored by the other WMS servers)
if(mDpi != -1)
{
url += "&DPI=" + QString::number(mDpi);
}

//MH: jpeg does not support transparency and some servers complain if jpg and transparent=true
if ( !imageMimeType.contains( "jpeg", Qt::CaseInsensitive ) && !imageMimeType.contains( "jpg", Qt::CaseInsensitive ) )
{

0 comments on commit b416b63

Please sign in to comment.
You can’t perform that action at this time.