Salome HOME
CMake: Removed MPI detection: GUI only needs it as a second rank
[modules/gui.git] / src / SVTK / SVTK_SelectorDef.h
index 47f593e9a3b438ee3bd533b4affe93f653d34846..3e4e6c42c60f89ec4cd10ad49dd0bd304b22e33a 100644 (file)
@@ -1,30 +1,28 @@
-//  SALOME SALOMEGUI : implementation of desktop and GUI kernel
+// Copyright (C) 2007-2013  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+// 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.h
 //  Author : Nicolas REJNERI
-//  Module : SALOME
-//  $Header$
 
 #ifndef SVTK_SELECTORDEF_H
 #define SVTK_SELECTORDEF_H
 #include <TColStd_MapOfInteger.hxx>
 #include <vtkSmartPointer.h>
 
+#include "SALOME_InteractiveObject.hxx"
+
 #include "SVTK_Selector.h"
 
 class SALOME_Actor;
 
 class SVTK_Viewer;
 class SVTK_ViewWindow;
+class vtkPicker;
+class vtkCellPicker;
 
 class SVTK_SelectorDef: public SVTK_Selector
 {
@@ -51,7 +53,7 @@ public:
 
   virtual
   void 
-  SetSelectionMode( Selection_Mode theMode );
+  SetSelectionMode(Selection_Mode theMode);
 
   virtual
   Selection_Mode
@@ -104,49 +106,119 @@ public:
   virtual
   void 
   GetIndex( const Handle(SALOME_InteractiveObject)& theIO, 
-           TColStd_IndexedMapOfInteger& theIndex );
-       
+            TColStd_IndexedMapOfInteger& theIndex );
+        
   virtual
   bool 
   AddOrRemoveIndex( const Handle(SALOME_InteractiveObject)& theIO, 
-                   const TColStd_IndexedMapOfInteger& theIndices, 
-                   bool theIsModeShift);
+                    const TColStd_IndexedMapOfInteger& theIndices, 
+                    bool theIsModeShift);
   virtual
   bool 
   AddOrRemoveIndex( const Handle(SALOME_InteractiveObject)& theIO, 
-                   const TColStd_MapOfInteger& theIndices, 
-                   bool theIsModeShift);
+                    const TColStd_MapOfInteger& theIndices, 
+                    bool theIsModeShift);
   virtual
   bool
   AddOrRemoveIndex( const Handle(SALOME_InteractiveObject)& theIO, 
-                   int theIndex, 
-                   bool theIsModeShift);
+                    int theIndex, 
+                    bool theIsModeShift);
   virtual
   void 
   RemoveIndex( const Handle(SALOME_InteractiveObject)& theIO, 
-              int theIndex);
+               int theIndex);
   virtual
   bool 
   IsIndexSelected(const Handle(SALOME_InteractiveObject)& theIO, 
-                 int theIndex) const;
+                  int theIndex) const;
   virtual
   void 
   ClearIndex();
 
+  //----------------------------------------------------------------------------
+  virtual
+  void 
+  SetFilter(const Handle(VTKViewer_Filter)& theFilter);
+
+  virtual
+  Handle(VTKViewer_Filter) 
+  GetFilter(const TFilterID theId) const;
+
+  virtual
+  bool
+  IsFilterPresent(const TFilterID theId) const;
+
+  virtual
+  void
+  RemoveFilter(const int theId);
+
+  virtual
+  bool
+  IsValid(SALOME_Actor* theActor,
+          const TFilterID theId,
+          const bool theIsNode = false) const;
+  
+  //----------------------------------------------------------------------------
+  virtual
+  void 
+  StartPickCallback();
+
+  virtual
+  void 
+  EndPickCallback();
+
+  //----------------------------------------------------------------------------
+  virtual
+  vtkActorCollection*
+  Pick(const SVTK_SelectionEvent* theEvent, vtkRenderer* theRenderer) const;
+
+  virtual
+  void
+  SetTolerance(const double& theTolerance);
+
+  virtual
+  void
+  SetDynamicPreSelection( bool theIsDynPreselect );
+
+  virtual
+  bool
+  GetDynamicPreSelection() const;
+
+  virtual
+  void
+  SetPreSelectionEnabled( bool theEnabled );
+
+  virtual
+  bool
+  IsPreSelectionEnabled() const;
+
+  virtual
+  void
+  SetSelectionEnabled( bool theEnabled );
+
+  virtual
+  bool
+  IsSelectionEnabled() const;
+
 private:
-  Selection_Mode mySelectionMode;
+  int mySelectionMode;
+
+  bool myDynamicPreselection;
+  bool myPreselectionEnabled;
+  bool mySelectionEnabled;
 
   struct TIOLessThan
   {
     bool 
     operator()(const Handle(SALOME_InteractiveObject)& theRightIO,
-              const Handle(SALOME_InteractiveObject)& theLeftIO) const
+               const Handle(SALOME_InteractiveObject)& theLeftIO) const
     {
       return strcmp(theRightIO->getEntry(),theLeftIO->getEntry()) < 0;
     }
   };
 
-  struct TIndexedMapOfInteger{
+  struct TIndexedMapOfInteger
+  {
     TColStd_IndexedMapOfInteger myMap;
     TIndexedMapOfInteger()
     {}
@@ -170,7 +242,12 @@ private:
                    TIndexedMapOfInteger,
                    TIOLessThan> TMapIOSubIndex;
   TMapIOSubIndex myMapIOSubIndex;
-};
 
+  typedef std::map<TFilterID,Handle(VTKViewer_Filter)> TFilters;
+  TFilters myFilters;
+
+  vtkSmartPointer<vtkPicker> myPicker;
+  vtkSmartPointer<vtkCellPicker> myCellPicker;
+};
 
 #endif