Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
use unique_ptr and log message when transform fails
  • Loading branch information
3nids committed Jun 8, 2018
1 parent 59202ac commit 932bcfd
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/app/vertextool/qgsvertexeditor.cpp
Expand Up @@ -18,6 +18,7 @@

#include "qgsvertexeditor.h"
#include "qgsmapcanvas.h"
#include "qgsmessagelog.h"
#include "qgsselectedfeature.h"
#include "qgsvertexentry.h"
#include "qgsvectorlayer.h"
Expand Down Expand Up @@ -362,7 +363,7 @@ void QgsVertexEditor::updateVertexSelection( const QItemSelection &selected, con
mSelectedFeature->deselectAllVertices();

QgsCoordinateTransform t( mLayer->crs(), mCanvas->mapSettings().destinationCrs(), QgsProject::instance() );
QgsRectangle *bbox = nullptr;
std::unique_ptr<QgsRectangle> bbox;
QModelIndexList indexList = selected.indexes();
for ( int i = 0; i < indexList.length(); ++i )
{
Expand All @@ -372,7 +373,7 @@ void QgsVertexEditor::updateVertexSelection( const QItemSelection &selected, con
// create a bounding box of selected vertices
QgsPointXY point( mSelectedFeature->vertexMap().at( vertexIdx )->point() );
if ( !bbox )
bbox = new QgsRectangle( point, point );
bbox.reset( new QgsRectangle( point, point ) );
else
bbox->combineExtentWith( point );
}
Expand All @@ -387,10 +388,10 @@ void QgsVertexEditor::updateVertexSelection( const QItemSelection &selected, con
transformedBbox.combineExtentWith( canvasExtent );
mCanvas->setExtent( transformedBbox );
}
catch ( QgsCsException & )
catch ( QgsCsException &cse )
{
QgsMessageLog::logMessage( QObject::tr( "Simplify transform error caught: %1" ).arg( cse.what() ), QObject::tr( "CRS" ) );
}
delete bbox;
}

mUpdatingVertexSelection = false;
Expand Down

0 comments on commit 932bcfd

Please sign in to comment.