Skip to content
Permalink
Browse files
For the calculation of the extent of WMS layers: ignore layers where …
…the bounding boxes cannot be transformed into the requested coordinate system

git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@5537 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent committed Jun 21, 2006
1 parent 2348cb3 commit 6eeaa51529838533873cd5a56eb41cabd565d9f1
Showing with 12 additions and 6 deletions.
  1. +12 −6 src/providers/wms/qgswmsprovider.cpp
@@ -1916,6 +1916,7 @@ bool QgsWmsProvider::calculateExtent()
mCoordinateTransform = new QgsCoordinateTransform(qgisSrsSource, qgisSrsDest);
}

bool firstLayer = true; //flag to know if a layer is the first to be successfully transformed
for ( QStringList::Iterator it = activeSubLayers.begin();
it != activeSubLayers.end();
++it )
@@ -1925,21 +1926,26 @@ bool QgsWmsProvider::calculateExtent()
QgsRect extent = extentForLayer.find( *it )->second;

// Convert to the user's CRS as required
extent =
mCoordinateTransform->transformBoundingBox(
extent,
QgsCoordinateTransform::FORWARD
);
try
{
extent = mCoordinateTransform->transformBoundingBox(extent, QgsCoordinateTransform::FORWARD);
}
catch(QgsCsException &cse)
{
continue; //ignore extents of layers which cannot be transformed info the required CRS
}

// add to the combined extent of all the active sublayers
if ( it == activeSubLayers.begin() )
if (firstLayer)
{
layerExtent = extent;
}
else
{
layerExtent.combineExtentWith( &extent );
}

firstLayer = false;

#ifdef QGISDEBUG
std::cout << "QgsWmsProvider::calculateExtent: combined extent is '" <<

0 comments on commit 6eeaa51

Please sign in to comment.