[QGIS Commit] r15740 - in trunk/qgis/src/plugins/evis: eventbrowser idtool

svn_qgis at osgeo.org svn_qgis at osgeo.org
Sun Apr 17 03:58:16 EDT 2011


Author: alexbruy
Date: 2011-04-17 00:58:16 -0700 (Sun, 17 Apr 2011)
New Revision: 15740

Modified:
   trunk/qgis/src/plugins/evis/eventbrowser/evisgenericeventbrowsergui.cpp
   trunk/qgis/src/plugins/evis/idtool/eviseventidtool.cpp
Log:
fix eVis Event Browser and ID tool


Modified: trunk/qgis/src/plugins/evis/eventbrowser/evisgenericeventbrowsergui.cpp
===================================================================
--- trunk/qgis/src/plugins/evis/eventbrowser/evisgenericeventbrowsergui.cpp	2011-04-17 05:49:15 UTC (rev 15739)
+++ trunk/qgis/src/plugins/evis/eventbrowser/evisgenericeventbrowsergui.cpp	2011-04-17 07:58:16 UTC (rev 15740)
@@ -258,8 +258,7 @@
    */
   if ( 0 == mVectorLayer->selectedFeatureCount( ) ) //if nothing is selected select everything
   {
-    QgsRectangle myRect;
-    mVectorLayer->select( myRect, true );
+    mVectorLayer->invertSelection();
     mFeatureIds = mVectorLayer->selectedFeaturesIds( ).toList( );
   }
   else //use selected features

Modified: trunk/qgis/src/plugins/evis/idtool/eviseventidtool.cpp
===================================================================
--- trunk/qgis/src/plugins/evis/idtool/eviseventidtool.cpp	2011-04-17 05:49:15 UTC (rev 15739)
+++ trunk/qgis/src/plugins/evis/idtool/eviseventidtool.cpp	2011-04-17 07:58:16 UTC (rev 15740)
@@ -60,7 +60,6 @@
 */
 void eVisEventIdTool::canvasReleaseEvent( QMouseEvent* theMouseEvent )
 {
-
   if ( 0 == mCanvas || 0 == theMouseEvent ) { return; }
 
   //Check to see if there is a layer selected
@@ -90,26 +89,35 @@
 {
 
   if ( 0 == mCanvas ) { return; }
-
+  
   QgsVectorLayer* myLayer = ( QgsVectorLayer* )mCanvas->currentLayer( );
-
+  
   // create the search rectangle. this was modeled after the QgsMapIdentifyTool in core QGIS application
   double searchWidth = mCanvas->extent( ).width( ) * (( double )QGis::DEFAULT_IDENTIFY_RADIUS / 100.0 );
-
+  
   QgsRectangle myRectangle;
   myRectangle.setXMinimum( thePoint.x( ) - searchWidth );
   myRectangle.setXMaximum( thePoint.x( ) + searchWidth );
   myRectangle.setYMinimum( thePoint.y( ) - searchWidth );
   myRectangle.setYMaximum( thePoint.y( ) + searchWidth );
-
+  
   //Transform rectange to map coordinates
   myRectangle = toLayerCoordinates( myLayer, myRectangle );
 
   //Rather than add to the current selection, clear all selected features
   myLayer->removeSelection( false );
   //select features
-  myLayer->select( myRectangle, false );
+  myLayer->select( QgsAttributeList(), myRectangle, true, true );
+  
+  QgsFeature f;
+  QgsFeatureIds newSelectedFeatures;
+  while ( myLayer->nextFeature( f ) )
+  {
+    newSelectedFeatures.insert( f.id() );
+  }
 
+  myLayer->setSelectedFeatures( newSelectedFeatures );
+  
   //Launch a new event browser to view selected features
   mBrowser = new eVisGenericEventBrowserGui( mCanvas, mCanvas, NULL );
   mBrowser->setAttribute( Qt::WA_DeleteOnClose );



More information about the QGIS-commit mailing list