Skip to content
Permalink
Browse files

Catch some uncaught transform exceptions

  • Loading branch information
nyalldawson committed May 29, 2018
1 parent ff7c70f commit c013c23ecc850ad66a09a231991d8132ad882642
Showing with 33 additions and 4 deletions.
  1. +9 −1 src/app/vertextool/qgsvertexeditor.cpp
  2. +16 −2 src/core/qgsvectorlayerlabelprovider.cpp
  3. +8 −1 src/gui/qgsrubberband.cpp
@@ -373,7 +373,15 @@ void QgsVertexEditor::zoomToVertex( int idx )
QgsPointXY newCenter( x, y );

QgsCoordinateTransform t( mLayer->crs(), mCanvas->mapSettings().destinationCrs(), QgsProject::instance() );
QgsPointXY tCenter = t.transform( newCenter );
QgsPointXY tCenter;
try
{
tCenter = t.transform( newCenter );
}
catch ( QgsCsException & )
{
return;
}

QPolygonF ext = mCanvas->mapSettings().visiblePolygon();
//close polygon
@@ -285,7 +285,14 @@ QgsGeometry QgsVectorLayerLabelProvider::getPointObstacleGeometry( QgsFeature &f
//transform point to pixels
if ( context.coordinateTransform().isValid() )
{
context.coordinateTransform().transformInPlace( x, y, z );
try
{
context.coordinateTransform().transformInPlace( x, y, z );
}
catch ( QgsCsException & )
{
return QgsGeometry();
}
}
context.mapToPixel().transformInPlace( x, y );

@@ -318,7 +325,14 @@ QgsGeometry QgsVectorLayerLabelProvider::getPointObstacleGeometry( QgsFeature &f
}
if ( context.coordinateTransform().isValid() )
{
boundLineString->transform( context.coordinateTransform(), QgsCoordinateTransform::ReverseTransform );
try
{
boundLineString->transform( context.coordinateTransform(), QgsCoordinateTransform::ReverseTransform );
}
catch ( QgsCsException & )
{
return QgsGeometry();
}
}
boundLineString->close();

@@ -237,7 +237,14 @@ void QgsRubberBand::addGeometry( const QgsGeometry &geometry, QgsVectorLayer *la
if ( layer )
{
QgsCoordinateTransform ct = mMapCanvas->mapSettings().layerTransform( layer );
geom.transform( ct );
try
{
geom.transform( ct );
}
catch ( QgsCsException & )
{
return;
}
}

addGeometry( geom );

0 comments on commit c013c23

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