306 changes: 194 additions & 112 deletions src/providers/wms/qgswmsprovider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,12 @@ void QgsWmsProvider::setImageCrs( QString const & crs )
}
}

void QgsWmsProvider::setQueryItem( QUrl &url, QString item, QString value )
{
url.removeQueryItem( item );
url.addQueryItem( item, value );
}

QImage *QgsWmsProvider::draw( QgsRectangle const &viewExtent, int pixelWidth, int pixelHeight )
{
QgsDebugMsg( "Entering." );
Expand Down Expand Up @@ -420,8 +426,6 @@ QImage *QgsWmsProvider::draw( QgsRectangle const &viewExtent, int pixelWidth, i
crsKey = "CRS";
}

QString url = mIgnoreGetMapUrl ? mBaseUrl : getMapUrl();

cachedImage = new QImage( pixelWidth, pixelHeight, QImage::Format_ARGB32 );
cachedImage->fill( 0 );
cachedViewExtent = viewExtent;
Expand Down Expand Up @@ -468,59 +472,52 @@ QImage *QgsWmsProvider::draw( QgsRectangle const &viewExtent, int pixelWidth, i
.arg( viewExtent.xMaximum(), 0, 'f' )
.arg( viewExtent.yMaximum(), 0, 'f' );

// Width in WMS format
QString width;
width = width.setNum( pixelWidth );

// Height in WMS format
QString height;
height = height.setNum( pixelHeight );

url += "SERVICE=WMS";
url += "&VERSION=" + mCapabilities.version;
url += "&REQUEST=GetMap";
url += "&BBOX=" + bbox;
url += "&" + crsKey + "=" + imageCrs;
url += "&WIDTH=" + width;
url += "&HEIGHT=" + height;
url += "&LAYERS=" + layers;
url += "&STYLES=" + styles;
url += "&FORMAT=" + imageMimeType;
QUrl url( mIgnoreGetMapUrl ? mBaseUrl : getMapUrl() );
setQueryItem( url, "SERVICE", "WMS" );
setQueryItem( url, "VERSION", mCapabilities.version );
setQueryItem( url, "REQUEST", "GetMap" );
setQueryItem( url, "BBOX", bbox );
setQueryItem( url, crsKey, imageCrs );
setQueryItem( url, "WIDTH", QString::number( pixelWidth ) );
setQueryItem( url, "HEIGHT", QString::number( pixelHeight ) );
setQueryItem( url, "LAYERS", layers );
setQueryItem( url, "STYLES", styles );
setQueryItem( url, "FORMAT", imageMimeType );

//DPI parameter is accepted by QGIS mapserver (and ignored by the other WMS servers)
if ( mDpi != -1 )
{
url += "&DPI=" + QString::number( mDpi );
setQueryItem( url, "DPI", QString::number( mDpi ) );
}

//MH: jpeg does not support transparency and some servers complain if jpg and transparent=true
if ( !imageMimeType.contains( "jpeg", Qt::CaseInsensitive ) && !imageMimeType.contains( "jpg", Qt::CaseInsensitive ) )
{
// some servers giving error for 'true' (lowercase)
//url += "&TRANSPARENT=true";
url += "&TRANSPARENT=TRUE";
setQueryItem( url, "TRANSPARENT", "TRUE" ); // some servers giving error for 'true' (lowercase)
}

mGetFeatureInfoUrlBase = mIgnoreGetFeatureInfoUrl ? mBaseUrl : getFeatureInfoUrl();
QgsDebugMsg( QString( "getmap: %1" ).arg( url.toString() ) );

// cache some details for if the user wants to do an identifyAsHtml() later
mGetFeatureInfoUrlBase += "SERVICE=WMS";
mGetFeatureInfoUrlBase += "&VERSION=" + mCapabilities.version;
mGetFeatureInfoUrlBase += "&REQUEST=GetFeatureInfo";
mGetFeatureInfoUrlBase += "&BBOX=" + bbox;
mGetFeatureInfoUrlBase += "&" + crsKey + "=" + imageCrs;
mGetFeatureInfoUrlBase += "&WIDTH=" + width;
mGetFeatureInfoUrlBase += "&HEIGHT=" + height;
mGetFeatureInfoUrlBase += "&LAYERS=" + layers;
mGetFeatureInfoUrlBase += "&STYLES=" + styles;
mGetFeatureInfoUrlBase += "&FORMAT=" + imageMimeType;
QUrl fiUrl( mIgnoreGetFeatureInfoUrl ? mBaseUrl : getFeatureInfoUrl() );
setQueryItem( fiUrl, "SERVICE", "WMS" );
setQueryItem( fiUrl, "VERSION", mCapabilities.version );
setQueryItem( fiUrl, "REQUEST", "GetFeatureInfo" );
setQueryItem( fiUrl, "BBOX", bbox );
setQueryItem( fiUrl, crsKey, imageCrs );
setQueryItem( fiUrl, "WIDTH", QString::number( pixelWidth ) );
setQueryItem( fiUrl, "HEIGHT", QString::number( pixelHeight ) );
setQueryItem( fiUrl, "LAYERS", layers );
setQueryItem( fiUrl, "STYLES", styles );
setQueryItem( fiUrl, "FORMAT", imageMimeType );

if ( !imageMimeType.contains( "jpeg", Qt::CaseInsensitive ) && !imageMimeType.contains( "jpg", Qt::CaseInsensitive ) )
{
mGetFeatureInfoUrlBase += "&TRANSPARENT=true";
setQueryItem( fiUrl, "TRANSPARENT", "true" );
}

QgsDebugMsg( QString( "getmap: %1" ).arg( url ) );
mGetFeatureInfoUrlBase = fiUrl.toString();

QNetworkRequest request( url );
setAuthorization( request );
request.setAttribute( QNetworkRequest::CacheSaveControlAttribute, true );
Expand Down Expand Up @@ -610,7 +607,19 @@ QImage *QgsWmsProvider::draw( QgsRectangle const &viewExtent, int pixelWidth, i
#endif

// add WMS request
url += QString( "SERVICE=WMS&VERSION=%1&REQUEST=GetMap" ).arg( mCapabilities.version );
QUrl url( mIgnoreGetMapUrl ? mBaseUrl : getMapUrl() );
setQueryItem( url, "SERVICE", "WMS" );
setQueryItem( url, "VERSION", mCapabilities.version );
setQueryItem( url, "REQUEST", "GetMap" );

url.removeQueryItem( crsKey );
url.removeQueryItem( "WIDTH" );
url.removeQueryItem( "HEIGHT" );
url.removeQueryItem( "LAYERS" );
url.removeQueryItem( "STYLES" );
url.removeQueryItem( "FORMAT" );
url.removeQueryItem( "TILED" );


// compose static request arguments.
QString urlargs;
Expand All @@ -632,7 +641,7 @@ QImage *QgsWmsProvider::draw( QgsRectangle const &viewExtent, int pixelWidth, i
while ( x < xmax )
{
QString turl;
turl += url;
turl += url.toString();
turl += QString( changeXY ? "&BBOX=%2,%1,%4,%3" : "&BBOX=%1,%2,%3,%4" )
.arg( x, 0, 'f' )
.arg( y, 0, 'f' )
Expand Down Expand Up @@ -1176,44 +1185,47 @@ void QgsWmsProvider::parseService( QDomElement const & e, QgsWmsServiceProperty&
if ( !e1.isNull() )
{
// QgsDebugMsg( " " + e1.tagName() ); // the node really is an element.
QString tagName = e1.tagName();
if ( tagName.startsWith( "wms:" ) )
tagName = tagName.mid( 4 );

if ( e1.tagName() == "Title" )
if ( tagName == "Title" )
{
serviceProperty.title = e1.text();
}
else if ( e1.tagName() == "Abstract" )
else if ( tagName == "Abstract" )
{
serviceProperty.abstract = e1.text();
}
else if ( e1.tagName() == "KeywordList" )
else if ( tagName == "KeywordList" )
{
parseKeywordList( e1, serviceProperty.keywordList );
}
else if ( e1.tagName() == "OnlineResource" )
else if ( tagName == "OnlineResource" )
{
parseOnlineResource( e1, serviceProperty.onlineResource );
}
else if ( e1.tagName() == "ContactInformation" )
else if ( tagName == "ContactInformation" )
{
parseContactInformation( e1, serviceProperty.contactInformation );
}
else if ( e1.tagName() == "Fees" )
else if ( tagName == "Fees" )
{
serviceProperty.fees = e1.text();
}
else if ( e1.tagName() == "AccessConstraints" )
else if ( tagName == "AccessConstraints" )
{
serviceProperty.accessConstraints = e1.text();
}
else if ( e1.tagName() == "LayerLimit" )
else if ( tagName == "LayerLimit" )
{
serviceProperty.layerLimit = e1.text().toUInt();
}
else if ( e1.tagName() == "MaxWidth" )
else if ( tagName == "MaxWidth" )
{
serviceProperty.maxWidth = e1.text().toUInt();
}
else if ( e1.tagName() == "MaxHeight" )
else if ( tagName == "MaxHeight" )
{
serviceProperty.maxHeight = e1.text().toUInt();
}
Expand All @@ -1235,23 +1247,32 @@ void QgsWmsProvider::parseCapability( QDomElement const & e, QgsWmsCapabilityPro
QDomElement e1 = n1.toElement(); // try to convert the node to an element.
if ( !e1.isNull() )
{
QString tagName = e1.tagName();
if ( tagName.startsWith( "wms:" ) )
tagName = tagName.mid( 4 );

QgsDebugMsg( " " + e1.tagName() ); // the node really is an element.

if ( e1.tagName() == "Request" )
if ( tagName == "Request" )
{
parseRequest( e1, capabilityProperty.request );
}
else if ( e1.tagName() == "Layer" )
else if ( tagName == "Layer" )
{
parseLayer( e1, capabilityProperty.layer );
}
else if ( e1.tagName() == "VendorSpecificCapabilities" )
else if ( tagName == "VendorSpecificCapabilities" )
{
for ( int i = 0; i < e1.childNodes().size(); i++ )
{
QDomNode n2 = e1.childNodes().item( i );
QDomElement e2 = n2.toElement();
if ( e2.tagName() == "TileSet" )

QString tagName = e2.tagName();
if ( tagName.startsWith( "wms:" ) )
tagName = tagName.mid( 4 );

if ( tagName == "TileSet" )
{
parseTileSetProfile( e2, capabilityProperty.tileSetProfiles );
}
Expand All @@ -1275,11 +1296,15 @@ void QgsWmsProvider::parseContactPersonPrimary( QDomElement const & e, QgsWmsCon
QDomElement e1 = n1.toElement(); // try to convert the node to an element.
if ( !e1.isNull() )
{
if ( e1.tagName() == "ContactPerson" )
QString tagName = e1.tagName();
if ( tagName.startsWith( "wms:" ) )
tagName = tagName.mid( 4 );

if ( tagName == "ContactPerson" )
{
contactPersonPrimaryProperty.contactPerson = e1.text();
}
else if ( e1.tagName() == "ContactOrganization" )
else if ( tagName == "ContactOrganization" )
{
contactPersonPrimaryProperty.contactOrganization = e1.text();
}
Expand All @@ -1301,27 +1326,31 @@ void QgsWmsProvider::parseContactAddress( QDomElement const & e, QgsWmsContactAd
QDomElement e1 = n1.toElement(); // try to convert the node to an element.
if ( !e1.isNull() )
{
if ( e1.tagName() == "AddressType" )
QString tagName = e1.tagName();
if ( tagName.startsWith( "wms:" ) )
tagName = tagName.mid( 4 );

if ( tagName == "AddressType" )
{
contactAddressProperty.addressType = e1.text();
}
else if ( e1.tagName() == "Address" )
else if ( tagName == "Address" )
{
contactAddressProperty.address = e1.text();
}
else if ( e1.tagName() == "City" )
else if ( tagName == "City" )
{
contactAddressProperty.city = e1.text();
}
else if ( e1.tagName() == "StateOrProvince" )
else if ( tagName == "StateOrProvince" )
{
contactAddressProperty.stateOrProvince = e1.text();
}
else if ( e1.tagName() == "PostCode" )
else if ( tagName == "PostCode" )
{
contactAddressProperty.postCode = e1.text();
}
else if ( e1.tagName() == "Country" )
else if ( tagName == "Country" )
{
contactAddressProperty.country = e1.text();
}
Expand All @@ -1343,27 +1372,31 @@ void QgsWmsProvider::parseContactInformation( QDomElement const & e, QgsWmsConta
QDomElement e1 = n1.toElement(); // try to convert the node to an element.
if ( !e1.isNull() )
{
if ( e1.tagName() == "ContactPersonPrimary" )
QString tagName = e1.tagName();
if ( tagName.startsWith( "wms:" ) )
tagName = tagName.mid( 4 );

if ( tagName == "ContactPersonPrimary" )
{
parseContactPersonPrimary( e1, contactInformationProperty.contactPersonPrimary );
}
else if ( e1.tagName() == "ContactPosition" )
else if ( tagName == "ContactPosition" )
{
contactInformationProperty.contactPosition = e1.text();
}
else if ( e1.tagName() == "ContactAddress" )
else if ( tagName == "ContactAddress" )
{
parseContactAddress( e1, contactInformationProperty.contactAddress );
}
else if ( e1.tagName() == "ContactVoiceTelephone" )
else if ( tagName == "ContactVoiceTelephone" )
{
contactInformationProperty.contactVoiceTelephone = e1.text();
}
else if ( e1.tagName() == "ContactFacsimileTelephone" )
else if ( tagName == "ContactFacsimileTelephone" )
{
contactInformationProperty.contactFacsimileTelephone = e1.text();
}
else if ( e1.tagName() == "ContactElectronicMailAddress" )
else if ( tagName == "ContactElectronicMailAddress" )
{
contactInformationProperty.contactElectronicMailAddress = e1.text();
}
Expand Down Expand Up @@ -1395,7 +1428,11 @@ void QgsWmsProvider::parseKeywordList( QDomElement const & e, QStringList& keyw
QDomElement e1 = n1.toElement(); // try to convert the node to an element.
if ( !e1.isNull() )
{
if ( e1.tagName() == "Keyword" )
QString tagName = e1.tagName();
if ( tagName.startsWith( "wms:" ) )
tagName = tagName.mid( 4 );

if ( tagName == "Keyword" )
{
QgsDebugMsg( " Keyword." );
keywordListProperty += e1.text();
Expand All @@ -1418,7 +1455,11 @@ void QgsWmsProvider::parseGet( QDomElement const & e, QgsWmsGetProperty& getProp
QDomElement e1 = n1.toElement(); // try to convert the node to an element.
if ( !e1.isNull() )
{
if ( e1.tagName() == "OnlineResource" )
QString tagName = e1.tagName();
if ( tagName.startsWith( "wms:" ) )
tagName = tagName.mid( 4 );

if ( tagName == "OnlineResource" )
{
QgsDebugMsg( " OnlineResource." );
parseOnlineResource( e1, getProperty.onlineResource );
Expand All @@ -1441,7 +1482,11 @@ void QgsWmsProvider::parsePost( QDomElement const & e, QgsWmsPostProperty& postP
QDomElement e1 = n1.toElement(); // try to convert the node to an element.
if ( !e1.isNull() )
{
if ( e1.tagName() == "OnlineResource" )
QString tagName = e1.tagName();
if ( tagName.startsWith( "wms:" ) )
tagName = tagName.mid( 4 );

if ( tagName == "OnlineResource" )
{
QgsDebugMsg( " OnlineResource." );
parseOnlineResource( e1, postProperty.onlineResource );
Expand Down Expand Up @@ -1515,12 +1560,16 @@ void QgsWmsProvider::parseOperationType( QDomElement const & e, QgsWmsOperationT
QDomElement e1 = n1.toElement(); // try to convert the node to an element.
if ( !e1.isNull() )
{
if ( e1.tagName() == "Format" )
QString tagName = e1.tagName();
if ( tagName.startsWith( "wms:" ) )
tagName = tagName.mid( 4 );

if ( tagName == "Format" )
{
QgsDebugMsg( " Format." );
operationType.format += e1.text();
}
else if ( e1.tagName() == "DCPType" )
else if ( tagName == "DCPType" )
{
QgsDebugMsg( " DCPType." );
QgsWmsDcpTypeProperty dcp;
Expand Down Expand Up @@ -1576,11 +1625,15 @@ void QgsWmsProvider::parseLegendUrl( QDomElement const & e, QgsWmsLegendUrlPrope
QDomElement e1 = n1.toElement(); // try to convert the node to an element.
if ( !e1.isNull() )
{
if ( e1.tagName() == "Format" )
QString tagName = e1.tagName();
if ( tagName.startsWith( "wms:" ) )
tagName = tagName.mid( 4 );

if ( tagName == "Format" )
{
legendUrlProperty.format = e1.text();
}
else if ( e1.tagName() == "OnlineResource" )
else if ( tagName == "OnlineResource" )
{
parseOnlineResource( e1, legendUrlProperty.onlineResource );
}
Expand All @@ -1602,27 +1655,31 @@ void QgsWmsProvider::parseStyle( QDomElement const & e, QgsWmsStyleProperty& sty
QDomElement e1 = n1.toElement(); // try to convert the node to an element.
if ( !e1.isNull() )
{
if ( e1.tagName() == "Name" )
QString tagName = e1.tagName();
if ( tagName.startsWith( "wms:" ) )
tagName = tagName.mid( 4 );

if ( tagName == "Name" )
{
styleProperty.name = e1.text();
}
else if ( e1.tagName() == "Title" )
else if ( tagName == "Title" )
{
styleProperty.title = e1.text();
}
else if ( e1.tagName() == "Abstract" )
else if ( tagName == "Abstract" )
{
styleProperty.abstract = e1.text();
}
else if ( e1.tagName() == "LegendURL" )
else if ( tagName == "LegendURL" )
{
// TODO
}
else if ( e1.tagName() == "StyleSheetURL" )
else if ( tagName == "StyleSheetURL" )
{
// TODO
}
else if ( e1.tagName() == "StyleURL" )
else if ( tagName == "StyleURL" )
{
// TODO
}
Expand Down Expand Up @@ -1661,7 +1718,11 @@ void QgsWmsProvider::parseLayer( QDomElement const & e, QgsWmsLayerProperty& lay
{
QgsDebugMsg( " " + e1.tagName() ); // the node really is an element.

if ( e1.tagName() == "Layer" )
QString tagName = e1.tagName();
if ( tagName.startsWith( "wms:" ) )
tagName = tagName.mid( 4 );

if ( tagName == "Layer" )
{
QgsDebugMsg( " Nested layer." );

Expand All @@ -1679,23 +1740,23 @@ void QgsWmsProvider::parseLayer( QDomElement const & e, QgsWmsLayerProperty& lay

layerProperty.layer.push_back( subLayerProperty );
}
else if ( e1.tagName() == "Name" )
else if ( tagName == "Name" )
{
layerProperty.name = e1.text();
}
else if ( e1.tagName() == "Title" )
else if ( tagName == "Title" )
{
layerProperty.title = e1.text();
}
else if ( e1.tagName() == "Abstract" )
else if ( tagName == "Abstract" )
{
layerProperty.abstract = e1.text();
}
else if ( e1.tagName() == "KeywordList" )
else if ( tagName == "KeywordList" )
{
parseKeywordList( e1, layerProperty.keywordList );
}
else if ( e1.tagName() == "SRS" || e1.tagName() == "CRS" )
else if ( tagName == "SRS" || tagName == "CRS" )
{
// CRS can contain several definitions separated by whitespace
// though this was deprecated in WMS 1.1.1
Expand All @@ -1704,7 +1765,7 @@ void QgsWmsProvider::parseLayer( QDomElement const & e, QgsWmsLayerProperty& lay
layerProperty.crs.push_back( srs );
}
}
else if ( e1.tagName() == "LatLonBoundingBox" ) // legacy from earlier versions of WMS
else if ( tagName == "LatLonBoundingBox" ) // legacy from earlier versions of WMS
{
layerProperty.ex_GeographicBoundingBox = QgsRectangle(
e1.attribute( "minx" ).toDouble(),
Expand All @@ -1713,12 +1774,25 @@ void QgsWmsProvider::parseLayer( QDomElement const & e, QgsWmsLayerProperty& lay
e1.attribute( "maxy" ).toDouble()
);
}
else if ( e1.tagName() == "EX_GeographicBoundingBox" ) //for WMS 1.3
else if ( tagName == "EX_GeographicBoundingBox" ) //for WMS 1.3
{
QDomElement wBoundLongitudeElem = n1.namedItem( "westBoundLongitude" ).toElement();
QDomElement eBoundLongitudeElem = n1.namedItem( "eastBoundLongitude" ).toElement();
QDomElement sBoundLatitudeElem = n1.namedItem( "southBoundLatitude" ).toElement();
QDomElement nBoundLatitudeElem = n1.namedItem( "northBoundLatitude" ).toElement();
QDomElement wBoundLongitudeElem, eBoundLongitudeElem, sBoundLatitudeElem, nBoundLatitudeElem;

if ( e1.tagName() == "wms:EX_GeographicBoundingBox" )
{
wBoundLongitudeElem = n1.namedItem( "wms:westBoundLongitude" ).toElement();
eBoundLongitudeElem = n1.namedItem( "wms:eastBoundLongitude" ).toElement();
sBoundLatitudeElem = n1.namedItem( "wms:southBoundLatitude" ).toElement();
nBoundLatitudeElem = n1.namedItem( "wms:northBoundLatitude" ).toElement();
}
else
{
wBoundLongitudeElem = n1.namedItem( "westBoundLongitude" ).toElement();
eBoundLongitudeElem = n1.namedItem( "eastBoundLongitude" ).toElement();
sBoundLatitudeElem = n1.namedItem( "southBoundLatitude" ).toElement();
nBoundLatitudeElem = n1.namedItem( "northBoundLatitude" ).toElement();
}

double wBLong, eBLong, sBLat, nBLat;
bool wBOk, eBOk, sBOk, nBOk;
wBLong = wBoundLongitudeElem.text().toDouble( &wBOk );
Expand All @@ -1730,7 +1804,7 @@ void QgsWmsProvider::parseLayer( QDomElement const & e, QgsWmsLayerProperty& lay
layerProperty.ex_GeographicBoundingBox = QgsRectangle( wBLong, sBLat, eBLong, nBLat );
}
}
else if ( e1.tagName() == "BoundingBox" )
else if ( tagName == "BoundingBox" )
{
// TODO: overwrite inherited
QgsWmsBoundingBoxProperty bbox;
Expand All @@ -1742,47 +1816,47 @@ void QgsWmsProvider::parseLayer( QDomElement const & e, QgsWmsLayerProperty& lay
bbox.crs = e1.attribute( "CRS" );
layerProperty.boundingBox.push_back( bbox );
}
else if ( e1.tagName() == "Dimension" )
else if ( tagName == "Dimension" )
{
// TODO
}
else if ( e1.tagName() == "Attribution" )
else if ( tagName == "Attribution" )
{
// TODO
}
else if ( e1.tagName() == "AuthorityURL" )
else if ( tagName == "AuthorityURL" )
{
// TODO
}
else if ( e1.tagName() == "Identifier" )
else if ( tagName == "Identifier" )
{
// TODO
}
else if ( e1.tagName() == "MetadataURL" )
else if ( tagName == "MetadataURL" )
{
// TODO
}
else if ( e1.tagName() == "DataURL" )
else if ( tagName == "DataURL" )
{
// TODO
}
else if ( e1.tagName() == "FeatureListURL" )
else if ( tagName == "FeatureListURL" )
{
// TODO
}
else if ( e1.tagName() == "Style" )
else if ( tagName == "Style" )
{
QgsWmsStyleProperty styleProperty;

parseStyle( e1, styleProperty );

layerProperty.style.push_back( styleProperty );
}
else if ( e1.tagName() == "MinScaleDenominator" )
else if ( tagName == "MinScaleDenominator" )
{
// TODO
}
else if ( e1.tagName() == "MaxScaleDenominator" )
else if ( tagName == "MaxScaleDenominator" )
{
// TODO
}
Expand Down Expand Up @@ -1867,31 +1941,35 @@ void QgsWmsProvider::parseTileSetProfile( QDomElement const &e, QVector<QgsWmsTi
{
QgsDebugMsg( " " + e1.tagName() ); // the node really is an element.

if ( e1.tagName() == "Layers" )
QString tagName = e1.tagName();
if ( tagName.startsWith( "wms:" ) )
tagName = tagName.mid( 4 );

if ( tagName == "Layers" )
{
tsp.layers << e1.text();
}
else if ( e1.tagName() == "Styles" )
else if ( tagName == "Styles" )
{
tsp.styles << e1.text();
}
else if ( e1.tagName() == "Width" )
else if ( tagName == "Width" )
{
tsp.tileWidth = e1.text().toInt();
}
else if ( e1.tagName() == "Height" )
else if ( tagName == "Height" )
{
tsp.tileHeight = e1.text().toInt();
}
else if ( e1.tagName() == "SRS" )
else if ( tagName == "SRS" )
{
tsp.crs = e1.text();
}
else if ( e1.tagName() == "Format" )
else if ( tagName == "Format" )
{
tsp.format = e1.text();
}
else if ( e1.tagName() == "BoundingBox" )
else if ( tagName == "BoundingBox" )
{
tsp.boundingBox.box = QgsRectangle(
e1.attribute( "minx" ).toDouble(),
Expand All @@ -1909,7 +1987,7 @@ void QgsWmsProvider::parseTileSetProfile( QDomElement const &e, QVector<QgsWmsTi
tsp.boundingBox.crs = e1.attribute( "crs" );

}
else if ( e1.tagName() == "Resolutions" )
else if ( tagName == "Resolutions" )
{
tsp.resolutions = e1.text().trimmed().split( " ", QString::SkipEmptyParts );
}
Expand Down Expand Up @@ -1984,7 +2062,11 @@ bool QgsWmsProvider::parseServiceExceptionReportDom( QByteArray const & xml )
{
//QgsDebugMsg(e.tagName() ); // the node really is an element.

if ( e.tagName() == "ServiceException" )
QString tagName = e.tagName();
if ( tagName.startsWith( "wms:" ) )
tagName = tagName.mid( 4 );

if ( tagName == "ServiceException" )
{
QgsDebugMsg( " ServiceException." );
parseServiceException( e );
Expand Down
3 changes: 3 additions & 0 deletions src/providers/wms/qgswmsprovider.h
Original file line number Diff line number Diff line change
Expand Up @@ -763,6 +763,9 @@ class QgsWmsProvider : public QgsRasterDataProvider

QString layerMetadata( QgsWmsLayerProperty &layer );

//! remove query item and replace it with a new value
void setQueryItem( QUrl &url, QString key, QString value );

//! set authorization header
void setAuthorization( QNetworkRequest &request ) const;

Expand Down