1 // Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License, or (at your option) any later version.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 // SALOME SALOMEGUI : implementation of desktop and GUI kernel
24 // File : SALOME_Selection.h
25 // Author : Nicolas REJNERI
27 #ifndef SVTK_SELECTOR_H
28 #define SVTK_SELECTOR_H
31 #include "SVTK_Selection.h"
32 #include "SALOME_ListIO.hxx"
34 #include <TColStd_MapOfInteger.hxx>
35 #include <TColStd_IndexedMapOfInteger.hxx>
37 #include <vtkObject.h>
39 class Handle(VTKViewer_Filter);
42 class SVTK_SelectionEvent;
43 class vtkActorCollection;
45 class Handle(SALOME_InteractiveObject);
47 //! Define an abstract interface for selection in SVTK package
49 The class implements selection functionality through storing corresponding
50 references to #SALOME_InteractiveObject. For implementation of subselection
51 modes it keeps a corresponding map of sub indexes.
53 Also, for each #SALOME_InteractiveObject it tries to keep corresponding refenrence to #SALOME_Actor
55 class SVTK_EXPORT SVTK_Selector: public vtkObject
58 static SVTK_Selector* New();
60 vtkTypeMacro(SVTK_Selector,vtkObject);
62 //! To change current Selection_Mode (as outside effect, it invokes selectionChange signal)
65 SetSelectionMode(Selection_Mode theMode) = 0;
67 //! Get current Selection_Mode
70 SelectionMode() const = 0;
77 //! Try to find corresponding #SALOME_Actor for given reference on #SALOME_InteractiveObject
80 GetActor(const Handle(SALOME_InteractiveObject)& theIO) const = 0;
82 //! Check, is the #SALOME_InteractiveObject is present into selection
85 IsSelected(const Handle(SALOME_InteractiveObject)& theIO) const = 0;
87 //! Check, is the #SALOME_Actor is present into selection
90 IsSelected(SALOME_Actor* theActor) const = 0;
92 //! Modify the selection by adding new reference on #SALOME_InteractiveObject
95 AddIObject(const Handle(SALOME_InteractiveObject)& theIO) = 0;
97 //! Modify the selection by adding new reference on #SALOME_Actor
100 AddIObject(SALOME_Actor* theActor) = 0;
102 //! Modify the selection by removing a reference on #SALOME_InteractiveObject
105 RemoveIObject(const Handle(SALOME_InteractiveObject)& theIO) = 0;
107 //! Modify the selection by removing a reference on #SALOME_Actor
110 RemoveIObject(SALOME_Actor* theActor) = 0;
112 //! Get all #SALOME_InteractiveObject references that is present into selection
115 StoredIObjects() const = 0;
117 //! Get number of selected objects
120 IObjectCount() const = 0;
122 //! Check, if the #SALOME_InteractiveObject has a subselection
125 HasIndex(const Handle(SALOME_InteractiveObject)& theIO ) const = 0;
127 //! Get indexes of subslection for given #SALOME_InteractiveObject
130 GetIndex( const Handle(SALOME_InteractiveObject)& theIO,
131 TColStd_IndexedMapOfInteger& theIndex ) = 0;
133 //! Change indices of subselection for given #SALOME_InteractiveObject
136 AddOrRemoveIndex( const Handle(SALOME_InteractiveObject)& theIO,
137 const TColStd_IndexedMapOfInteger& theIndices,
138 bool theIsModeShift) = 0;
140 //! Change indexes of subslection for given #SALOME_InteractiveObject
143 AddOrRemoveIndex( const Handle(SALOME_InteractiveObject)& theIO,
144 const TColStd_MapOfInteger& theIndices,
145 bool theIsModeShift) = 0;
147 //! Change index of subslection for given #SALOME_InteractiveObject
150 AddOrRemoveIndex( const Handle(SALOME_InteractiveObject)& theIO,
152 bool theIsModeShift) = 0;
154 //! Change index of subslection for given #SALOME_InteractiveObject
157 RemoveIndex( const Handle(SALOME_InteractiveObject)& theIO,
160 //! Check, if the given index is present in subselection
163 IsIndexSelected(const Handle(SALOME_InteractiveObject)& theIO,
164 int theIndex) const = 0;
166 //! Clear subselection
171 //----------------------------------------------------------------------------
172 typedef int TFilterID;
174 //! To apply a filter on the selection
177 SetFilter(const Handle(VTKViewer_Filter)& theFilter) = 0;
179 //! To get a section filter by its number
181 Handle(VTKViewer_Filter)
182 GetFilter(const TFilterID theId) const = 0;
184 //! Check, if a filter with given number is applyed
187 IsFilterPresent(const TFilterID theId) const = 0;
189 //! To remove a filter from the selection
192 RemoveFilter(const TFilterID theId) = 0;
194 //! Check, if the index satisfy to the installed filters
197 IsValid(SALOME_Actor* theActor,
199 const bool theIsNode = false) const = 0;
201 //----------------------------------------------------------------------------
204 StartPickCallback() = 0;
206 //! To invoke selectionChanged signals
209 EndPickCallback() = 0;
211 //----------------------------------------------------------------------------
214 Pick(const SVTK_SelectionEvent* theEvent, vtkRenderer* theRenderer) const = 0;
218 SetTolerance(const double& theTolerance) = 0;
222 SetDynamicPreSelection( bool theIsDynPreselect ) = 0;
226 GetDynamicPreSelection() const = 0;
230 SetPreSelectionEnabled( bool theEnabled ) = 0;
234 IsPreSelectionEnabled() const = 0;
238 SetSelectionEnabled( bool theEnabled ) = 0;
242 IsSelectionEnabled() const = 0;