Skip to content

Commit 17c044f

Browse files
author
jef
committedOct 13, 2008
fix #1346
git-svn-id: http://svn.osgeo.org/qgis/trunk@9475 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 738374e commit 17c044f

File tree

2 files changed

+25
-17
lines changed

2 files changed

+25
-17
lines changed
 

‎src/providers/wms/qgswmsprovider.cpp

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -72,21 +72,7 @@ QgsWmsProvider::QgsWmsProvider( QString const & uri )
7272
// 2) http://xxx.xxx.xx/yyy/yyy?
7373
// 3) http://xxx.xxx.xx/yyy/yyy?zzz=www
7474

75-
// Prepare the URI so that we can later simply append param=value
76-
baseUrl = httpuri;
77-
78-
if ( !( baseUrl.contains( "?" ) ) )
79-
{
80-
baseUrl.append( "?" );
81-
}
82-
else if (
83-
( baseUrl.right( 1 ) != "?" )
84-
&&
85-
( baseUrl.right( 1 ) != "&" )
86-
)
87-
{
88-
baseUrl.append( "&" );
89-
}
75+
baseUrl = prepareUri(httpuri);
9076

9177
QgsDebugMsg( "baseUrl = " + baseUrl );
9278

@@ -112,6 +98,23 @@ QgsWmsProvider::QgsWmsProvider( QString const & uri )
11298
QgsDebugMsg( "QgsWmsProvider: exiting constructor." );
11399
}
114100

101+
QString QgsWmsProvider::prepareUri(QString uri)
102+
{
103+
if ( !( uri.contains( "?" ) ) )
104+
{
105+
uri.append( "?" );
106+
}
107+
else if (
108+
( uri.right( 1 ) != "?" ) &&
109+
( uri.right( 1 ) != "&" )
110+
)
111+
{
112+
uri.append( "&" );
113+
}
114+
115+
return uri;
116+
}
117+
115118
QgsWmsProvider::~QgsWmsProvider()
116119
{
117120
QgsDebugMsg( "QgsWmsProvider: deconstructing." );
@@ -376,9 +379,8 @@ QImage* QgsWmsProvider::draw( QgsRect const & viewExtent, int pixelWidth, int p
376379
crsKey = "CRS";
377380
}
378381

379-
QString url = mCapabilities.capability.request.getMap.dcpType.front().http.get.onlineResource.xlinkHref;
382+
QString url = prepareUri(mCapabilities.capability.request.getMap.dcpType.front().http.get.onlineResource.xlinkHref);
380383

381-
url += "?";
382384
url += "SERVICE=WMS";
383385
url += "&";
384386
url += "VERSION=" + mCapabilities.version;

‎src/providers/wms/qgswmsprovider.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -684,6 +684,12 @@ class QgsWmsProvider : public QgsRasterDataProvider
684684
*/
685685
bool calculateExtent();
686686

687+
/**
688+
* \brief Prepare the URI so that we can later simply append param=value
689+
* \param uri uri to prepare
690+
* \retval prepared uri
691+
*/
692+
QString prepareUri(QString uri);
687693

688694
//! Data source URI of the WMS for this layer
689695
QString httpuri;

0 commit comments

Comments
 (0)
Please sign in to comment.