Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Destroy active undo command if the vertex can't be deleted
git-svn-id: http://svn.osgeo.org/qgis/trunk@11145 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
wonder committed Jul 22, 2009
1 parent 7ecd98b commit 37d01af
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/app/qgsmaptooldeletevertex.cpp
Expand Up @@ -76,15 +76,24 @@ void QgsMapToolDeleteVertex::canvasReleaseEvent( QMouseEvent * e )
vlayer = dynamic_cast<QgsVectorLayer*>( currentLayer );
}

bool success = true;
if ( vlayer && mRecentSnappingResults.size() > 0 )
{
QList<QgsSnappingResult>::iterator sr_it = mRecentSnappingResults.begin();
vlayer->beginEditCommand( tr( "Vertex deleted" ) );
for ( ; sr_it != mRecentSnappingResults.end(); ++sr_it )
{
vlayer->deleteVertex( sr_it->snappedAtGeometry, sr_it->snappedVertexNr );
if (!vlayer->deleteVertex( sr_it->snappedAtGeometry, sr_it->snappedVertexNr ))
{
success = false;
vlayer->destroyEditCommand();
break;
}
}
if (success)
{
vlayer->endEditCommand();
}
vlayer->endEditCommand();
}

mCanvas->refresh();
Expand Down

0 comments on commit 37d01af

Please sign in to comment.