Salome HOME
updated copyright message
[modules/gui.git] / src / SVTK / SVTK_SelectorDef.h
index 050a6838a3fd15d48c442c9b2b494778e1482e3a..fd2405ef4b30fa18e241be01ecc921a334193d5d 100644 (file)
@@ -1,34 +1,34 @@
-//  SALOME SALOMEGUI : implementation of desktop and GUI kernel
+// Copyright (C) 2007-2023  CEA, EDF, 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, or (at your option) any later version.
 //
+// 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 "SVTK_Selector.h"
+
 #include <set>
 #include <map>
 
 #include <TColStd_MapOfInteger.hxx>
 #include <vtkSmartPointer.h>
 
-#include "SVTK_Selector.h"
+#include "SALOME_InteractiveObject.hxx"
 
 class SALOME_Actor;
 
 class SVTK_Viewer;
 class SVTK_ViewWindow;
+class vtkPicker;
+class vtkCellPicker;
 
 class SVTK_SelectorDef: public SVTK_Selector
 {
@@ -104,35 +106,71 @@ public:
   virtual
   void 
   GetIndex( const Handle(SALOME_InteractiveObject)& theIO, 
-           TColStd_IndexedMapOfInteger& theIndex );
-       
+            SVTK_TIndexedMapOfVtkId& theIndex );
+        
   virtual
   bool 
   AddOrRemoveIndex( const Handle(SALOME_InteractiveObject)& theIO, 
-                   const TColStd_IndexedMapOfInteger& theIndices, 
-                   bool theIsModeShift);
+                    const SVTK_TIndexedMapOfVtkId& theIndices, 
+                    bool theIsModeShift);
   virtual
   bool 
   AddOrRemoveIndex( const Handle(SALOME_InteractiveObject)& theIO, 
-                   const TColStd_MapOfInteger& theIndices, 
-                   bool theIsModeShift);
+                    const SVTK_TVtkIDsMap& 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();
 
+  //----------------------------------------------------------------------------
+  /// ! Composite indexes 
+  virtual
+  bool 
+  HasCompositeIndex(const Handle(SALOME_InteractiveObject)& theIO ) const;
+
+  virtual
+  void 
+  GetCompositeIndex( const Handle(SALOME_InteractiveObject)& theIO, 
+                    SVTK_IndexedMapOfVtkIds& theIds );        
+  virtual
+  bool 
+  AddOrRemoveCompositeIndex( const Handle(SALOME_InteractiveObject)& theIO, 
+                            const SVTK_IndexedMapOfVtkIds& theIds,
+                            bool theIsModeShift);
+
+  virtual
+  bool
+  AddOrRemoveCompositeIndex( const Handle(SALOME_InteractiveObject)& theIO, 
+                            SVTK_ListOfVtk theIds,
+                            bool theIsModeShift);
+
+  virtual
+  void 
+  RemoveCompositeIndex( const Handle(SALOME_InteractiveObject)& theIO, 
+                       SVTK_ListOfVtk theIds );
+
+  virtual
+  bool 
+  IsCompositeIndexSelected(const Handle(SALOME_InteractiveObject)& theIO, 
+                          SVTK_ListOfVtk theIds ) const;
+
+  virtual
+  void 
+  ClearCompositeIndex();
+
   //----------------------------------------------------------------------------
   virtual
   void 
@@ -153,8 +191,8 @@ public:
   virtual
   bool
   IsValid(SALOME_Actor* theActor,
-         const TFilterID theId,
-         const bool theIsNode = false) const;
+          const TFilterID theId,
+          const bool theIsNode = false) const;
   
   //----------------------------------------------------------------------------
   virtual
@@ -165,14 +203,51 @@ public:
   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:
   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;
     }
@@ -180,7 +255,7 @@ private:
 
   struct TIndexedMapOfInteger
   {
-    TColStd_IndexedMapOfInteger myMap;
+    SVTK_TIndexedMapOfVtkId myMap;
     TIndexedMapOfInteger()
     {}
     TIndexedMapOfInteger(const TIndexedMapOfInteger& theIndexedMapOfInteger)
@@ -204,8 +279,17 @@ private:
                    TIOLessThan> TMapIOSubIndex;
   TMapIOSubIndex myMapIOSubIndex;
 
+  typedef std::map<Handle(SALOME_InteractiveObject),
+                   SVTK_IndexedMapOfVtkIds,
+                   TIOLessThan> TMapIOSubCompositeIndex;
+  TMapIOSubCompositeIndex myMapIOSubCompositeIndex;
+
+
   typedef std::map<TFilterID,Handle(VTKViewer_Filter)> TFilters;
   TFilters myFilters;
+
+  vtkSmartPointer<vtkPicker> myPicker;
+  vtkSmartPointer<vtkCellPicker> myCellPicker;
 };
 
 #endif