]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
0020183: EDF SMESH 966 : Mesh element info anomaly
authoreap <eap@opencascade.com>
Fri, 27 Feb 2009 10:56:35 +0000 (10:56 +0000)
committereap <eap@opencascade.com>
Fri, 27 Feb 2009 10:56:35 +0000 (10:56 +0000)
   limit range of actors for picking to this actor only
+  class TPickLimiter

src/SVTK/SALOME_Actor.cxx

index 144699602ea5a976ba0560f3024e4a1724256636..7c849f51e24843149524e232ca786b84eafb62d7 100644 (file)
@@ -23,7 +23,6 @@
 //  File   : SALOME_Actor.cxx
 //  Author : Nicolas REJNERI
 //  Module : SALOME
-//  $Header$
 //
 /*!
   \class SALOME_Actor SALOME_Actor.h
@@ -32,6 +31,7 @@
 
 
 #include "SALOME_Actor.h"
+#include "SALOME_InteractiveObject.hxx"
 
 #include "VTKViewer_Transform.h"
 #include "VTKViewer_TransformFilter.h"
@@ -118,6 +118,28 @@ namespace
     return false;
   }
 
+  class TPickLimiter
+  {
+    vtkAbstractPicker* myPicker;
+  public:
+    /*!
+      Make picker work with this actor only
+    */
+    TPickLimiter(vtkAbstractPicker* picker, SALOME_Actor* actor):myPicker(picker)
+    {
+      myPicker->InitializePickList();
+      myPicker->AddPickList( actor );
+      myPicker->SetPickFromList( true );
+    }
+    /*!
+      Unlimit picking
+    */
+    ~TPickLimiter()
+    {
+      myPicker->SetPickFromList( false );
+      myPicker->InitializePickList();
+    }
+  };
 }
 
 
@@ -417,7 +439,7 @@ SALOME_Actor
 {
   if ( !GetPickable() )
     return false;
-
+      
   vtkRenderer *aRenderer = theInteractorStyle->GetCurrentRenderer();
   //
   myPreHighlightActor->SetVisibility( false );
@@ -440,9 +462,10 @@ SALOME_Actor
          anActor->SetPreSelected( false );
 
   }else{
-    switch(aSelectionMode){
+    switch(aSelectionMode) {
     case NodeSelection: 
     {
+      TPickLimiter( myPointPicker, this );
       myPointPicker->Pick( x, y, z, aRenderer );
       
       int aVtkId = myPointPicker->GetPointId();
@@ -470,6 +493,7 @@ SALOME_Actor
     case FaceSelection:
     case VolumeSelection: 
     {
+      TPickLimiter( myCellPicker, this );
       myCellPicker->Pick( x, y, z, aRenderer );
       
       int aVtkId = myCellPicker->GetCellId();
@@ -496,6 +520,7 @@ SALOME_Actor
     }
     case EdgeOfCellSelection:
     {
+      TPickLimiter( myCellPicker, this );
       myCellPicker->Pick( x, y, z, aRenderer );
       
       int aVtkId = myCellPicker->GetCellId();
@@ -582,6 +607,7 @@ SALOME_Actor
   if( !theSelectionEvent->myIsRectangle ) {
     switch(aSelectionMode){
     case NodeSelection: {
+      TPickLimiter( myPointPicker, this );
       myPointPicker->Pick( x, y, z, aRenderer );
 
       int aVtkId = myPointPicker->GetPointId();
@@ -599,6 +625,7 @@ SALOME_Actor
     case FaceSelection:
     case VolumeSelection: 
     {
+      TPickLimiter( myCellPicker, this );
       myCellPicker->Pick( x, y, z, aRenderer );
     
       int aVtkId = myCellPicker->GetCellId();
@@ -615,6 +642,7 @@ SALOME_Actor
     }
     case EdgeOfCellSelection: 
     {
+      TPickLimiter( myCellPicker, this );
       myCellPicker->Pick( x, y, z, aRenderer );
     
       int aVtkId = myCellPicker->GetCellId();
@@ -657,8 +685,8 @@ SALOME_Actor
 
     switch(aSelectionMode){
     case NodeSelection: {
-      myPointRectPicker->InitializePickList();
-      myPointRectPicker->AddPickList(this);
+
+      TPickLimiter( myPointRectPicker, this );
       myPointRectPicker->Pick( x1, y1, z1, x2, y2, z2, aRenderer );
 
       const SVTK_RectPicker::TVectorIdsMap& aVectorIdsMap = myPointRectPicker->GetPointIdsMap();
@@ -717,8 +745,7 @@ SALOME_Actor
     case FaceSelection:
     case VolumeSelection: 
     {
-      myCellRectPicker->InitializePickList();
-      myCellRectPicker->AddPickList(this);
+      TPickLimiter( myCellRectPicker, this );
       myCellRectPicker->Pick( x1, y1, z1, x2, y2, z2, aRenderer );
 
       const SVTK_RectPicker::TVectorIdsMap& aVectorIdsMap = myCellRectPicker->GetCellIdsMap();