1 // Copyright (C) 2007-2008 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.
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
22 // SALOME SALOMEGUI : implementation of desktop and GUI kernel
23 // File : SALOME_Selection.h
24 // Author : Nicolas REJNERI
28 #ifndef SVTK_SELECTORDEF_H
29 #define SVTK_SELECTORDEF_H
34 #include <TColStd_IndexedMapOfInteger.hxx>
35 #include <TColStd_MapOfInteger.hxx>
36 #include <vtkSmartPointer.h>
38 #include "SALOME_InteractiveObject.hxx"
40 #include "SVTK_Selector.h"
45 class SVTK_ViewWindow;
49 class SVTK_SelectorDef: public SVTK_Selector
53 virtual ~SVTK_SelectorDef();
57 SetSelectionMode(Selection_Mode theMode);
61 SelectionMode() const { return mySelectionMode; }
69 GetActor(const Handle(SALOME_InteractiveObject)& theIO) const;
73 IsSelected(const Handle(SALOME_InteractiveObject)& theIO) const;
77 IsSelected(SALOME_Actor* theActor) const;
81 AddIObject(const Handle(SALOME_InteractiveObject)& theIO);
85 AddIObject(SALOME_Actor* theActor);
89 RemoveIObject(const Handle(SALOME_InteractiveObject)& theIO);
93 RemoveIObject(SALOME_Actor* theActor);
97 StoredIObjects() const;
101 IObjectCount() const;
105 HasIndex(const Handle(SALOME_InteractiveObject)& theIO ) const;
109 GetIndex( const Handle(SALOME_InteractiveObject)& theIO,
110 TColStd_IndexedMapOfInteger& theIndex );
114 AddOrRemoveIndex( const Handle(SALOME_InteractiveObject)& theIO,
115 const TColStd_IndexedMapOfInteger& theIndices,
116 bool theIsModeShift);
119 AddOrRemoveIndex( const Handle(SALOME_InteractiveObject)& theIO,
120 const TColStd_MapOfInteger& theIndices,
121 bool theIsModeShift);
124 AddOrRemoveIndex( const Handle(SALOME_InteractiveObject)& theIO,
126 bool theIsModeShift);
129 RemoveIndex( const Handle(SALOME_InteractiveObject)& theIO,
133 IsIndexSelected(const Handle(SALOME_InteractiveObject)& theIO,
139 //----------------------------------------------------------------------------
142 SetFilter(const Handle(VTKViewer_Filter)& theFilter);
145 Handle(VTKViewer_Filter)
146 GetFilter(const TFilterID theId) const;
150 IsFilterPresent(const TFilterID theId) const;
154 RemoveFilter(const int theId);
158 IsValid(SALOME_Actor* theActor,
159 const TFilterID theId,
160 const bool theIsNode = false) const;
162 //----------------------------------------------------------------------------
171 //----------------------------------------------------------------------------
174 Pick(const SVTK_SelectionEvent* theEvent, vtkRenderer* theRenderer) const;
178 SetTolerance(const double& theTolerance);
186 operator()(const Handle(SALOME_InteractiveObject)& theRightIO,
187 const Handle(SALOME_InteractiveObject)& theLeftIO) const
189 return strcmp(theRightIO->getEntry(),theLeftIO->getEntry()) < 0;
193 struct TIndexedMapOfInteger
195 TColStd_IndexedMapOfInteger myMap;
196 TIndexedMapOfInteger()
198 TIndexedMapOfInteger(const TIndexedMapOfInteger& theIndexedMapOfInteger)
200 myMap = theIndexedMapOfInteger.myMap;
204 mutable SALOME_ListIO myIObjectList;
205 typedef std::set<Handle(SALOME_InteractiveObject),
206 TIOLessThan> TIObjects;
207 TIObjects myIObjects;
209 typedef std::map<Handle(SALOME_InteractiveObject),
210 vtkSmartPointer<SALOME_Actor>,
211 TIOLessThan> TIO2Actors;
212 TIO2Actors myIO2Actors;
214 typedef std::map<Handle(SALOME_InteractiveObject),
215 TIndexedMapOfInteger,
216 TIOLessThan> TMapIOSubIndex;
217 TMapIOSubIndex myMapIOSubIndex;
219 typedef std::map<TFilterID,Handle(VTKViewer_Filter)> TFilters;
222 vtkSmartPointer<vtkPicker> myPicker;
223 vtkSmartPointer<vtkCellPicker> myCellPicker;