[QGIS Commit] r9705 - trunk/qgis/src/app

svn_qgis at osgeo.org svn_qgis at osgeo.org
Tue Nov 25 09:03:25 EST 2008


Author: mhugent
Date: 2008-11-25 09:03:24 -0500 (Tue, 25 Nov 2008)
New Revision: 9705

Modified:
   trunk/qgis/src/app/qgsmaptooladdisland.cpp
Log:
Fix for bug #1426 Digitizer allows island creation with no poly selected

Modified: trunk/qgis/src/app/qgsmaptooladdisland.cpp
===================================================================
--- trunk/qgis/src/app/qgsmaptooladdisland.cpp	2008-11-25 08:50:55 UTC (rev 9704)
+++ trunk/qgis/src/app/qgsmaptooladdisland.cpp	2008-11-25 14:03:24 UTC (rev 9705)
@@ -53,6 +53,27 @@
     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 )



More information about the QGIS-commit mailing list