Skip to content

Commit

Permalink
fix #1346
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@9475 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef committed Oct 13, 2008
1 parent a10bfe4 commit 84dc86a
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 17 deletions.
36 changes: 19 additions & 17 deletions src/providers/wms/qgswmsprovider.cpp
Expand Up @@ -72,21 +72,7 @@ QgsWmsProvider::QgsWmsProvider( QString const & uri )
// 2) http://xxx.xxx.xx/yyy/yyy?
// 3) http://xxx.xxx.xx/yyy/yyy?zzz=www

// Prepare the URI so that we can later simply append param=value
baseUrl = httpuri;

if ( !( baseUrl.contains( "?" ) ) )
{
baseUrl.append( "?" );
}
else if (
( baseUrl.right( 1 ) != "?" )
&&
( baseUrl.right( 1 ) != "&" )
)
{
baseUrl.append( "&" );
}
baseUrl = prepareUri(httpuri);

QgsDebugMsg( "baseUrl = " + baseUrl );

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

QString QgsWmsProvider::prepareUri(QString uri)
{
if ( !( uri.contains( "?" ) ) )
{
uri.append( "?" );
}
else if (
( uri.right( 1 ) != "?" ) &&
( uri.right( 1 ) != "&" )
)
{
uri.append( "&" );
}

return uri;
}

QgsWmsProvider::~QgsWmsProvider()
{
QgsDebugMsg( "QgsWmsProvider: deconstructing." );
Expand Down Expand Up @@ -376,9 +379,8 @@ QImage* QgsWmsProvider::draw( QgsRect const & viewExtent, int pixelWidth, int p
crsKey = "CRS";
}

QString url = mCapabilities.capability.request.getMap.dcpType.front().http.get.onlineResource.xlinkHref;
QString url = prepareUri(mCapabilities.capability.request.getMap.dcpType.front().http.get.onlineResource.xlinkHref);

url += "?";
url += "SERVICE=WMS";
url += "&";
url += "VERSION=" + mCapabilities.version;
Expand Down
6 changes: 6 additions & 0 deletions src/providers/wms/qgswmsprovider.h
Expand Up @@ -684,6 +684,12 @@ class QgsWmsProvider : public QgsRasterDataProvider
*/
bool calculateExtent();

/**
* \brief Prepare the URI so that we can later simply append param=value
* \param uri uri to prepare
* \retval prepared uri
*/
QString prepareUri(QString uri);

//! Data source URI of the WMS for this layer
QString httpuri;
Expand Down

0 comments on commit 84dc86a

Please sign in to comment.