Skip to content
Permalink
Browse files

Add dpi parameters for umn and geoserver also to GetMap request

  • Loading branch information
mhugent committed Aug 3, 2012
1 parent 19e7239 commit 2b59d757a390b4cf18d2482c87a6dd8c83c49c46
Showing with 19 additions and 14 deletions.
  1. +19 −14 src/providers/wms/qgswmsprovider.cpp
@@ -162,7 +162,7 @@ void QgsWmsProvider::parseUri( QString uriString )
if ( uri.hasParam( "tileDimensions" ) )
{
mTiled = true;
foreach ( QString param, uri.params( "tileDimensions" ) )
foreach( QString param, uri.params( "tileDimensions" ) )
{
QStringList kv = param.split( "=" );
if ( kv.size() == 1 )
@@ -344,7 +344,7 @@ void QgsWmsProvider::addLayers( QStringList const &layers,
mActiveSubStyles += styles;

// Set the visibility of these new layers on by default
foreach ( const QString &layer, layers )
foreach( const QString &layer, layers )
{
mActiveSubLayerVisibility[ layer ] = true;
QgsDebugMsg( "set visibility of layer '" + layer + "' to true." );
@@ -465,7 +465,7 @@ void QgsWmsProvider::setImageCrs( QString const & crs )
mTileMatrixSet = &mTileMatrixSets[ mTileMatrixSetId ];
QList<double> keys = mTileMatrixSet->tileMatrices.keys();
qSort( keys );
foreach ( double key, keys )
foreach( double key, keys )
{
resolutions << key;
}
@@ -597,9 +597,14 @@ QImage *QgsWmsProvider::draw( QgsRectangle const &viewExtent, int pixelWidth, i
setQueryItem( url, "FORMAT", mImageMimeType );

//DPI parameter is accepted by QGIS mapserver (and ignored by the other WMS servers)
//map_resolution parameter works for UMN mapserver

//Different WMS servers have DPI parameters:
if ( mDpi != -1 )
{
setQueryItem( url, "DPI", QString::number( mDpi ) );
setQueryItem( url, "DPI", QString::number( mDpi ) ); //QGIS server
setQueryItem( url, "MAP_RESOLUTION", QString::number( mDpi ) ); //UMN mapserver
setQueryItem( url, "FORMAT_OPTIONS", QString( "dpi:%1" ).arg( mDpi ) ); //geoserver
}

//MH: jpeg does not support transparency and some servers complain if jpg and transparent=true
@@ -948,7 +953,7 @@ void QgsWmsProvider::tileReplyFinished()
#endif
#if defined(QGISDEBUG) && (QT_VERSION >= 0x40700)
QgsDebugMsgLevel( "raw headers:", 3 );
foreach ( const QNetworkReply::RawHeaderPair &pair, reply->rawHeaderPairs() )
foreach( const QNetworkReply::RawHeaderPair &pair, reply->rawHeaderPairs() )
{
QgsDebugMsgLevel( QString( " %1:%2" )
.arg( QString::fromUtf8( pair.first ) )
@@ -959,7 +964,7 @@ void QgsWmsProvider::tileReplyFinished()
QNetworkCacheMetaData cmd = QgsNetworkAccessManager::instance()->cache()->metaData( reply->request().url() );

QNetworkCacheMetaData::RawHeaderList hl;
foreach ( const QNetworkCacheMetaData::RawHeader &h, cmd.rawHeaders() )
foreach( const QNetworkCacheMetaData::RawHeader &h, cmd.rawHeaders() )
{
if ( h.first != "Cache-Control" )
hl.append( h );
@@ -2127,7 +2132,7 @@ void QgsWmsProvider::parseLayer( QDomElement const & e, QgsWmsLayerProperty& lay
{
// CRS can contain several definitions separated by whitespace
// though this was deprecated in WMS 1.1.1
foreach ( QString srs, e1.text().split( QRegExp( "\\s+" ) ) )
foreach( QString srs, e1.text().split( QRegExp( "\\s+" ) ) )
{
layerProperty.crs.push_back( srs );
}
@@ -2418,7 +2423,7 @@ void QgsWmsProvider::parseTileSetProfile( QDomElement const &e )
m.topLeft = QgsPoint( l.boundingBox.box.xMinimum(), l.boundingBox.box.yMaximum() );

int i = 0;
foreach ( QString rS, resolutions )
foreach( QString rS, resolutions )
{
double r = rS.toDouble();
m.identifier = QString::number( i );
@@ -2707,7 +2712,7 @@ void QgsWmsProvider::parseWMTSContents( QDomElement const &e )

bool isValid = false;
int matrixWidth = -1, matrixHeight = -1;
foreach ( const QgsWmtsTileMatrix &m, tms.tileMatrices )
foreach( const QgsWmtsTileMatrix &m, tms.tileMatrices )
{
isValid = m.identifier == id;
if ( isValid )
@@ -3140,7 +3145,7 @@ int QgsWmsProvider::capabilities() const

if ( canIdentify )
{
foreach ( QString f, mCapabilities.capability.request.getFeatureInfo.format )
foreach( QString f, mCapabilities.capability.request.getFeatureInfo.format )
{
if ( mSupportedGetFeatureFormats.contains( f ) )
{
@@ -3581,7 +3586,7 @@ QString QgsWmsProvider::metadata()
metadata += "<tr><td>";
metadata += "<table width=\"100%\">";

foreach ( const QgsWmtsTileLayer &l, mTileLayersSupported )
foreach( const QgsWmtsTileLayer &l, mTileLayersSupported )
{
metadata += "<tr><td colspan=\"2\">";
metadata += l.identifier;
@@ -3624,7 +3629,7 @@ QString QgsWmsProvider::metadata()
metadata += "</td>";
metadata += "<td class=\"glossy\">";
QStringList styles;
foreach ( const QgsWmtsStyle &style, l.styles )
foreach( const QgsWmtsStyle &style, l.styles )
{
styles << style.identifier;
}
@@ -3650,7 +3655,7 @@ QString QgsWmsProvider::metadata()
metadata += tr( "Available Tilesets" );
metadata += "</td><td class=\"glossy\">";

foreach ( const QgsWmtsTileMatrixSetLink &setLink, l.setLinks )
foreach( const QgsWmtsTileMatrixSetLink &setLink, l.setLinks )
{
metadata += setLink.tileMatrixSet + "<br>";
}
@@ -3833,7 +3838,7 @@ QString QgsWmsProvider::identifyAsHtml( const QgsPoint &point )
{
QString format;

foreach ( QString f, mSupportedGetFeatureFormats )
foreach( QString f, mSupportedGetFeatureFormats )
{
if ( mCapabilities.capability.request.getFeatureInfo.format.contains( f ) )
{

0 comments on commit 2b59d75

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