Salome HOME
ff670521d6ff8ba2aa9f8e99d20332df2787fc3d
[modules/gui.git] / src / SVTK / SVTK_Selector.cxx
1 // Copyright (C) 2007-2023  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.cxx
25 //  Author : Nicolas REJNERI
26 #include "SVTK_SelectorDef.h"
27
28 #include <VTKViewer_Filter.h>
29
30 #include "SALOME_Actor.h"
31
32 #include <SUIT_Session.h>
33 #include <SUIT_ResourceMgr.h>
34
35 #include <TColStd_MapIteratorOfMapOfInteger.hxx>
36 #include <TColStd_IndexedMapOfInteger.hxx>
37
38 #include <vtkCallbackCommand.h>
39 #include <vtkActorCollection.h>
40 #include <vtkCellPicker.h>
41
42
43 /*!
44   \return new SVTK_Selector
45 */
46 SVTK_Selector* 
47 SVTK_Selector
48 ::New()
49 {
50   return new SVTK_SelectorDef();
51 }
52
53 /*!
54   Default constructor
55 */
56 SVTK_SelectorDef
57 ::SVTK_SelectorDef():
58   myPicker(vtkPicker::New()),
59   myCellPicker(vtkCellPicker::New())
60 {
61   mySelectionMode = ActorSelection;
62   myDynamicPreselection = true;
63   myPreselectionEnabled = true;
64   mySelectionEnabled = true;
65
66   myPicker->Delete();
67   myCellPicker->Delete();
68 }
69
70 /*!
71   Destructor
72 */
73 SVTK_SelectorDef
74 ::~SVTK_SelectorDef()
75 {
76 }
77
78 /*!
79   To invoke selectionChanged signals
80 */
81 void 
82 SVTK_SelectorDef
83 ::StartPickCallback()
84 {
85   this->InvokeEvent(vtkCommand::StartPickEvent,NULL);
86 }
87
88 /*!
89   To invoke selectionChanged signals
90 */
91 void 
92 SVTK_SelectorDef
93 ::EndPickCallback()
94 {
95   this->InvokeEvent(vtkCommand::EndPickEvent,NULL);
96 }
97
98 /*!
99   To change current Selection_Mode (as outside effect, it invokes selectionChange signal)
100 */
101 void 
102 SVTK_SelectorDef
103 ::SetSelectionMode(Selection_Mode theMode)
104 {
105   if(mySelectionMode != theMode){
106     mySelectionMode = theMode;
107     myMapIOSubIndex.clear();
108     myMapIOSubCompositeIndex.clear();
109     this->EndPickCallback();
110   }
111 }
112
113 /*!
114   Clear selection
115 */
116 void 
117 SVTK_SelectorDef
118 ::ClearIObjects() 
119 {
120   myIO2Actors.clear();
121   myIObjects.clear();
122   myMapIOSubIndex.clear();
123   myMapIOSubCompositeIndex.clear();
124 }
125
126 /*!
127   \return true if the SALOME_InteractiveObject presents into selection
128 */
129 bool
130 SVTK_SelectorDef
131 ::IsSelected(const Handle(SALOME_InteractiveObject)& theIO) const
132 {
133   return !theIO.IsNull() && (myIObjects.find(theIO) != myIObjects.end());
134 }
135
136 /*!
137   \return true if the SALOME_Actor presents into selection
138 */
139 bool
140 SVTK_SelectorDef
141 ::IsSelected(SALOME_Actor* theActor) const
142 {
143   const Handle(SALOME_InteractiveObject) anIO = theActor->getIO();
144   return IsSelected(anIO) && myIO2Actors.find(anIO) != myIO2Actors.end();
145 }
146
147 /*!
148   \return corresponding SALOME_Actor for SALOME_InteractiveObject
149   \param theIO - SALOME_InteractiveObject
150 */
151 SALOME_Actor*
152 SVTK_SelectorDef
153 ::GetActor(const Handle(SALOME_InteractiveObject)& theIO) const
154 {
155   TIO2Actors::const_iterator anIter = myIO2Actors.find(theIO);
156   if(anIter != myIO2Actors.end())
157     return anIter->second.GetPointer();
158   return NULL;
159 }
160
161 /*!
162   Adds SALOME_InteractiveObject into selection
163   \param theIO - SALOME_InteractiveObject
164 */
165 bool 
166 SVTK_SelectorDef
167 ::AddIObject(const Handle(SALOME_InteractiveObject)& theIO) 
168 {
169   if(!IsSelected(theIO)){
170     myIObjects.insert(theIO);
171     return true;
172   }
173   return false;
174 }
175
176 /*!
177   Adds SALOME_Actor into selection
178   \param theActor - SALOME_Actor
179 */
180 bool 
181 SVTK_SelectorDef
182 ::AddIObject(SALOME_Actor* theActor) 
183 {
184   const Handle(SALOME_InteractiveObject) anIO = theActor->getIO();
185
186   bool anIsIOBound = IsSelected(anIO);
187   if(!anIsIOBound)
188     myIObjects.insert(anIO);
189
190   bool anIsActorBound = myIO2Actors.find(anIO) != myIO2Actors.end();
191   if(!anIsActorBound)
192     myIO2Actors[anIO] = theActor;
193   
194   return !anIsIOBound || !anIsActorBound;
195 }
196
197 /*!
198   Removes SALOME_InteractiveObject from selection
199   \param theIO - SALOME_InteractiveObject
200 */
201 bool 
202 SVTK_SelectorDef
203 ::RemoveIObject(const Handle(SALOME_InteractiveObject)& theIO) 
204 {
205   bool anIsIOBound = myIObjects.find(theIO) != myIObjects.end();
206
207   myIObjects.erase(theIO);
208   myIO2Actors.erase(theIO);
209   myMapIOSubIndex.erase(theIO);
210   myMapIOSubCompositeIndex.erase(theIO);
211
212   return anIsIOBound;
213 }
214
215 /*!
216   Removes SALOME_Actor from selection
217   \param theActor - SALOME_Actor
218 */
219 bool 
220 SVTK_SelectorDef
221 ::RemoveIObject(SALOME_Actor* theActor) 
222 {
223   const Handle(SALOME_InteractiveObject) anIO = theActor->getIO();
224
225   bool anIsActorBound = myIO2Actors.find(anIO) != myIO2Actors.end();
226   if(anIsActorBound)
227     myIO2Actors.erase(anIO);
228
229   return RemoveIObject(anIO) || anIsActorBound;
230 }
231
232 /*!
233   \return list of all SALOME_InteractiveObject presenting in selection
234 */
235 const SALOME_ListIO& 
236 SVTK_SelectorDef
237 ::StoredIObjects() const
238 {
239   myIObjectList.Clear();
240   TIObjects::const_iterator anIter = myIObjects.begin();
241   TIObjects::const_iterator anIterEnd = myIObjects.end();
242   for(; anIter != anIterEnd; anIter++)
243     myIObjectList.Append(*anIter);
244
245   return myIObjectList;
246 }
247
248 /*!
249   \return number of selected objects
250 */
251 int
252 SVTK_SelectorDef
253 ::IObjectCount() const
254 {
255   return (int)myIObjects.size(); //!< TODO: conversion from size_t to int
256 }
257
258 /*!
259   \return true if the SALOME_InteractiveObject has a subselection
260   \param theIO - SALOME_InteractiveObject
261 */
262 bool 
263 SVTK_SelectorDef
264 ::HasIndex( const Handle(SALOME_InteractiveObject)& theIO) const
265 {
266   return myMapIOSubIndex.find(theIO) != myMapIOSubIndex.end();
267 }
268
269 /*!
270   Gets indices of subselection for SALOME_InteractiveObject
271   \param theIO - SALOME_InteractiveObject
272 */
273 void 
274 SVTK_SelectorDef
275 ::GetIndex( const Handle(SALOME_InteractiveObject)& theIO, 
276             SVTK_TIndexedMapOfVtkId& theIndex)
277 {
278   TMapIOSubIndex::const_iterator anIter = myMapIOSubIndex.find(theIO);
279   if(anIter != myMapIOSubIndex.end())
280     theIndex = anIter->second.myMap;
281   else
282     theIndex.Clear();
283 }
284
285 /*!
286   \return true if the index presents in subselection 
287   \param theIO - SALOME_InteractiveObject
288   \param theIndex - index
289 */
290 bool
291 SVTK_SelectorDef
292 ::IsIndexSelected(const Handle(SALOME_InteractiveObject)& theIO, 
293                   int theIndex) const
294 {
295   TMapIOSubIndex::const_iterator anIter = myMapIOSubIndex.find(theIO);
296   if(anIter != myMapIOSubIndex.end()){
297     const SVTK_TIndexedMapOfVtkId& aMapIndex = anIter->second.myMap;
298     return aMapIndex.Contains( theIndex ) == Standard_True;
299   }
300
301   return false;
302 }
303
304 static bool removeIndex(SVTK_TIndexedMapOfVtkId& theMapIndex, const int theIndex)
305 {
306   int anId = theMapIndex.FindIndex(theIndex); // i==0 if Index is not in the MapIndex
307   if(anId){
308     // only the last key can be removed
309     int aLastId = theMapIndex.FindKey(theMapIndex.Extent());
310     if(aLastId == anId)
311       theMapIndex.RemoveLast();
312     else{
313       SVTK_TIndexedMapOfVtkId aNewMap;
314       aNewMap.ReSize(theMapIndex.Extent()-1);
315       for(int j = 1; j <= theMapIndex.Extent(); j++){
316         int anIndex = theMapIndex(j);
317         if ( anIndex != theIndex )
318           aNewMap.Add( anIndex );
319       }
320       theMapIndex = aNewMap;
321     }
322   }
323   return anId != 0;
324 }
325
326 static bool removeCompositeIndex( SVTK_IndexedMapOfVtkIds& theMapIndex, const SVTK_ListOfVtk theIds )
327 {
328   int anId = theMapIndex.FindIndex( theIds ); // i==0 if Index is not in the MapIndex
329   if( anId ) {
330     // only the last key can be removed
331     SVTK_ListOfVtk aLastIds = theMapIndex.FindKey( theMapIndex.Extent() );
332     if( aLastIds == theIds )
333       theMapIndex.RemoveLast();
334     else {
335       SVTK_IndexedMapOfVtkIds aNewMap;
336       aNewMap.ReSize(theMapIndex.Extent()-1);
337       for( int j = 1; j <= theMapIndex.Extent(); j++ ){
338         SVTK_ListOfVtk anIds = theMapIndex( j );
339         if ( anIds != theIds )
340           aNewMap.Add( anIds );
341       }
342       theMapIndex = aNewMap;
343     }
344   }
345   return anId != 0;
346 }
347
348
349 /*!
350   Changes indices of subselection for SALOME_InteractiveObject
351   \param theIO - SALOME_InteractiveObject
352   \param theIndices - indices
353   \param theIsModeShift - if it is false, then map will be cleared before indices are added
354 */
355 bool
356 SVTK_SelectorDef
357 ::AddOrRemoveIndex( const Handle(SALOME_InteractiveObject)& theIO, 
358                     const SVTK_TIndexedMapOfVtkId& theIndices, 
359                     bool theIsModeShift)
360 {
361   TMapIOSubIndex::iterator aMapIter = myMapIOSubIndex.find(theIO);
362   if(aMapIter == myMapIOSubIndex.end()){
363     TIndexedMapOfInteger anEmpty;
364     aMapIter = myMapIOSubIndex.
365       insert(TMapIOSubIndex::value_type(theIO,anEmpty)).first;
366   }
367   SVTK_TIndexedMapOfVtkId& aMapIndex = aMapIter->second.myMap;
368
369   if(!theIsModeShift)
370     aMapIndex.Clear();
371   
372   for(int i = 1, iEnd = theIndices.Extent(); i <= iEnd; i++)
373     aMapIndex.Add(theIndices(i));
374   
375   if(aMapIndex.IsEmpty()) {
376     myMapIOSubIndex.erase(theIO);
377     return false;
378   }
379
380   return true;
381 }
382
383
384 /*!
385   Changes indices of subselection for SALOME_InteractiveObject
386   \param theIO - SALOME_InteractiveObject
387   \param theIndices - indices
388   \param theIsModeShift - if it is false, then map will be cleared before indices are added
389 */
390 bool
391 SVTK_SelectorDef
392 ::AddOrRemoveIndex( const Handle(SALOME_InteractiveObject)& theIO, 
393                     const SVTK_TVtkIDsMap& theIndices, 
394                     bool theIsModeShift)
395 {
396   TMapIOSubIndex::iterator aMapIter = myMapIOSubIndex.find(theIO);
397   if(aMapIter == myMapIOSubIndex.end()){
398     TIndexedMapOfInteger anEmpty;
399     aMapIter = myMapIOSubIndex.
400       insert(TMapIOSubIndex::value_type(theIO,anEmpty)).first;
401   }
402   SVTK_TIndexedMapOfVtkId& aMapIndex = aMapIter->second.myMap;
403
404   if(!theIsModeShift)
405     aMapIndex.Clear();
406   
407   SVTK_TVtkIDsMapIterator anIter(theIndices);
408   for(; anIter.More(); anIter.Next())
409     aMapIndex.Add(anIter.Key());
410   
411   if(aMapIndex.IsEmpty()) {
412     myMapIOSubIndex.erase(theIO);
413     return false;
414   }
415
416   return true;
417 }
418
419
420 /*!
421   Changes indices of subselection for SALOME_InteractiveObject
422   \param theIO - SALOME_InteractiveObject
423   \param theIndex - index
424   \param theIsModeShift - if it is false, then map will be cleared before indices are added
425 */
426 bool 
427 SVTK_SelectorDef
428 ::AddOrRemoveIndex( const Handle(SALOME_InteractiveObject)& theIO, 
429                     int theIndex, 
430                     bool theIsModeShift)
431 {
432   TMapIOSubIndex::iterator anIter = myMapIOSubIndex.find(theIO);
433   if(anIter == myMapIOSubIndex.end()){
434     TIndexedMapOfInteger anEmpty;
435     anIter = myMapIOSubIndex.
436       insert(TMapIOSubIndex::value_type(theIO,anEmpty)).first;
437   }
438   SVTK_TIndexedMapOfVtkId& aMapIndex = anIter->second.myMap;
439
440   bool anIsConatains = aMapIndex.Contains( theIndex ) == Standard_True;
441   if ( anIsConatains )
442     removeIndex( aMapIndex, theIndex );
443   
444   if ( !theIsModeShift )
445     aMapIndex.Clear();
446   
447   if ( !anIsConatains )
448     aMapIndex.Add( theIndex );
449
450   if ( aMapIndex.IsEmpty() )
451     myMapIOSubIndex.erase( theIO );
452
453   return false;
454 }
455
456
457 /*!
458   Removes index of subselection for SALOME_InteractiveObject
459   \param theIO - SALOME_InteractiveObject
460   \param theIndex - index
461 */
462 void
463 SVTK_SelectorDef
464 ::RemoveIndex( const Handle(SALOME_InteractiveObject)& theIO, 
465                int theIndex)
466 {
467   if(IsIndexSelected(theIO,theIndex)){
468     TMapIOSubIndex::iterator anIter = myMapIOSubIndex.find(theIO);
469     SVTK_TIndexedMapOfVtkId& aMapIndex = anIter->second.myMap;
470     removeIndex(aMapIndex,theIndex);
471   }
472 }
473
474 /*!
475   Clears all indices of subselection
476 */
477 void 
478 SVTK_SelectorDef
479 ::ClearIndex()
480 {
481   myMapIOSubIndex.clear();  
482 }
483
484 /*!
485   \return true if the SALOME_InteractiveObject has a composite index subselection
486   \param theIO - SALOME_InteractiveObject
487 */
488 bool 
489 SVTK_SelectorDef
490 ::HasCompositeIndex( const Handle(SALOME_InteractiveObject)& theIO ) const
491 {
492   return myMapIOSubCompositeIndex.find( theIO ) != myMapIOSubCompositeIndex.end();
493 }
494
495 /*!
496   Gets composite indices of subselection for SALOME_InteractiveObject
497   \param theIO - SALOME_InteractiveObject
498 */
499 void 
500 SVTK_SelectorDef
501 ::GetCompositeIndex( const Handle(SALOME_InteractiveObject)& theIO, 
502                      SVTK_IndexedMapOfVtkIds& theIds )
503 {
504   TMapIOSubCompositeIndex::const_iterator anIter = myMapIOSubCompositeIndex.find( theIO );
505   if( anIter != myMapIOSubCompositeIndex.end() )
506     theIds = anIter->second;
507   else
508     theIds.Clear();
509 }
510
511 /*!
512   Changes composite indices of subselection for SALOME_InteractiveObject
513   \param theIO - SALOME_InteractiveObject
514   \param theIndices - composite id
515   \param theIsModeShift - if it is false, then map will be cleared before indices are added
516 */
517 bool
518 SVTK_SelectorDef
519 ::AddOrRemoveCompositeIndex( const Handle( SALOME_InteractiveObject )& theIO, 
520                     const SVTK_IndexedMapOfVtkIds& theIds, 
521                     bool theIsModeShift)
522 {
523   TMapIOSubCompositeIndex::iterator aMapIter = myMapIOSubCompositeIndex.find( theIO );
524   if( aMapIter == myMapIOSubCompositeIndex.end() ) {
525     SVTK_IndexedMapOfVtkIds anEmpty;
526     aMapIter = myMapIOSubCompositeIndex.insert( TMapIOSubCompositeIndex::value_type( theIO, anEmpty ) ).first;
527   }
528   SVTK_IndexedMapOfVtkIds& aMapIndex = aMapIter->second;
529
530   if( !theIsModeShift )
531     aMapIndex.Clear();
532   
533   for( int i = 1, iEnd = theIds.Extent(); i <= iEnd; i++ )
534     aMapIndex.Add( theIds( i ) );
535   
536   if( aMapIndex.IsEmpty() ) {
537     myMapIOSubCompositeIndex.erase( theIO );
538     return false;
539   }
540   return true;
541 }
542
543 /*!
544   Changes indices of subselection for SALOME_InteractiveObject
545   \param theIO - SALOME_InteractiveObject
546   \param theIds - composite ids
547   \param theIsModeShift - if it is false, then map will be cleared before indices are added
548 */
549 bool 
550 SVTK_SelectorDef
551 ::AddOrRemoveCompositeIndex( const Handle(SALOME_InteractiveObject)& theIO, 
552                              SVTK_ListOfVtk theIds,
553                              bool theIsModeShift)
554 {
555   TMapIOSubCompositeIndex::iterator anIter = myMapIOSubCompositeIndex.find( theIO );
556   if( anIter == myMapIOSubCompositeIndex.end() ) {
557     SVTK_IndexedMapOfVtkIds anEmpty;
558     anIter = myMapIOSubCompositeIndex.insert(TMapIOSubCompositeIndex::value_type( theIO,anEmpty ) ).first;
559   }
560
561   SVTK_IndexedMapOfVtkIds& aMapIndex = anIter->second;
562
563   bool anIsContains = aMapIndex.Contains( theIds ) == Standard_True;
564   if ( anIsContains )
565     removeCompositeIndex( aMapIndex, theIds );
566   
567   if ( !theIsModeShift )
568     aMapIndex.Clear();
569   
570   if ( !anIsContains )
571     aMapIndex.Add( theIds );
572
573   if ( aMapIndex.IsEmpty() )
574     myMapIOSubIndex.erase( theIO );
575
576   return false;
577 }
578
579 /*!
580   Removes composite index of subselection for SALOME_InteractiveObject
581   \param theIO - SALOME_InteractiveObject
582   \param theIds - index
583 */
584 void
585 SVTK_SelectorDef
586 ::RemoveCompositeIndex( const Handle(SALOME_InteractiveObject)& theIO, 
587                         SVTK_ListOfVtk theIds )
588 {
589   if(IsCompositeIndexSelected( theIO, theIds ) ) {
590     TMapIOSubCompositeIndex::iterator anIter = myMapIOSubCompositeIndex.find( theIO );
591     SVTK_IndexedMapOfVtkIds& aMapIndex = anIter->second;
592     removeCompositeIndex( aMapIndex,theIds );
593   }
594 }
595
596 /*!
597   \return true if the composite index presents in subselection 
598   \param theIO - SALOME_InteractiveObject
599   \param theIds - index
600 */
601 bool
602 SVTK_SelectorDef
603 ::IsCompositeIndexSelected( const Handle(SALOME_InteractiveObject)& theIO, 
604                             SVTK_ListOfVtk theIds ) const
605 {
606   TMapIOSubCompositeIndex::const_iterator anIter = myMapIOSubCompositeIndex.find( theIO );
607   if( anIter != myMapIOSubCompositeIndex.end() ) {
608     const SVTK_IndexedMapOfVtkIds& aMapIndex = anIter->second;
609     return aMapIndex.Contains( theIds ) == Standard_True;
610   }
611   return false;
612 }
613
614 /*!
615   Clears all composite indices of subselection
616 */
617 void 
618 SVTK_SelectorDef
619 ::ClearCompositeIndex()
620 {
621   myMapIOSubCompositeIndex.clear();  
622 }
623
624
625 /*!
626   To apply a filter on the selection
627   \param theFilter - new filter
628 */
629 void
630 SVTK_SelectorDef
631 ::SetFilter(const Handle(VTKViewer_Filter)& theFilter)
632 {
633   myFilters.insert(TFilters::value_type(theFilter->GetId(),theFilter));
634 }
635
636 /*!
637   \return true if filter with given number is applyed
638   \param theId - filter id
639 */
640 bool
641 SVTK_SelectorDef
642 ::IsFilterPresent(const TFilterID theId) const
643 {
644   return myFilters.find(theId) != myFilters.end();
645 }
646
647 /*!
648   To remove a filter from the selection
649   \param theId - filter id
650 */
651 void  
652 SVTK_SelectorDef
653 ::RemoveFilter(const TFilterID theId)
654 {
655   if(IsFilterPresent(theId))
656     myFilters.erase(theId);
657 }
658
659 /*!
660   \return true if the index satisfy installed filters
661   \param theActor - actor
662   \param theId - filter id
663   \param theIsNode - whether it is node
664 */
665 bool
666 SVTK_SelectorDef
667 ::IsValid(SALOME_Actor* theActor,
668           const TFilterID theId,
669           const bool theIsNode) const
670 {
671   TFilters::const_iterator anIter = myFilters.begin();
672   for(; anIter != myFilters.end(); ++anIter){
673     const Handle(VTKViewer_Filter)& aFilter = anIter->second;
674     if(theIsNode == aFilter->IsNodeFilter() &&
675        !aFilter->IsValid(theActor,theId))
676       return false;
677   }
678   return true;
679 }
680
681 /*!
682   \return filter by it's id
683   \param theId - filter id
684 */
685 Handle(VTKViewer_Filter) 
686 SVTK_SelectorDef
687 ::GetFilter(const TFilterID theId) const
688 {
689   TFilters::const_iterator anIter = myFilters.find(theId);
690   if(anIter != myFilters.end()){
691     const Handle(VTKViewer_Filter)& aFilter = anIter->second;
692     return aFilter;
693   }
694   return Handle(VTKViewer_Filter)();
695 }
696
697 vtkActorCollection*
698 SVTK_SelectorDef
699 ::Pick(const SVTK_SelectionEvent* theEvent, vtkRenderer* theRenderer) const
700 {
701   vtkActorCollection* aListActors = NULL;
702
703   if ( GetDynamicPreSelection() ) {
704     myCellPicker->Pick(theEvent->myX,
705                        theEvent->myY, 
706                        0.0,
707                        theRenderer);
708   
709     aListActors = myCellPicker->GetActors();
710   }
711
712   if ( !aListActors || !aListActors->GetNumberOfItems() ) {
713     myPicker->Pick(theEvent->myX,
714                    theEvent->myY, 
715                    0.0,
716                    theRenderer);
717     aListActors = myPicker->GetActors();
718   }
719   
720   return aListActors;
721 }
722
723 void
724 SVTK_SelectorDef
725 ::SetTolerance(const double& theTolerance) 
726 {
727   myPicker->SetTolerance(theTolerance);         
728   myCellPicker->SetTolerance(theTolerance);
729 }
730
731 void
732 SVTK_SelectorDef
733 ::SetDynamicPreSelection( bool theIsDynPreselect )
734 {
735   myDynamicPreselection = theIsDynPreselect;
736 }
737
738 bool
739 SVTK_SelectorDef
740 ::GetDynamicPreSelection() const
741 {
742   return myDynamicPreselection;
743 }
744
745 void
746 SVTK_SelectorDef
747 ::SetPreSelectionEnabled( bool theEnabled )
748 {
749   myPreselectionEnabled = theEnabled;
750 }
751
752 bool
753 SVTK_SelectorDef
754 ::IsPreSelectionEnabled() const
755 {
756   return mySelectionEnabled && myPreselectionEnabled;
757 }
758
759 void
760 SVTK_SelectorDef
761 ::SetSelectionEnabled( bool theEnabled )
762 {
763   mySelectionEnabled = theEnabled;
764 }
765
766 bool
767 SVTK_SelectorDef
768 ::IsSelectionEnabled() const
769 {
770   return mySelectionEnabled;
771 }