Skip to content

Commit fbf546b

Browse files
author
rblazek
committedFeb 6, 2006
use SRS
git-svn-id: http://svn.osgeo.org/qgis/trunk@4801 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 75000df commit fbf546b

File tree

1 file changed

+37
-8
lines changed

1 file changed

+37
-8
lines changed
 

‎src/providers/wms/qgswmsprovider.cpp

Lines changed: 37 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -245,11 +245,12 @@ QImage* QgsWmsProvider::draw(QgsRect const & viewExtent, int pixelWidth, int pi
245245

246246
// Bounding box in WMS format
247247
QString bbox;
248+
// Warning: does not work with scientific notation
248249
bbox = QString("%1,%2,%3,%4").
249-
arg(viewExtent.xMin()).
250-
arg(viewExtent.yMin()).
251-
arg(viewExtent.xMax()).
252-
arg(viewExtent.yMax());
250+
arg(viewExtent.xMin(),0,'f').
251+
arg(viewExtent.yMin(),0,'f').
252+
arg(viewExtent.xMax(),0,'f').
253+
arg(viewExtent.yMax(),0,'f');
253254

254255
// Width in WMS format
255256
QString width;
@@ -334,15 +335,23 @@ QImage* QgsWmsProvider::draw(QgsRect const & viewExtent, int pixelWidth, int pi
334335

335336
// compose the URL query string for the WMS server.
336337

337-
drawuri += "Service=WMS";
338+
drawuri += "?Service=WMS";
338339
drawuri += "&";
339340
drawuri += "Version=1.1.0";
340341
drawuri += "&";
341342
drawuri += "Request=GetMap";
342343
drawuri += "&";
343344
drawuri += "BBox=" + bbox;
344-
drawuri += "&";
345-
drawuri += "SRS=EPSG:4326";
345+
//drawuri += "&";
346+
//drawuri += "SRS=EPSG:4326";
347+
// TODO: for now use the first SRS of the first layer
348+
if ( layersSupported.size() > 0 &&
349+
layersSupported[0].crs.size() )
350+
{
351+
std::set<QString>::iterator it = layersSupported[0].crs.begin();
352+
drawuri += "&";
353+
drawuri += "SRS=" + *it;
354+
}
346355
drawuri += "&";
347356
drawuri += "Width=" + width;
348357
drawuri += "&";
@@ -353,6 +362,8 @@ QImage* QgsWmsProvider::draw(QgsRect const & viewExtent, int pixelWidth, int pi
353362
drawuri += "Styles=" + styles;
354363
drawuri += "&";
355364
drawuri += "Format=" + imageMimeType;
365+
drawuri += "&";
366+
drawuri += "Transparent=true";
356367

357368
emit setStatus( QString("Test from QgsWmsProvider") );
358369

@@ -1188,6 +1199,14 @@ void QgsWmsProvider::parseLayer(QDomElement const & e, QgsWmsLayerProperty& laye
11881199
else if (e1.tagName() == "BoundingBox")
11891200
{
11901201
// TODO
1202+
QgsWmsBoundingBoxProperty bbox;
1203+
bbox.box = QgsRect ( e1.attribute("minx").toDouble(),
1204+
e1.attribute("miny").toDouble(),
1205+
e1.attribute("maxx").toDouble(),
1206+
e1.attribute("maxy").toDouble()
1207+
);
1208+
bbox.crs = e1.attribute("SRS");
1209+
layerProperty.boundingBox.push_back ( bbox );
11911210
}
11921211
else if (e1.tagName() == "Dimension")
11931212
{
@@ -1254,7 +1273,17 @@ void QgsWmsProvider::parseLayer(QDomElement const & e, QgsWmsLayerProperty& laye
12541273

12551274
// Store the extent so that it can be combined with others later
12561275
// in calculateExtent()
1257-
extentForLayer[ layerProperty.name ] = layerProperty.ex_GeographicBoundingBox;
1276+
// For now use extent in the first SRS defined for the layer
1277+
//extentForLayer[ layerProperty.name ] = layerProperty.ex_GeographicBoundingBox;
1278+
if ( layerProperty.crs.size() > 0 )
1279+
{
1280+
// TODO: find the correct bounding box
1281+
if ( layerProperty.boundingBox.size() > 0 )
1282+
{
1283+
extentForLayer[ layerProperty.name ] =
1284+
layerProperty.boundingBox[0].box;
1285+
}
1286+
}
12581287

12591288
// Insert into the local class' registry
12601289
layersSupported.push_back(layerProperty);

0 commit comments

Comments
 (0)
Please sign in to comment.