Skip to content

Commit fad52d6

Browse files
author
mhugent
committed
Support for WMS1.3 EX_GeographicBoundingBox. In 1.3, there are the subelements 'westBoundLongitude', 'eastBoundLongitude', 'southBoundLatitude' and 'northBoundLatitude' instead of the attributes minx, miny, maxx, maxy
git-svn-id: http://svn.osgeo.org/qgis/trunk@5481 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent cb77412 commit fad52d6

File tree

2 files changed

+24
-11
lines changed

2 files changed

+24
-11
lines changed

src/providers/wms/qgshttptransaction.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -117,24 +117,23 @@ bool QgsHttpTransaction::getSynchronously(QByteArray &respondedContent, int redi
117117
QString pathAndQuery = httpurl.remove(0,
118118
httpurl.indexOf(qurl.path()));
119119
httpid = http->get( pathAndQuery );
120-
121120
connect(http, SIGNAL( requestStarted ( int ) ),
122121
this, SLOT( dataStarted ( int ) ) );
123122

124123
connect(http, SIGNAL( responseHeaderReceived( const QHttpResponseHeader& ) ),
125124
this, SLOT( dataHeaderReceived( const QHttpResponseHeader& ) ) );
126125

127126
connect(http, SIGNAL( readyRead( const QHttpResponseHeader& ) ),
128-
this, SLOT( dataReceived( const QHttpResponseHeader& ) ) );
127+
this, SLOT( dataReceived( const QHttpResponseHeader& ) ) );
129128

130129
connect(http, SIGNAL( dataReadProgress ( int, int ) ),
131-
this, SLOT( dataProgress ( int, int ) ) );
130+
this, SLOT( dataProgress ( int, int ) ) );
132131

133132
connect(http, SIGNAL( requestFinished ( int, bool ) ),
134133
this, SLOT( dataFinished ( int, bool ) ) );
135134

136135
connect(http, SIGNAL( stateChanged ( int ) ),
137-
this, SLOT( dataStateChanged ( int ) ) );
136+
this, SLOT( dataStateChanged ( int ) ) );
138137

139138
// Set up the watchdog timer
140139
connect(mWatchdogTimer, SIGNAL( timeout () ),
@@ -157,7 +156,6 @@ bool QgsHttpTransaction::getSynchronously(QByteArray &respondedContent, int redi
157156
{
158157
// Do something else, maybe even network processing events
159158
qApp->processEvents();
160-
161159
// TODO: Implement a network timeout
162160
}
163161

@@ -284,7 +282,7 @@ void QgsHttpTransaction::dataProgress( int done, int total )
284282
{
285283

286284
#ifdef QGISDEBUG
287-
// std::cout << "QgsHttpTransaction::dataProgress: got " << done << " of " << total << std::endl;
285+
std::cout << "QgsHttpTransaction::dataProgress: got " << done << " of " << total << std::endl;
288286
#endif
289287

290288
// We saw something come back, therefore restart the watchdog timer

src/providers/wms/qgswmsprovider.cpp

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
/* $Id$ */
2020

21+
#include "qgslogger.h"
2122
#include "qgswmsprovider.h"
2223

2324
#include <fstream>
@@ -1527,10 +1528,7 @@ void QgsWmsProvider::parseLayer(QDomElement const & e, QgsWmsLayerProperty& laye
15271528
layerProperty.crs.push_back(*i);
15281529
}
15291530
}
1530-
else if (
1531-
(e1.tagName() == "EX_GeographicBoundingBox") ||
1532-
(e1.tagName() == "LatLonBoundingBox") // legacy from earlier versions of WMS
1533-
)
1531+
else if (e1.tagName() == "LatLonBoundingBox") // legacy from earlier versions of WMS
15341532
{
15351533

15361534
// std::cout << " LLBB is: '" << e1.attribute("minx") << "'." << std::endl;
@@ -1545,6 +1543,23 @@ void QgsWmsProvider::parseLayer(QDomElement const & e, QgsWmsLayerProperty& laye
15451543
e1.attribute("maxy").toDouble()
15461544
);
15471545
}
1546+
else if(e1.tagName() == "EX_GeographicBoundingBox") //for WMS 1.3
1547+
{
1548+
QDomElement wBoundLongitudeElem = n1.namedItem("westBoundLongitude").toElement();
1549+
QDomElement eBoundLongitudeElem = n1.namedItem("eastBoundLongitude").toElement();
1550+
QDomElement sBoundLatitudeElem = n1.namedItem("southBoundLatitude").toElement();
1551+
QDomElement nBoundLatitudeElem = n1.namedItem("northBoundLatitude").toElement();
1552+
double wBLong, eBLong, sBLat, nBLat;
1553+
bool wBOk, eBOk, sBOk, nBOk;
1554+
wBLong = wBoundLongitudeElem.text().toDouble(&wBOk);
1555+
eBLong = eBoundLongitudeElem.text().toDouble(&eBOk);
1556+
sBLat = sBoundLatitudeElem.text().toDouble(&sBOk);
1557+
nBLat = nBoundLatitudeElem.text().toDouble(&nBOk);
1558+
if(wBOk && eBOk && sBOk && nBOk)
1559+
{
1560+
layerProperty.ex_GeographicBoundingBox = QgsRect(wBLong, sBLat, eBLong, nBLat);
1561+
}
1562+
}
15481563
else if (e1.tagName() == "BoundingBox")
15491564
{
15501565
// TODO: overwrite inherited
@@ -1905,7 +1920,7 @@ bool QgsWmsProvider::calculateExtent()
19051920
it != activeSubLayers.end();
19061921
++it )
19071922
{
1908-
1923+
QgsDebugMsg("Sublayer Iterator: "+*it);
19091924
// This is the extent for the layer name in *it
19101925
QgsRect extent = extentForLayer.find( *it )->second;
19111926

0 commit comments

Comments
 (0)