From: eap Date: Fri, 27 Feb 2009 10:56:35 +0000 (+0000) Subject: 0020183: EDF SMESH 966 : Mesh element info anomaly X-Git-Tag: V4_1_5rc1~11 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=3f8fb08a696ed39c02794500809d2c1f8caffb0d;p=modules%2Fgui.git 0020183: EDF SMESH 966 : Mesh element info anomaly limit range of actors for picking to this actor only + class TPickLimiter --- diff --git a/src/SVTK/SALOME_Actor.cxx b/src/SVTK/SALOME_Actor.cxx index 144699602..7c849f51e 100644 --- a/src/SVTK/SALOME_Actor.cxx +++ b/src/SVTK/SALOME_Actor.cxx @@ -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();