Skip to content

Commit

Permalink
For the calculation of the extent of WMS layers: ignore layers where …
Browse files Browse the repository at this point in the history
…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 6eeaa51
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions src/providers/wms/qgswmsprovider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 )
Expand All @@ -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 '" <<
Expand Down

0 comments on commit 6eeaa51

Please sign in to comment.