Skip to content
Permalink
Browse files

Fix some uncaught transform exceptions

  • Loading branch information
nyalldawson committed Feb 18, 2015
1 parent 05c07f2 commit e952fe84374b593d6b88d576d4bafa51aeacca69
Showing with 26 additions and 3 deletions.
  1. +8 −1 src/core/qgsmaprenderer.cpp
  2. +8 −1 src/gui/qgsmapcanvas.cpp
  3. +10 −1 src/server/qgswcsprojectparser.cpp
@@ -684,7 +684,14 @@ void QgsMapRenderer::setDestinationCrs( const QgsCoordinateReferenceSystem& crs,
if ( transformExtent && !mExtent.isEmpty() )
{
QgsCoordinateTransform transform( *mDestCRS, crs );
rect = transform.transformBoundingBox( mExtent );
try
{
rect = transform.transformBoundingBox( mExtent );
}
catch ( QgsCsException &e )
{
QgsDebugMsg( QString( "Transform error caught: %1" ).arg( e.what() ) );
}
}

QgsDebugMsg( "Setting DistArea CRS to " + QString::number( crs.srsid() ) );
@@ -518,7 +518,14 @@ void QgsMapCanvas::setDestinationCrs( const QgsCoordinateReferenceSystem &crs )
if ( !mSettings.visibleExtent().isEmpty() )
{
QgsCoordinateTransform transform( mSettings.destinationCrs(), crs );
rect = transform.transformBoundingBox( mSettings.visibleExtent() );
try
{
rect = transform.transformBoundingBox( mSettings.visibleExtent() );
}
catch ( QgsCsException &e )
{
QgsDebugMsg( QString( "Transform error caught: %1" ).arg( e.what() ) );
}
}
if ( !rect.isEmpty() )
{
@@ -119,7 +119,16 @@ void QgsWCSProjectParser::wcsContentMetadata( QDomElement& parentElement, QDomDo
const QgsCoordinateReferenceSystem& layerCrs = layer->crs();
QgsCoordinateTransform t( layerCrs, QgsCoordinateReferenceSystem( 4326 ) );
//transform
QgsRectangle BBox = t.transformBoundingBox( layer->extent() );
QgsRectangle BBox;
try
{
BBox = t.transformBoundingBox( layer->extent() );
}
catch ( QgsCsException &e )
{
QgsDebugMsg( QString( "Transform error caught: %1. Using original layer extent." ).arg( e.what() ) );
BBox = layer->extent();
}
QDomElement lonLatElem = doc.createElement( "lonLatEnvelope" );
lonLatElem.setAttribute( "srsName", "urn:ogc:def:crs:OGC:1.3:CRS84" );
QDomElement lowerPosElem = doc.createElement( "gml:pos" );

0 comments on commit e952fe8

Please sign in to comment.
You can’t perform that action at this time.