Version: 9.15.0
SVTK_Selector.h
Go to the documentation of this file.
1 // Copyright (C) 2007-2025 CEA, EDF, OPEN CASCADE
2 //
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
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.
10 //
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.
15 //
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
19 //
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 
23 // SALOME SALOMEGUI : implementation of desktop and GUI kernel
24 // File : SALOME_Selection.h
25 // Author : Nicolas REJNERI
26 
27 #ifndef SVTK_SELECTOR_H
28 #define SVTK_SELECTOR_H
29 
30 #include "SVTK.h"
31 #include "SVTK_Selection.h"
32 #include "SVTK_Hash.h"
33 
34 #include "SALOME_ListIO.hxx"
35 
36 #include <VTKViewer_Filter.h>
37 
38 #include <TColStd_MapOfInteger.hxx>
39 #include <TColStd_IndexedMapOfInteger.hxx>
40 
41 #include <vtkObject.h>
42 
44 class SALOME_Actor;
46 class vtkActorCollection;
47 class vtkRenderer;
48 
50 
58 {
59 public:
60  static SVTK_Selector* New();
61 
63 
64 
65  virtual
66  void
67  SetSelectionMode(Selection_Mode theMode) = 0;
68 
70  virtual
72  SelectionMode() const = 0;
73 
75  virtual
76  void
78 
80  virtual
81  SALOME_Actor*
82  GetActor(const Handle(SALOME_InteractiveObject)& theIO) const = 0;
83 
85  virtual
86  bool
87  IsSelected(const Handle(SALOME_InteractiveObject)& theIO) const = 0;
88 
90  virtual
91  bool
92  IsSelected(SALOME_Actor* theActor) const = 0;
93 
95  virtual
96  bool
98 
100  virtual
101  bool
102  AddIObject(SALOME_Actor* theActor) = 0;
103 
105  virtual
106  bool
108 
110  virtual
111  bool
112  RemoveIObject(SALOME_Actor* theActor) = 0;
113 
115  virtual
116  const SALOME_ListIO&
117  StoredIObjects() const = 0;
118 
120  virtual
121  int
122  IObjectCount() const = 0;
123 
125  virtual
126  bool
127  HasIndex(const Handle(SALOME_InteractiveObject)& theIO ) const = 0;
128 
130  virtual
131  void
133  SVTK_TIndexedMapOfVtkId& theIndex ) = 0;
134 
136  virtual
137  bool
139  const SVTK_TIndexedMapOfVtkId& theIndices,
140  bool theIsModeShift) = 0;
141 
143  virtual
144  bool
146  const SVTK_TVtkIDsMap& theIndices,
147  bool theIsModeShift) = 0;
148 
150  virtual
151  bool
153  int theIndex,
154  bool theIsModeShift) = 0;
155 
157  virtual
158  void
160  int theIndex) = 0;
161 
163  virtual
164  bool
166  int theIndex) const = 0;
167 
169  virtual
170  void
171  ClearIndex() = 0;
172 
174  virtual
175  bool
177 
179  virtual
180  void
182  SVTK_IndexedMapOfVtkIds& theIds ) = 0;
183 
185  virtual
186  bool
188  const SVTK_IndexedMapOfVtkIds& theIds,
189  bool theIsModeShift) = 0;
190 
192  virtual
193  bool
195  SVTK_ListOfVtk ids,
196  bool theIsModeShift) = 0;
197 
199  virtual
200  void
202  SVTK_ListOfVtk ids ) = 0;
203 
205  virtual
206  bool
208  SVTK_ListOfVtk ids ) const = 0;
209 
211  virtual
212  void
214 
215  //----------------------------------------------------------------------------
216  typedef int TFilterID;
217 
219  virtual
220  void
221  SetFilter(const Handle(VTKViewer_Filter)& theFilter) = 0;
222 
224  virtual
226  GetFilter(const TFilterID theId) const = 0;
227 
229  virtual
230  bool
231  IsFilterPresent(const TFilterID theId) const = 0;
232 
234  virtual
235  void
236  RemoveFilter(const TFilterID theId) = 0;
237 
239  virtual
240  bool
242  const int theId,
243  const bool theIsNode = false) const = 0;
244 
245  //----------------------------------------------------------------------------
246  virtual
247  void
249 
251  virtual
252  void
254 
255  //----------------------------------------------------------------------------
256  virtual
257  vtkActorCollection*
258  Pick(const SVTK_SelectionEvent* theEvent, vtkRenderer* theRenderer) const = 0;
259 
260  virtual
261  void
262  SetTolerance(const double& theTolerance) = 0;
263 
264  virtual
265  void
266  SetDynamicPreSelection( bool theIsDynPreselect ) = 0;
267 
268  virtual
269  bool
271 
272  virtual
273  void
274  SetPreSelectionEnabled( bool theEnabled ) = 0;
275 
276  virtual
277  bool
279 
280  virtual
281  void
282  SetSelectionEnabled( bool theEnabled ) = 0;
283 
284  virtual
285  bool
286  IsSelectionEnabled() const = 0;
287 };
288 
289 
290 #endif
Handle(TDocStd_Application) CAF_Application
Get OCAF application.
Definition: CAF_Application.cxx:97
Selection_Mode
Definition: SALOME_Selection.h:27
#define SVTK_EXPORT
Definition: SVTK.h:37
NCollection_Map< vtkIdType, svtkIdHasher > SVTK_TVtkIDsMap
Definition: SVTK_Hash.h:151
NCollection_IndexedMap< SVTK_ListOfVtk, SVTK_vtkHasher > SVTK_IndexedMapOfVtkIds
Definition: SVTK_Hash.h:150
std::vector< vtkIdType > SVTK_ListOfVtk
Definition: SVTK_Hash.h:40
NCollection_IndexedMap< vtkIdType, svtkIdHasher > SVTK_TIndexedMapOfVtkId
Definition: SVTK_Hash.h:153
The class is a basic one for all SALOME VTK presentation.
Definition: SALOME_Actor.h:73
Definition: SALOME_ListIO.hxx:29
Define an abstract interface for selection in SVTK package.
Definition: SVTK_Selector.h:58
virtual const SALOME_ListIO & StoredIObjects() const =0
Get all SALOME_InteractiveObject references that is present into selection.
virtual void ClearIObjects()=0
Clear selection.
virtual void ClearCompositeIndex()=0
Clear composite indexes subselection.
virtual SALOME_Actor * GetActor(const Handle(SALOME_InteractiveObject)&theIO) const =0
Try to find corresponding SALOME_Actor for given reference on SALOME_InteractiveObject.
virtual void EndPickCallback()=0
To invoke selectionChanged signals.
virtual bool AddOrRemoveCompositeIndex(const Handle(SALOME_InteractiveObject)&theIO, const SVTK_IndexedMapOfVtkIds &theIds, bool theIsModeShift)=0
Change composite indices of subselection for given SALOME_InteractiveObject.
virtual bool AddIObject(SALOME_Actor *theActor)=0
Modify the selection by adding new reference on SALOME_Actor.
int TFilterID
Definition: SVTK_Selector.h:216
virtual void GetCompositeIndex(const Handle(SALOME_InteractiveObject)&theIO, SVTK_IndexedMapOfVtkIds &theIds)=0
Get composite indexes of subslection for given SALOME_InteractiveObject.
virtual bool AddOrRemoveIndex(const Handle(SALOME_InteractiveObject)&theIO, const SVTK_TIndexedMapOfVtkId &theIndices, bool theIsModeShift)=0
Change indices of subselection for given SALOME_InteractiveObject.
virtual void SetDynamicPreSelection(bool theIsDynPreselect)=0
virtual bool IsCompositeIndexSelected(const Handle(SALOME_InteractiveObject)&theIO, SVTK_ListOfVtk ids) const =0
Check, if the given composite index is present in subselection.
virtual bool IsSelectionEnabled() const =0
virtual bool RemoveIObject(SALOME_Actor *theActor)=0
Modify the selection by removing a reference on SALOME_Actor.
virtual bool IsFilterPresent(const TFilterID theId) const =0
Check, if a filter with given number is applyed.
virtual void GetIndex(const Handle(SALOME_InteractiveObject)&theIO, SVTK_TIndexedMapOfVtkId &theIndex)=0
Get indexes of subslection for given SALOME_InteractiveObject.
virtual void SetPreSelectionEnabled(bool theEnabled)=0
virtual bool GetDynamicPreSelection() const =0
virtual vtkActorCollection * Pick(const SVTK_SelectionEvent *theEvent, vtkRenderer *theRenderer) const =0
virtual bool IsPreSelectionEnabled() const =0
virtual void SetFilter(const Handle(VTKViewer_Filter)&theFilter)=0
To apply a filter on the selection.
virtual int IObjectCount() const =0
Get number of selected objects.
virtual void RemoveFilter(const TFilterID theId)=0
To remove a filter from the selection.
virtual void RemoveCompositeIndex(const Handle(SALOME_InteractiveObject)&theIO, SVTK_ListOfVtk ids)=0
Change composite index of subslection for given SALOME_InteractiveObject.
virtual void SetSelectionEnabled(bool theEnabled)=0
virtual bool IsIndexSelected(const Handle(SALOME_InteractiveObject)&theIO, int theIndex) const =0
Check, if the given index is present in subselection.
virtual Handle(VTKViewer_Filter) GetFilter(const TFilterID theId) const =0
To get a section filter by its number.
virtual bool IsValid(SALOME_Actor *theActor, const int theId, const bool theIsNode=false) const =0
Check, if the index satisfy to the installed filters.
virtual bool HasCompositeIndex(const Handle(SALOME_InteractiveObject)&theIO) const =0
! Composite indexes
vtkTypeMacro(SVTK_Selector, vtkObject) virtual void SetSelectionMode(Selection_Mode theMode)=0
To change current Selection_Mode (as outside effect, it invokes selectionChange signal)
virtual bool IsSelected(SALOME_Actor *theActor) const =0
Check, is the SALOME_Actor is present into selection.
virtual bool AddOrRemoveIndex(const Handle(SALOME_InteractiveObject)&theIO, int theIndex, bool theIsModeShift)=0
Change index of subslection for given SALOME_InteractiveObject.
virtual bool HasIndex(const Handle(SALOME_InteractiveObject)&theIO) const =0
Check, if the SALOME_InteractiveObject has a subselection.
virtual bool AddOrRemoveIndex(const Handle(SALOME_InteractiveObject)&theIO, const SVTK_TVtkIDsMap &theIndices, bool theIsModeShift)=0
Change indexes of subslection for given SALOME_InteractiveObject.
virtual Selection_Mode SelectionMode() const =0
Get current Selection_Mode.
virtual bool AddOrRemoveCompositeIndex(const Handle(SALOME_InteractiveObject)&theIO, SVTK_ListOfVtk ids, bool theIsModeShift)=0
Change composite index of subslection for given SALOME_InteractiveObject.
virtual bool IsSelected(const Handle(SALOME_InteractiveObject)&theIO) const =0
Check, is the SALOME_InteractiveObject is present into selection.
virtual void SetTolerance(const double &theTolerance)=0
virtual void ClearIndex()=0
Clear subselection.
virtual void StartPickCallback()=0
virtual bool RemoveIObject(const Handle(SALOME_InteractiveObject)&theIO)=0
Modify the selection by removing a reference on SALOME_InteractiveObject.
virtual void RemoveIndex(const Handle(SALOME_InteractiveObject)&theIO, int theIndex)=0
Change index of subslection for given SALOME_InteractiveObject.
virtual bool AddIObject(const Handle(SALOME_InteractiveObject)&theIO)=0
Modify the selection by adding new reference on SALOME_InteractiveObject.
Definition: VTKViewer_Filter.cxx:29
The structure is used for passing all infromation necessary for claculation of the selection.
Definition: SVTK_SelectionEvent.h:41