1 // SALOME SALOMEGUI : implementation of desktop and GUI kernel
3 // Copyright (C) 2003 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.
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
24 // File : SALOME_Selection.h
25 // Author : Nicolas REJNERI
29 #ifndef SVTK_SELECTOR_H
30 #define SVTK_SELECTOR_H
33 #include "SVTK_Selection.h"
34 #include "SALOME_ListIO.hxx"
35 #include "VTKViewer_Filter.h"
36 #include "SALOME_InteractiveObject.hxx"
38 #include <TColStd_MapOfInteger.hxx>
39 #include <TColStd_IndexedMapOfInteger.hxx>
41 #include <vtkObject.h>
45 class SVTK_SelectionEvent;
50 //! Define an abstract interface for selection in SVTK package
52 The class implements selection functionality through storing corresponding
53 references to #SALOME_InteractiveObject. For implementation of subselection
54 modes it keeps a corresponding map of sub indexes.
56 Also, for each #SALOME_InteractiveObject it tries to keep corresponding refenrence to #SALOME_Actor
58 class SVTK_EXPORT SVTK_Selector: public vtkObject
61 static SVTK_Selector* New();
63 vtkTypeMacro(SVTK_Selector,vtkObject);
65 //! To change current Selection_Mode (as outside effect, it invokes selectionChange signal)
68 SetSelectionMode(Selection_Mode theMode) = 0;
70 //! Get current Selection_Mode
73 SelectionMode() const = 0;
80 //! Try to find corresponding #SALOME_Actor for given reference on #SALOME_InteractiveObject
83 GetActor(const Handle(SALOME_InteractiveObject)& theIO) const = 0;
85 //! Check, is the #SALOME_InteractiveObject is present into selection
88 IsSelected(const Handle(SALOME_InteractiveObject)& theIO) const = 0;
90 //! Check, is the #SALOME_Actor is present into selection
93 IsSelected(SALOME_Actor* theActor) const = 0;
95 //! Modify the selection by adding new reference on #SALOME_InteractiveObject
98 AddIObject(const Handle(SALOME_InteractiveObject)& theIO) = 0;
100 //! Modify the selection by adding new reference on #SALOME_Actor
103 AddIObject(SALOME_Actor* theActor) = 0;
105 //! Modify the selection by removing a reference on #SALOME_InteractiveObject
108 RemoveIObject(const Handle(SALOME_InteractiveObject)& theIO) = 0;
110 //! Modify the selection by removing a reference on #SALOME_Actor
113 RemoveIObject(SALOME_Actor* theActor) = 0;
115 //! Get all #SALOME_InteractiveObject references that is present into selection
118 StoredIObjects() const = 0;
120 //! Get number of selected objects
123 IObjectCount() const = 0;
125 //! Check, if the #SALOME_InteractiveObject has a subselection
128 HasIndex(const Handle(SALOME_InteractiveObject)& theIO ) const = 0;
130 //! Get indexes of subslection for given #SALOME_InteractiveObject
133 GetIndex( const Handle(SALOME_InteractiveObject)& theIO,
134 TColStd_IndexedMapOfInteger& theIndex ) = 0;
136 //! Change indices of subselection for given #SALOME_InteractiveObject
139 AddOrRemoveIndex( const Handle(SALOME_InteractiveObject)& theIO,
140 const TColStd_IndexedMapOfInteger& theIndices,
141 bool theIsModeShift) = 0;
143 //! Change indexes of subslection for given #SALOME_InteractiveObject
146 AddOrRemoveIndex( const Handle(SALOME_InteractiveObject)& theIO,
147 const TColStd_MapOfInteger& theIndices,
148 bool theIsModeShift) = 0;
150 //! Change index of subslection for given #SALOME_InteractiveObject
153 AddOrRemoveIndex( const Handle(SALOME_InteractiveObject)& theIO,
155 bool theIsModeShift) = 0;
157 //! Change index of subslection for given #SALOME_InteractiveObject
160 RemoveIndex( const Handle(SALOME_InteractiveObject)& theIO,
163 //! Check, if the given index is present in subselection
166 IsIndexSelected(const Handle(SALOME_InteractiveObject)& theIO,
167 int theIndex) const = 0;
169 //! Clear subselection
174 //----------------------------------------------------------------------------
175 typedef int TFilterID;
177 //! To apply a filter on the selection
180 SetFilter(const Handle(VTKViewer_Filter)& theFilter) = 0;
182 //! To get a section filter by its number
184 Handle(VTKViewer_Filter)
185 GetFilter(const TFilterID theId) const = 0;
187 //! Check, if a filter with given number is applyed
190 IsFilterPresent(const TFilterID theId) const = 0;
192 //! To remove a filter from the selection
195 RemoveFilter(const TFilterID theId) = 0;
197 //! Check, if the index satisfy to the installed filters
200 IsValid(SALOME_Actor* theActor,
202 const bool theIsNode = false) const = 0;
204 //----------------------------------------------------------------------------
207 StartPickCallback() = 0;
209 //! To invoke selectionChanged signals
212 EndPickCallback() = 0;
214 //----------------------------------------------------------------------------
217 Pick(const SVTK_SelectionEvent* theEvent, vtkRenderer* theRenderer) const =0;
221 SetTolerance(const double& theTolerance) = 0;