Salome HOME
Update from BR_V5_DEV 13Feb2009
[modules/gui.git] / src / SVTK / SVTK_Selector.cxx
index fe5a930470c1bbf2c9585722dacbe98c23e1624a..6bbf7d15eccf6548685e32f6633b1fe01fedeac1 100644 (file)
@@ -1,36 +1,39 @@
-//  SALOME SALOMEGUI : implementation of desktop and GUI kernel
+//  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
 //
-//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
-// 
-//  This library is free software; you can redistribute it and/or 
-//  modify it under the terms of the GNU Lesser General Public 
-//  License as published by the Free Software Foundation; either 
-//  version 2.1 of the License. 
-// 
-//  This library is distributed in the hope that it will be useful, 
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of 
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
-//  Lesser General Public License for more details. 
-// 
-//  You should have received a copy of the GNU Lesser General Public 
-//  License along with this library; if not, write to the Free Software 
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
-// 
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
 //
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
 //
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 //
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//  SALOME SALOMEGUI : implementation of desktop and GUI kernel
 //  File   : SALOME_Selection.cxx
 //  Author : Nicolas REJNERI
 //  Module : SALOME
 //  $Header$
-
-
+//
 #include "SVTK_SelectorDef.h"
 
+#include <VTKViewer_Filter.h>
+
 #include "SALOME_Actor.h"
 
+#include <SUIT_Session.h>
+#include <SUIT_ResourceMgr.h>
+
 #include <TColStd_MapIteratorOfMapOfInteger.hxx>
 #include <TColStd_IndexedMapOfInteger.hxx>
 
@@ -545,15 +548,24 @@ SALOME_Actor*
 SVTK_SelectorDef
 ::Pick(const SVTK_SelectionEvent* theEvent, vtkRenderer* theRenderer) const
 {
-  myCellPicker->Pick(theEvent->myX,
-                    theEvent->myY, 
-                    0.0,
-                    theRenderer);
-  
-  vtkActorCollection* aListActors = myCellPicker->GetActors();
-  SALOME_Actor* anActor = GetLastSALOMEActor(aListActors);
+  bool anAdvancedSelectionAlgorithm = true;
+  SUIT_ResourceMgr* aResourceMgr = SUIT_Session::session()->resourceMgr();
+  if ( aResourceMgr )
+    anAdvancedSelectionAlgorithm = aResourceMgr->booleanValue( "VTKViewer", "use_advanced_selection_algorithm", true );
+
+  SALOME_Actor* anActor = NULL;
+  vtkActorCollection* aListActors = NULL;
+  if ( anAdvancedSelectionAlgorithm ) {
+    myCellPicker->Pick(theEvent->myX,
+                      theEvent->myY, 
+                      0.0,
+                      theRenderer);
   
-  if (! anActor) {
+    aListActors = myCellPicker->GetActors();
+    anActor = GetLastSALOMEActor(aListActors);
+  }
+
+  if ( !anActor ) {
     myPicker->Pick(theEvent->myX,
                   theEvent->myY, 
                   0.0,