Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
use SRS
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@4801 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
rblazek committed Feb 6, 2006
1 parent 00769e0 commit 04d3255
Showing 1 changed file with 37 additions and 8 deletions.
45 changes: 37 additions & 8 deletions src/providers/wms/qgswmsprovider.cpp
Expand Up @@ -245,11 +245,12 @@ QImage* QgsWmsProvider::draw(QgsRect const & viewExtent, int pixelWidth, int pi

// Bounding box in WMS format
QString bbox;
// Warning: does not work with scientific notation
bbox = QString("%1,%2,%3,%4").
arg(viewExtent.xMin()).
arg(viewExtent.yMin()).
arg(viewExtent.xMax()).
arg(viewExtent.yMax());
arg(viewExtent.xMin(),0,'f').
arg(viewExtent.yMin(),0,'f').
arg(viewExtent.xMax(),0,'f').
arg(viewExtent.yMax(),0,'f');

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

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

drawuri += "Service=WMS";
drawuri += "?Service=WMS";
drawuri += "&";
drawuri += "Version=1.1.0";
drawuri += "&";
drawuri += "Request=GetMap";
drawuri += "&";
drawuri += "BBox=" + bbox;
drawuri += "&";
drawuri += "SRS=EPSG:4326";
//drawuri += "&";
//drawuri += "SRS=EPSG:4326";
// TODO: for now use the first SRS of the first layer
if ( layersSupported.size() > 0 &&
layersSupported[0].crs.size() )
{
std::set<QString>::iterator it = layersSupported[0].crs.begin();
drawuri += "&";
drawuri += "SRS=" + *it;
}
drawuri += "&";
drawuri += "Width=" + width;
drawuri += "&";
Expand All @@ -353,6 +362,8 @@ QImage* QgsWmsProvider::draw(QgsRect const & viewExtent, int pixelWidth, int pi
drawuri += "Styles=" + styles;
drawuri += "&";
drawuri += "Format=" + imageMimeType;
drawuri += "&";
drawuri += "Transparent=true";

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

Expand Down Expand Up @@ -1188,6 +1199,14 @@ void QgsWmsProvider::parseLayer(QDomElement const & e, QgsWmsLayerProperty& laye
else if (e1.tagName() == "BoundingBox")
{
// TODO
QgsWmsBoundingBoxProperty bbox;
bbox.box = QgsRect ( e1.attribute("minx").toDouble(),
e1.attribute("miny").toDouble(),
e1.attribute("maxx").toDouble(),
e1.attribute("maxy").toDouble()
);
bbox.crs = e1.attribute("SRS");
layerProperty.boundingBox.push_back ( bbox );
}
else if (e1.tagName() == "Dimension")
{
Expand Down Expand Up @@ -1254,7 +1273,17 @@ void QgsWmsProvider::parseLayer(QDomElement const & e, QgsWmsLayerProperty& laye

// Store the extent so that it can be combined with others later
// in calculateExtent()
extentForLayer[ layerProperty.name ] = layerProperty.ex_GeographicBoundingBox;
// For now use extent in the first SRS defined for the layer
//extentForLayer[ layerProperty.name ] = layerProperty.ex_GeographicBoundingBox;
if ( layerProperty.crs.size() > 0 )
{
// TODO: find the correct bounding box
if ( layerProperty.boundingBox.size() > 0 )
{
extentForLayer[ layerProperty.name ] =
layerProperty.boundingBox[0].box;
}
}

// Insert into the local class' registry
layersSupported.push_back(layerProperty);
Expand Down

0 comments on commit 04d3255

Please sign in to comment.