[QGIS Commit] r9729 - in trunk/qgis: python/core src/core

svn_qgis at osgeo.org svn_qgis at osgeo.org
Tue Dec 2 18:09:55 EST 2008


Author: wonder
Date: 2008-12-02 18:09:55 -0500 (Tue, 02 Dec 2008)
New Revision: 9729

Modified:
   trunk/qgis/python/core/qgsvectorlayer.sip
   trunk/qgis/src/core/qgsvectorlayer.cpp
   trunk/qgis/src/core/qgsvectorlayer.h
Log:
Added QgsVectorLayer::deselect()


Modified: trunk/qgis/python/core/qgsvectorlayer.sip
===================================================================
--- trunk/qgis/python/core/qgsvectorlayer.sip	2008-12-02 13:02:30 UTC (rev 9728)
+++ trunk/qgis/python/core/qgsvectorlayer.sip	2008-12-02 23:09:55 UTC (rev 9729)
@@ -367,6 +367,9 @@
   /** Select feature by its ID, optionally emit signal selectionChanged() */
   void select(int featureId, bool emitSignal = TRUE);
   
+  /** Deselect feature by its ID, optionally emit signal selectionChanged() */
+  void deselect( int featureId, bool emitSignal = TRUE );
+
   /** Clear selection */
   void removeSelection(bool emitSignal = TRUE);
 

Modified: trunk/qgis/src/core/qgsvectorlayer.cpp
===================================================================
--- trunk/qgis/src/core/qgsvectorlayer.cpp	2008-12-02 13:02:30 UTC (rev 9728)
+++ trunk/qgis/src/core/qgsvectorlayer.cpp	2008-12-02 23:09:55 UTC (rev 9729)
@@ -820,6 +820,16 @@
   }
 }
 
+void QgsVectorLayer::deselect( int number, bool emitSignal )
+{
+  mSelectedFeatureIds.remove( number );
+  
+  if ( emitSignal )
+  {
+    emit selectionChanged();
+  }
+}
+
 void QgsVectorLayer::select( QgsRectangle & rect, bool lock )
 {
   // normalize the rectangle

Modified: trunk/qgis/src/core/qgsvectorlayer.h
===================================================================
--- trunk/qgis/src/core/qgsvectorlayer.h	2008-12-02 13:02:30 UTC (rev 9728)
+++ trunk/qgis/src/core/qgsvectorlayer.h	2008-12-02 23:09:55 UTC (rev 9729)
@@ -424,6 +424,9 @@
   public slots:
     /** Select feature by its ID, optionally emit signal selectionChanged() */
     void select( int featureId, bool emitSignal = TRUE );
+    
+    /** Deselect feature by its ID, optionally emit signal selectionChanged() */
+    void deselect( int featureId, bool emitSignal = TRUE );
 
     /** Clear selection */
     void removeSelection( bool emitSignal = TRUE );



More information about the QGIS-commit mailing list