Skip to content
Permalink
Browse files
fix #1346
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 84dc86aee27451ca478d964b3e4b0f631bcee580
Showing with 25 additions and 17 deletions.
  1. +19 −17 src/providers/wms/qgswmsprovider.cpp
  2. +6 −0 src/providers/wms/qgswmsprovider.h
@@ -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 );

@@ -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." );
@@ -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;
@@ -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;

0 comments on commit 84dc86a

Please sign in to comment.