Skip to content

Commit 2b59d75

Browse files
committedAug 3, 2012
Add dpi parameters for umn and geoserver also to GetMap request
1 parent 19e7239 commit 2b59d75

File tree

1 file changed

+19
-14
lines changed

1 file changed

+19
-14
lines changed
 

‎src/providers/wms/qgswmsprovider.cpp

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ void QgsWmsProvider::parseUri( QString uriString )
162162
if ( uri.hasParam( "tileDimensions" ) )
163163
{
164164
mTiled = true;
165-
foreach ( QString param, uri.params( "tileDimensions" ) )
165+
foreach( QString param, uri.params( "tileDimensions" ) )
166166
{
167167
QStringList kv = param.split( "=" );
168168
if ( kv.size() == 1 )
@@ -344,7 +344,7 @@ void QgsWmsProvider::addLayers( QStringList const &layers,
344344
mActiveSubStyles += styles;
345345

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

599599
//DPI parameter is accepted by QGIS mapserver (and ignored by the other WMS servers)
600+
//map_resolution parameter works for UMN mapserver
601+
602+
//Different WMS servers have DPI parameters:
600603
if ( mDpi != -1 )
601604
{
602-
setQueryItem( url, "DPI", QString::number( mDpi ) );
605+
setQueryItem( url, "DPI", QString::number( mDpi ) ); //QGIS server
606+
setQueryItem( url, "MAP_RESOLUTION", QString::number( mDpi ) ); //UMN mapserver
607+
setQueryItem( url, "FORMAT_OPTIONS", QString( "dpi:%1" ).arg( mDpi ) ); //geoserver
603608
}
604609

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

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

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

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

31413146
if ( canIdentify )
31423147
{
3143-
foreach ( QString f, mCapabilities.capability.request.getFeatureInfo.format )
3148+
foreach( QString f, mCapabilities.capability.request.getFeatureInfo.format )
31443149
{
31453150
if ( mSupportedGetFeatureFormats.contains( f ) )
31463151
{
@@ -3581,7 +3586,7 @@ QString QgsWmsProvider::metadata()
35813586
metadata += "<tr><td>";
35823587
metadata += "<table width=\"100%\">";
35833588

3584-
foreach ( const QgsWmtsTileLayer &l, mTileLayersSupported )
3589+
foreach( const QgsWmtsTileLayer &l, mTileLayersSupported )
35853590
{
35863591
metadata += "<tr><td colspan=\"2\">";
35873592
metadata += l.identifier;
@@ -3624,7 +3629,7 @@ QString QgsWmsProvider::metadata()
36243629
metadata += "</td>";
36253630
metadata += "<td class=\"glossy\">";
36263631
QStringList styles;
3627-
foreach ( const QgsWmtsStyle &style, l.styles )
3632+
foreach( const QgsWmtsStyle &style, l.styles )
36283633
{
36293634
styles << style.identifier;
36303635
}
@@ -3650,7 +3655,7 @@ QString QgsWmsProvider::metadata()
36503655
metadata += tr( "Available Tilesets" );
36513656
metadata += "</td><td class=\"glossy\">";
36523657

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

3836-
foreach ( QString f, mSupportedGetFeatureFormats )
3841+
foreach( QString f, mSupportedGetFeatureFormats )
38373842
{
38383843
if ( mCapabilities.capability.request.getFeatureInfo.format.contains( f ) )
38393844
{

0 commit comments

Comments
 (0)