Skip to content

Commit

Permalink
fix #2281
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk@12455 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef committed Dec 14, 2009
1 parent 5795c35 commit e6a2741
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
7 changes: 5 additions & 2 deletions src/app/qgsmaptooladdisland.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,8 @@ void QgsMapToolAddIsland::canvasReleaseEvent( QMouseEvent * e )

//close polygon
mCaptureList.push_back( *mCaptureList.begin() );
vlayer->beginEditCommand( tr( "Island added" ) );
vlayer->beginEditCommand( tr( "Part added" ) );
int errorCode = vlayer->addIsland( mCaptureList );
vlayer->endEditCommand();
QString errorMessage;

if ( errorCode != 0 )
Expand Down Expand Up @@ -136,6 +135,8 @@ void QgsMapToolAddIsland::canvasReleaseEvent( QMouseEvent * e )
errorMessage = tr( "Selected geometry could not be found" );
}
QMessageBox::critical( 0, tr( "Error, could not add island" ), errorMessage );

vlayer->destroyEditCommand();
}
else
{
Expand All @@ -145,6 +146,8 @@ void QgsMapToolAddIsland::canvasReleaseEvent( QMouseEvent * e )
{
addTopologicalPoints( mCaptureList );
}

vlayer->endEditCommand();
}

mCaptureList.clear();
Expand Down
6 changes: 5 additions & 1 deletion src/app/qgsmaptooladdring.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ void QgsMapToolAddRing::canvasReleaseEvent( QMouseEvent * e )

vlayer->beginEditCommand( tr( "Ring added" ) );
int addRingReturnCode = vlayer->addRing( mCaptureList );
vlayer->endEditCommand();
if ( addRingReturnCode != 0 )
{
QString errorMessage;
Expand Down Expand Up @@ -113,6 +112,11 @@ void QgsMapToolAddRing::canvasReleaseEvent( QMouseEvent * e )
errorMessage = tr( "An unknown error occured" );
}
QMessageBox::critical( 0, tr( "Error, could not add ring" ), errorMessage );
vlayer->destroyEditCommand();
}
else
{
vlayer->endEditCommand();
}
mCaptureList.clear();
mCanvas->refresh();
Expand Down

0 comments on commit e6a2741

Please sign in to comment.