Skip to content

Commit

Permalink
Fix for bug #1426 Digitizer allows island creation with no poly selected
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@9705 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent committed Nov 25, 2008
1 parent 620d8d6 commit a9ca23c
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/app/qgsmaptooladdisland.cpp
Expand Up @@ -53,6 +53,27 @@ void QgsMapToolAddIsland::canvasReleaseEvent( QMouseEvent * e )
return;
}

//inform user at the begin of the digitising action that the island tool only works if exactly one feature is selected
int nSelectedFeatures = vlayer->selectedFeatureCount();
QString selectionErrorMsg;
if(nSelectedFeatures < 1)
{
selectionErrorMsg = "No feature selected. Please select a feature with the selection tool or in the attribute table";
}
else if(nSelectedFeatures > 1)
{
selectionErrorMsg = "Several features are selected. Please select only one feature to which an island should be added.";
}

if(!selectionErrorMsg.isEmpty())
{
QMessageBox::critical( 0, QObject::tr( "Error, could not add island" ), selectionErrorMsg );
mCaptureList.clear();
delete mRubberBand;
mRubberBand = 0;
return;
}

//add point to list and to rubber band
int error = addVertex( e->pos() );
if ( error == 1 )
Expand Down

0 comments on commit a9ca23c

Please sign in to comment.