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
32 #include "SVTK_Selection.h"
33 #include "SALOME_ListIO.hxx"
34 #include "VTKViewer_Filter.h"
35 #include "SALOME_InteractiveObject.hxx"
37 #include <TColStd_MapOfInteger.hxx>
38 #include <TColStd_IndexedMapOfInteger.hxx>
40 #include <vtkObject.h>
44 //! Define an abstract interface for selection in SVTK package
46 The class implements selection functionality through storing corresponding
47 references to #SALOME_InteractiveObject. For implementation of subselection
48 modes it keeps a corresponding map of sub indexes.
50 Also, for each #SALOME_InteractiveObject it tries to keep corresponding refenrence to #SALOME_Actor
52 class SVTK_Selector: public vtkObject
55 static SVTK_Selector* New();
57 vtkTypeMacro(SVTK_Selector,vtkObject);
59 //! To change current Selection_Mode (as outside effect, it invokes selectionChange signal)
62 SetSelectionMode(Selection_Mode theMode) = 0;
64 //! Get current Selection_Mode
67 SelectionMode() const = 0;
74 //! Try to find corresponding #SALOME_Actor for given reference on #SALOME_InteractiveObject
77 GetActor(const Handle(SALOME_InteractiveObject)& theIO) const = 0;
79 //! Check, is the #SALOME_InteractiveObject is present into selection
82 IsSelected(const Handle(SALOME_InteractiveObject)& theIO) const = 0;
84 //! Check, is the #SALOME_Actor is present into selection
87 IsSelected(SALOME_Actor* theActor) const = 0;
89 //! Modify the selection by adding new reference on #SALOME_InteractiveObject
92 AddIObject(const Handle(SALOME_InteractiveObject)& theIO) = 0;
94 //! Modify the selection by adding new reference on #SALOME_Actor
97 AddIObject(SALOME_Actor* theActor) = 0;
99 //! Modify the selection by removing a reference on #SALOME_InteractiveObject
102 RemoveIObject(const Handle(SALOME_InteractiveObject)& theIO) = 0;
104 //! Modify the selection by removing a reference on #SALOME_Actor
107 RemoveIObject(SALOME_Actor* theActor) = 0;
109 //! Get all #SALOME_InteractiveObject references that is present into selection
112 StoredIObjects() const = 0;
114 //! Get number of selected objects
117 IObjectCount() const = 0;
119 //! Check, if the #SALOME_InteractiveObject has a subselection
122 HasIndex(const Handle(SALOME_InteractiveObject)& theIO ) const = 0;
124 //! Get indexes of subslection for given #SALOME_InteractiveObject
127 GetIndex( const Handle(SALOME_InteractiveObject)& theIO,
128 TColStd_IndexedMapOfInteger& theIndex ) = 0;
130 //! Change indices of subselection for given #SALOME_InteractiveObject
133 AddOrRemoveIndex( const Handle(SALOME_InteractiveObject)& theIO,
134 const TColStd_IndexedMapOfInteger& theIndices,
135 bool theIsModeShift) = 0;
137 //! Change indexes of subslection for given #SALOME_InteractiveObject
140 AddOrRemoveIndex( const Handle(SALOME_InteractiveObject)& theIO,
141 const TColStd_MapOfInteger& theIndices,
142 bool theIsModeShift) = 0;
144 //! Change index of subslection for given #SALOME_InteractiveObject
147 AddOrRemoveIndex( const Handle(SALOME_InteractiveObject)& theIO,
149 bool theIsModeShift) = 0;
151 //! Change index of subslection for given #SALOME_InteractiveObject
154 RemoveIndex( const Handle(SALOME_InteractiveObject)& theIO,
157 //! Check, if the given index is present in subselection
160 IsIndexSelected(const Handle(SALOME_InteractiveObject)& theIO,
161 int theIndex) const = 0;
163 //! Clear subselection
168 //----------------------------------------------------------------------------
169 typedef int TFilterID;
171 //! To apply a filter on the selection
174 SetFilter(const Handle(VTKViewer_Filter)& theFilter) = 0;
176 //! To get a section filter by its number
178 Handle(VTKViewer_Filter)
179 GetFilter(const TFilterID theId) const = 0;
181 //! Check, if a filter with given number is applyed
184 IsFilterPresent(const TFilterID theId) const = 0;
186 //! To remove a filter from the selection
189 RemoveFilter(const TFilterID theId) = 0;
191 //! Check, if the index satisfy to the installed filters
194 IsValid(SALOME_Actor* theActor,
196 const bool theIsNode = false) const = 0;
198 //----------------------------------------------------------------------------
201 StartPickCallback() = 0;
203 //! To invoke selectionChanged signals
206 EndPickCallback() = 0;