@@ -245,11 +245,12 @@ QImage* QgsWmsProvider::draw(QgsRect const & viewExtent, int pixelWidth, int pi
245
245
246
246
// Bounding box in WMS format
247
247
QString bbox;
248
+ // Warning: does not work with scientific notation
248
249
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 ' );
253
254
254
255
// Width in WMS format
255
256
QString width;
@@ -334,15 +335,23 @@ QImage* QgsWmsProvider::draw(QgsRect const & viewExtent, int pixelWidth, int pi
334
335
335
336
// compose the URL query string for the WMS server.
336
337
337
- drawuri += " Service=WMS" ;
338
+ drawuri += " ? Service=WMS" ;
338
339
drawuri += " &" ;
339
340
drawuri += " Version=1.1.0" ;
340
341
drawuri += " &" ;
341
342
drawuri += " Request=GetMap" ;
342
343
drawuri += " &" ;
343
344
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
+ }
346
355
drawuri += " &" ;
347
356
drawuri += " Width=" + width;
348
357
drawuri += " &" ;
@@ -353,6 +362,8 @@ QImage* QgsWmsProvider::draw(QgsRect const & viewExtent, int pixelWidth, int pi
353
362
drawuri += " Styles=" + styles;
354
363
drawuri += " &" ;
355
364
drawuri += " Format=" + imageMimeType;
365
+ drawuri += " &" ;
366
+ drawuri += " Transparent=true" ;
356
367
357
368
emit setStatus ( QString (" Test from QgsWmsProvider" ) );
358
369
@@ -1188,6 +1199,14 @@ void QgsWmsProvider::parseLayer(QDomElement const & e, QgsWmsLayerProperty& laye
1188
1199
else if (e1 .tagName () == " BoundingBox" )
1189
1200
{
1190
1201
// 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 );
1191
1210
}
1192
1211
else if (e1 .tagName () == " Dimension" )
1193
1212
{
@@ -1254,7 +1273,17 @@ void QgsWmsProvider::parseLayer(QDomElement const & e, QgsWmsLayerProperty& laye
1254
1273
1255
1274
// Store the extent so that it can be combined with others later
1256
1275
// 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
+ }
1258
1287
1259
1288
// Insert into the local class' registry
1260
1289
layersSupported.push_back (layerProperty);
0 commit comments