Skip to content

Commit

Permalink
Fix some uncaught transform exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Feb 18, 2015
1 parent 05c07f2 commit e952fe8
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 3 deletions.
9 changes: 8 additions & 1 deletion src/core/qgsmaprenderer.cpp
Expand Up @@ -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() ) );
Expand Down
9 changes: 8 additions & 1 deletion src/gui/qgsmapcanvas.cpp
Expand Up @@ -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() )
{
Expand Down
11 changes: 10 additions & 1 deletion src/server/qgswcsprojectparser.cpp
Expand Up @@ -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" );
Expand Down

0 comments on commit e952fe8

Please sign in to comment.