Skip to content

Commit a9ca23c

Browse files
author
mhugent
committed
Fix for bug #1426 Digitizer allows island creation with no poly selected
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@9705 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 620d8d6 commit a9ca23c

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

src/app/qgsmaptooladdisland.cpp

+21
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,27 @@ void QgsMapToolAddIsland::canvasReleaseEvent( QMouseEvent * e )
5353
return;
5454
}
5555

56+
//inform user at the begin of the digitising action that the island tool only works if exactly one feature is selected
57+
int nSelectedFeatures = vlayer->selectedFeatureCount();
58+
QString selectionErrorMsg;
59+
if(nSelectedFeatures < 1)
60+
{
61+
selectionErrorMsg = "No feature selected. Please select a feature with the selection tool or in the attribute table";
62+
}
63+
else if(nSelectedFeatures > 1)
64+
{
65+
selectionErrorMsg = "Several features are selected. Please select only one feature to which an island should be added.";
66+
}
67+
68+
if(!selectionErrorMsg.isEmpty())
69+
{
70+
QMessageBox::critical( 0, QObject::tr( "Error, could not add island" ), selectionErrorMsg );
71+
mCaptureList.clear();
72+
delete mRubberBand;
73+
mRubberBand = 0;
74+
return;
75+
}
76+
5677
//add point to list and to rubber band
5778
int error = addVertex( e->pos() );
5879
if ( error == 1 )

0 commit comments

Comments
 (0)