Salome HOME
9b1b7937d02b90b562884b45d15d114651c3b99c
[modules/gui.git] / src / SVTK / SALOME_Actor.cxx
1 //  SALOME OBJECT : implementation of interactive object visualization for OCC and VTK viewers
2 //
3 //  Copyright (C) 2003  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. 
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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
21 //
22 //
23 //
24 //  File   : SALOME_Actor.cxx
25 //  Author : Nicolas REJNERI
26 //  Module : SALOME
27 //  $Header$
28
29 /*!
30   \class SALOME_Actor SALOME_Actor.h
31   \brief Abstract class of SALOME Objects in VTK.
32 */
33
34
35 #include "SALOME_Actor.h"
36
37 #include "VTKViewer_Transform.h"
38 #include "VTKViewer_TransformFilter.h"
39 #include "VTKViewer_PassThroughFilter.h"
40 #include "VTKViewer_GeometryFilter.h"
41 #include "SVTK_RectPicker.h"
42
43 #include "SVTK_Actor.h"
44
45 // VTK Includes
46 #include <vtkCell.h>
47 #include <vtkLine.h>
48 #include <vtkPicker.h>
49 #include <vtkPointPicker.h>
50 #include <vtkCellPicker.h>
51 #include <vtkRenderer.h>
52 #include <vtkPolyData.h>
53 #include <vtkObjectFactory.h>
54 #include <vtkDataSetMapper.h>
55 #include <vtkPolyDataMapper.h>
56 #include <vtkProperty.h>
57 #include <vtkOutlineSource.h>
58
59 #include <vtkInteractorStyle.h>
60 #include <vtkRenderWindowInteractor.h>
61
62 #include <TColStd_MapOfInteger.hxx>
63 #include <TColStd_IndexedMapOfInteger.hxx>
64
65 using namespace std;
66
67 #if defined __GNUC__
68   #if __GNUC__ == 2
69     #define __GNUC_2__
70   #endif
71 #endif
72
73 int SALOME_POINT_SIZE = 5;
74 int SALOME_LINE_WIDTH = 3;
75
76 //----------------------------------------------------------------------------
77 namespace
78 {
79   int
80   GetEdgeId(SALOME_Actor* theActor,
81             vtkPicker* thePicker, 
82             int theObjId)
83   {
84     int anEdgeId = 0;
85     if (vtkCell* aPickedCell = theActor->GetElemCell(theObjId)) {
86       float aPickPosition[3];
87       thePicker->GetPickPosition(aPickPosition);
88       float aMinDist = 1000000.0, aDist = 0;
89       for (int i = 0, iEnd = aPickedCell->GetNumberOfEdges(); i < iEnd; i++){
90         if(vtkLine* aLine = vtkLine::SafeDownCast(aPickedCell->GetEdge(i))){
91           int subId;  float pcoords[3], closestPoint[3], weights[3];
92           aLine->EvaluatePosition(aPickPosition,closestPoint,subId,pcoords,aDist,weights);
93           if (aDist < aMinDist) {
94             aMinDist = aDist;
95             anEdgeId = -1 - i;
96           }
97         }
98       }
99     }
100     return anEdgeId;
101   }
102
103   inline
104   bool
105   CheckDimensionId(Selection_Mode theMode, 
106                    SALOME_Actor *theActor, 
107                    vtkIdType theObjId)
108   {
109     switch(theMode){
110     case CellSelection:
111       return true;
112     case EdgeSelection:
113       return ( theActor->GetObjDimension( theObjId ) == 1 );
114     case FaceSelection:
115       return ( theActor->GetObjDimension( theObjId ) == 2 );
116     case VolumeSelection:
117       return ( theActor->GetObjDimension( theObjId ) == 3 );
118     };
119     return false;
120   }
121
122 }
123
124
125 //----------------------------------------------------------------------------
126 vtkStandardNewMacro(SALOME_Actor);
127
128
129 //----------------------------------------------------------------------------
130 SALOME_Actor
131 ::SALOME_Actor():
132   myRenderer(NULL),
133   myInteractor(NULL),
134   mySelectionMode(ActorSelection),
135   myPreHighlightActor(SVTK_Actor::New()),
136   myHighlightActor(SVTK_Actor::New()),
137   myOutline(vtkOutlineSource::New()),
138   myOutlineActor(VTKViewer_Actor::New())
139 {
140   myPreHighlightActor->Delete();
141   myPreHighlightActor->Initialize();
142   myPreHighlightActor->PickableOff();
143   myPreHighlightActor->SetVisibility( false );
144
145   myHighlightActor->Delete();
146   myHighlightActor->Initialize();
147   myHighlightActor->PickableOff();
148   myHighlightActor->SetVisibility( false );
149
150   myOutline->Delete();
151
152   vtkPolyDataMapper* anOutlineMapper = vtkPolyDataMapper::New();
153   anOutlineMapper->SetInput(myOutline->GetOutput());
154
155   myOutlineActor->Delete();
156   myOutlineActor->SetMapper( anOutlineMapper );
157   anOutlineMapper->Delete();
158
159   myOutlineActor->PickableOff();
160   myOutlineActor->DragableOff();
161   myOutlineActor->GetProperty()->SetColor(1.0,0.0,0.0);
162   myOutlineActor->GetProperty()->SetAmbient(1.0);
163   myOutlineActor->GetProperty()->SetDiffuse(0.0);
164   myOutlineActor->SetVisibility( false );
165 }
166
167
168 //----------------------------------------------------------------------------
169 SALOME_Actor
170 ::~SALOME_Actor()
171 {}
172
173
174 //----------------------------------------------------------------------------
175 Standard_Boolean 
176 SALOME_Actor
177 ::hasIO() 
178
179   return !myIO.IsNull(); 
180 }
181
182 const Handle(SALOME_InteractiveObject)& 
183 SALOME_Actor
184 ::getIO()
185
186   return myIO; 
187 }
188
189 void
190 SALOME_Actor
191 ::setIO(const Handle(SALOME_InteractiveObject)& theIO) 
192
193   myIO = theIO; 
194 }
195
196 void
197 SALOME_Actor
198 ::setName(const char* theName)
199 {
200   if(hasIO())   
201     myIO->setName(theName);
202   Superclass::setName(theName);
203 }
204
205
206 //----------------------------------------------------------------------------
207 void
208 SALOME_Actor
209 ::AddToRender(vtkRenderer* theRenderer)
210 {
211   Superclass::AddToRender(theRenderer);
212
213   myRenderer = theRenderer;
214
215   theRenderer->AddActor( myPreHighlightActor.GetPointer() );
216   theRenderer->AddActor( myHighlightActor.GetPointer() );
217   theRenderer->AddActor( myOutlineActor.GetPointer() );
218 }
219
220 void 
221 SALOME_Actor
222 ::RemoveFromRender(vtkRenderer* theRenderer)
223 {
224   Superclass::RemoveFromRender(theRenderer);
225
226   theRenderer->RemoveActor( myPreHighlightActor.GetPointer() );
227   theRenderer->RemoveActor( myHighlightActor.GetPointer() );
228   theRenderer->RemoveActor( myOutlineActor.GetPointer() );
229 }
230
231 vtkRenderer*
232 SALOME_Actor
233 ::GetRenderer()
234 {
235   return myRenderer;
236 }
237
238
239 //----------------------------------------------------------------------------
240 void
241 SALOME_Actor
242 ::SetInteractor(vtkRenderWindowInteractor* theInteractor)
243 {
244   myInteractor = theInteractor;
245 }
246
247 void
248 SALOME_Actor
249 ::Update()
250 {
251   myInteractor->CreateTimer(VTKI_TIMER_UPDATE);    
252 }
253
254
255 //----------------------------------------------------------------------------
256 void
257 SALOME_Actor
258 ::SetTransform(VTKViewer_Transform* theTransform)
259 {
260   Superclass::SetTransform(theTransform);
261
262   myPreHighlightActor->SetTransform(theTransform);
263   myHighlightActor->SetTransform(theTransform);
264   myOutlineActor->SetTransform(theTransform);
265 }
266
267
268 void
269 SALOME_Actor
270 ::SetPosition(float _arg1, float _arg2, float _arg3)
271 {
272   Superclass::SetPosition(_arg1,_arg2,_arg3);
273
274   myPreHighlightActor->SetPosition(_arg1,_arg2,_arg3);
275   myHighlightActor->SetPosition(_arg1,_arg2,_arg3);
276   myOutlineActor->SetPosition(_arg1,_arg2,_arg3);
277 }
278
279
280 void
281 SALOME_Actor
282 ::SetPosition(float _arg[3])
283 {
284   SetPosition(_arg[0],_arg[1],_arg[2]);
285 }
286
287
288 //----------------------------------------------------------------
289 void
290 SALOME_Actor
291 ::SetVisibility( int theVisibility )
292 {
293   Superclass::SetVisibility( theVisibility );
294
295   myOutlineActor->SetVisibility( theVisibility && isHighlighted() && !hasHighlight() );
296
297   myPreHighlightActor->SetVisibility( theVisibility && myIsPreselected );
298
299   if(mySelector.GetPointer() && hasIO()){
300     if(mySelector->SelectionMode() != ActorSelection){
301       int aHasIndex = mySelector->HasIndex( getIO() );
302       myHighlightActor->SetVisibility( theVisibility && isHighlighted() && aHasIndex);
303     }
304   }
305 }
306
307
308 //----------------------------------------------------------------
309 void
310 SALOME_Actor
311 ::SetSelector(SVTK_Selector* theSelector)
312 {
313   mySelector = theSelector;
314 }
315
316 void
317 SALOME_Actor
318 ::Highlight(bool theIsHighlight)
319 {
320   mySelectionMode = mySelector->SelectionMode();
321   myHighlightActor->SetVisibility( false );
322   myOutlineActor->SetVisibility( false );
323
324   if(mySelector.GetPointer()){
325     if(mySelectionMode != ActorSelection){
326       TColStd_IndexedMapOfInteger aMapIndex;
327       mySelector->GetIndex( getIO(), aMapIndex );
328       switch( mySelectionMode ){
329       case NodeSelection:
330         myHighlightActor->GetProperty()->SetRepresentationToPoints();
331         myHighlightActor->MapPoints( this, aMapIndex );
332         break;
333       case EdgeOfCellSelection:
334         myHighlightActor->GetProperty()->SetRepresentationToWireframe();
335         myHighlightActor->MapEdge( this, aMapIndex );
336         break;
337       case CellSelection:
338       case EdgeSelection:
339       case FaceSelection:
340       case VolumeSelection:
341         myHighlightActor->GetProperty()->SetRepresentationToSurface();
342         myHighlightActor->MapCells( this, aMapIndex );
343         break;
344       }
345       myHighlightActor->SetVisibility( GetVisibility() && theIsHighlight );
346     }
347   }
348
349   highlight(theIsHighlight);
350 }
351
352 void
353 SALOME_Actor
354 ::highlight(bool theIsHighlight)
355 {
356   float aBounds[6];
357   GetInput()->GetBounds(aBounds);
358   myOutline->SetBounds(aBounds);
359   myOutlineActor->SetVisibility( GetVisibility() && theIsHighlight );
360
361   Superclass::highlight(theIsHighlight);
362 }
363
364
365 //----------------------------------------------------------------
366 bool
367 SALOME_Actor
368 ::PreHighlight(vtkInteractorStyle *theInteractorStyle, 
369                SVTK_SelectionEvent* theSelectionEvent,
370                bool theIsHighlight)
371 {
372   vtkRenderer *aRenderer = theInteractorStyle->GetCurrentRenderer();
373   //
374   myPreHighlightActor->SetVisibility( false );
375   bool anIsPreselected = myIsPreselected;
376   
377   Selection_Mode aSelectionMode = theSelectionEvent->mySelectionMode;
378   bool anIsChanged = (mySelectionMode != aSelectionMode);
379
380   float x = theSelectionEvent->myX;
381   float y = theSelectionEvent->myY;
382   float z = 0.0;
383
384   if( !theIsHighlight ) {
385     SetPreSelected( false );
386     vtkActorCollection* theActors = aRenderer->GetActors();
387     theActors->InitTraversal();
388     while( vtkActor *ac = theActors->GetNextActor() )
389       if( SALOME_Actor* anActor = SALOME_Actor::SafeDownCast( ac ) )
390         if( anActor->hasIO() && myIO->isSame( anActor->getIO() ) )
391           anActor->SetPreSelected( false );
392
393   }else{
394     switch(aSelectionMode){
395     case NodeSelection: 
396     {
397       myPointPicker->Pick( x, y, z, aRenderer );
398       
399       int aVtkId = myPointPicker->GetPointId();
400       if( aVtkId >= 0 && mySelector->IsValid( this, aVtkId, true ) ) {
401         int anObjId = GetNodeObjId( aVtkId );
402         myIsPreselected = (anObjId >= 0);
403         if(myIsPreselected){
404           const TColStd_IndexedMapOfInteger& aMapIndex = myPreHighlightActor->GetMapIndex();
405           int anExtent = aMapIndex.Extent();
406           anIsChanged |= (anExtent == 0 || anExtent > 0 && anObjId != aMapIndex(1));
407           if(anIsChanged){
408             TColStd_IndexedMapOfInteger aMapIndex;
409             aMapIndex.Add( anObjId );
410             
411             myPreHighlightActor->GetProperty()->SetRepresentationToPoints();
412             myPreHighlightActor->MapPoints( this, aMapIndex );
413           }
414           myPreHighlightActor->SetVisibility( true );
415         }
416       }
417       break;
418     }
419     case CellSelection: 
420     case EdgeSelection:
421     case FaceSelection:
422     case VolumeSelection: 
423     {
424       myCellPicker->Pick( x, y, z, aRenderer );
425       
426       int aVtkId = myCellPicker->GetCellId();
427       if ( aVtkId >= 0 && mySelector->IsValid( this, aVtkId ) && hasIO() ) {
428         int anObjId = GetElemObjId (aVtkId );
429         if ( anObjId >= 0 ) {
430           myIsPreselected = CheckDimensionId(aSelectionMode,this,anObjId);
431           if(myIsPreselected){
432             const TColStd_IndexedMapOfInteger& aMapIndex = myPreHighlightActor->GetMapIndex();
433             int anExtent = aMapIndex.Extent();
434             anIsChanged |= (anExtent == 0 || anExtent > 0 && anObjId != aMapIndex(1));
435             if(anIsChanged){
436               TColStd_IndexedMapOfInteger aMapIndex;
437               aMapIndex.Add( anObjId );
438               
439               myPreHighlightActor->GetProperty()->SetRepresentationToSurface();
440               myPreHighlightActor->MapCells( this, aMapIndex );
441             }
442             myPreHighlightActor->SetVisibility( true );
443           }
444         }
445       }
446       break;
447     }
448     case EdgeOfCellSelection:
449     {
450       myCellPicker->Pick( x, y, z, aRenderer );
451       
452       int aVtkId = myCellPicker->GetCellId();
453       if ( aVtkId >= 0 && mySelector->IsValid( this, aVtkId )) {
454         int anObjId = GetElemObjId( aVtkId );
455         if ( anObjId >= 0 ) {
456           int anEdgeId = GetEdgeId(this,myCellPicker.GetPointer(),anObjId);
457           myIsPreselected = anEdgeId < 0;
458           if(myIsPreselected){
459             const TColStd_IndexedMapOfInteger& aMapIndex = myPreHighlightActor->GetMapIndex();
460             int anExtent = aMapIndex.Extent();
461             anIsChanged |= (anExtent == 0);
462             anIsChanged |= (anExtent == 2 && (anObjId != aMapIndex(1) || anEdgeId != aMapIndex(2)));
463             if(anIsChanged){
464               TColStd_IndexedMapOfInteger aMapIndex;
465               aMapIndex.Add( anObjId );
466               aMapIndex.Add( anEdgeId );
467
468               myPreHighlightActor->GetProperty()->SetRepresentationToWireframe();
469               myPreHighlightActor->MapEdge( this, aMapIndex );
470             }
471             myPreHighlightActor->SetVisibility( true );
472           }
473         }
474       }
475       break;
476     }
477     case ActorSelection : 
478     {
479       if( !mySelector->IsSelected( myIO ) ) {
480         SetPreSelected( true );
481
482         vtkActorCollection* theActors = aRenderer->GetActors();
483         theActors->InitTraversal();
484         while( vtkActor *anAct = theActors->GetNextActor() ) {
485           if( anAct != this )
486             if( SALOME_Actor* anActor = SALOME_Actor::SafeDownCast( anAct ) )
487               if( anActor->hasIO() && myIO->isSame( anActor->getIO() ) )
488                 anActor->SetPreSelected( true );
489         }
490       }
491     }
492     default:
493       break;
494     }
495   }
496
497   mySelectionMode = aSelectionMode;
498   anIsChanged |= (anIsPreselected != myIsPreselected);
499
500   return anIsChanged;
501 }
502
503
504 //----------------------------------------------------------------
505 bool
506 SALOME_Actor
507 ::Highlight(vtkInteractorStyle *theInteractorStyle, 
508             SVTK_SelectionEvent* theSelectionEvent,
509             bool theIsHighlight)
510 {
511   myOutlineActor->SetVisibility( false );
512   myHighlightActor->SetVisibility( false );
513
514   vtkRenderer *aRenderer = theInteractorStyle->GetCurrentRenderer();
515   //
516   Selection_Mode aSelectionMode = theSelectionEvent->mySelectionMode;
517   bool anIsShift = theSelectionEvent->myIsShift;
518   if( !anIsShift ) {
519     mySelector->RemoveIObject( this );
520   }
521
522   float x = theSelectionEvent->myX;
523   float y = theSelectionEvent->myY;
524   float z = 0.0;
525
526   if( !theSelectionEvent->myIsRectangle ) {
527     switch(aSelectionMode){
528     case NodeSelection: {
529       myPointPicker->Pick( x, y, z, aRenderer );
530
531       int aVtkId = myPointPicker->GetPointId();
532       if( aVtkId >= 0 && mySelector->IsValid( this, aVtkId, true ) ) {
533         int anObjId = GetNodeObjId( aVtkId );
534         if( anObjId >= 0 ) {
535           mySelector->AddOrRemoveIndex( myIO, anObjId, anIsShift );
536           mySelector->AddIObject( this );
537         }
538       }
539       break;
540     }
541     case CellSelection: 
542     case EdgeSelection:
543     case FaceSelection:
544     case VolumeSelection: 
545     {
546       myCellPicker->Pick( x, y, z, aRenderer );
547     
548       int aVtkId = myCellPicker->GetCellId();
549       if( aVtkId >= 0 && mySelector->IsValid( this, aVtkId ) ) {
550         int anObjId = GetElemObjId( aVtkId );
551         if( anObjId >= 0 ) {
552           if ( CheckDimensionId(aSelectionMode,this,anObjId) ) {
553             mySelector->AddOrRemoveIndex( myIO, anObjId, anIsShift );
554             mySelector->AddIObject( this );
555           }
556         }
557       }
558       break;
559     }
560     case EdgeOfCellSelection: 
561     {
562       myCellPicker->Pick( x, y, z, aRenderer );
563     
564       int aVtkId = myCellPicker->GetCellId();
565       if( aVtkId >= 0 && mySelector->IsValid( this, aVtkId ) ) {
566         int anObjId = GetElemObjId( aVtkId );
567         if( anObjId >= 0 ) {
568           int anEdgeId = GetEdgeId(this,myCellPicker.GetPointer(),anObjId);
569           if( anEdgeId < 0 ) {
570             mySelector->AddOrRemoveIndex( myIO, anObjId, false );
571             mySelector->AddOrRemoveIndex( myIO, anEdgeId, true );
572             mySelector->AddIObject( this );
573           } 
574         }
575       }
576       break;
577     }
578     case ActorSelection : 
579     {
580       if( mySelector->IsSelected( myIO ) && anIsShift )
581         mySelector->RemoveIObject( this );
582       else {
583         mySelector->AddIObject( this );
584       }
585       break;
586     }
587     default:
588       break;
589     }
590   }else{
591     float xLast = theSelectionEvent->myLastX;
592     float yLast = theSelectionEvent->myLastY;
593     float zLast = 0.0;
594
595     float x1 = x < xLast ? x : xLast;
596     float y1 = y < yLast ? y : yLast;
597     float z1 = z < zLast ? z : zLast;
598     float x2 = x > xLast ? x : xLast;
599     float y2 = y > yLast ? y : yLast;
600     float z2 = z > zLast ? z : zLast;
601
602     switch(aSelectionMode){
603     case NodeSelection: {
604       myPointRectPicker->InitializePickList();
605       myPointRectPicker->AddPickList(this);
606       myPointRectPicker->Pick( x1, y1, z1, x2, y2, z2, aRenderer );
607
608       const SVTK_RectPicker::TVectorIdsMap& aVectorIdsMap = myPointRectPicker->GetPointIdsMap();
609       SVTK_RectPicker::TVectorIdsMap::const_iterator aMapIter = aVectorIdsMap.find(this);
610       TColStd_MapOfInteger anIndexes;
611       if(aMapIter != aVectorIdsMap.end()){
612         const SVTK_RectPicker::TVectorIds& aVectorIds = aMapIter->second;
613         vtkIdType anEnd = aVectorIds.size();
614         SVTK_RectPicker::TVectorIds::const_iterator anIdIter = aVectorIds.begin();
615         for(vtkIdType anId = 0; anId < anEnd; anId++ ) {
616           int aPointId = aVectorIds[anId];
617           if( aPointId >= 0 && mySelector->IsValid( this, aPointId, true ) ) {
618             int anObjId = GetNodeObjId( aPointId );
619             anIndexes.Add( anObjId );
620           }
621         }
622       }
623       
624       if( !anIndexes.IsEmpty() ) {
625         mySelector->AddOrRemoveIndex( myIO, anIndexes, anIsShift );
626         mySelector->AddIObject( this );
627         anIndexes.Clear();
628       }
629       else
630         mySelector->RemoveIObject( this );
631
632       break;
633     }
634     case ActorSelection :
635     {
636       float aPnt[3];
637       float* aBounds = GetBounds();
638
639       bool anIsPicked = true;
640       for( int i = 0; i <= 1; i++ ) {
641         for( int j = 2; j <= 3; j++ ) {
642           for( int k = 4; k <= 5; k++ ) {
643             aRenderer->SetWorldPoint( aBounds[ i ], aBounds[ j ], aBounds[ k ], 1.0 );
644             aRenderer->WorldToDisplay();
645             aRenderer->GetDisplayPoint( aPnt );
646
647             if( aPnt[0] < x1 || aPnt[0] > x2 || aPnt[1] < y1 || aPnt[1] > y2 ) {
648               anIsPicked = false;
649               break;
650             }
651           }
652         }
653       }
654
655       if( anIsPicked )
656         mySelector->AddIObject(this);
657
658       break;
659     }
660     case CellSelection: 
661     case EdgeSelection:
662     case FaceSelection:
663     case VolumeSelection: 
664     {
665       myCellRectPicker->InitializePickList();
666       myCellRectPicker->AddPickList(this);
667       myCellRectPicker->Pick( x1, y1, z1, x2, y2, z2, aRenderer );
668
669       const SVTK_RectPicker::TVectorIdsMap& aVectorIdsMap = myCellRectPicker->GetCellIdsMap();
670       SVTK_RectPicker::TVectorIdsMap::const_iterator aMapIter = aVectorIdsMap.find(this);
671       TColStd_MapOfInteger anIndexes;
672       if(aMapIter != aVectorIdsMap.end()){
673         const SVTK_RectPicker::TVectorIds& aVectorIds = aMapIter->second;
674         vtkIdType anEnd = aVectorIds.size();
675         SVTK_RectPicker::TVectorIds::const_iterator anIdIter = aVectorIds.begin();
676         for(vtkIdType anId = 0; anId < anEnd; anId++ ) {
677           int aCellId = aVectorIds[anId];
678           if ( !mySelector->IsValid( this, aCellId ) )
679             continue;
680
681           int anObjId = GetElemObjId( aCellId );
682           if( anObjId != -1 )
683             if ( CheckDimensionId(aSelectionMode,this,anObjId) ) {
684               anIndexes.Add(anObjId);
685             }
686         }
687       }
688       mySelector->AddOrRemoveIndex( myIO, anIndexes, anIsShift );
689       mySelector->AddIObject( this );
690     }
691     default:
692       break;
693     }
694   }
695
696   mySelectionMode = aSelectionMode;
697
698   return true;
699 }
700
701 //----------------------------------------------------------------------------
702 void
703 SALOME_Actor
704 ::SetPointPicker(vtkPointPicker* thePointPicker) 
705 {
706   myPointPicker = thePointPicker;
707 }
708
709 void
710 SALOME_Actor
711 ::SetCellPicker(vtkCellPicker* theCellPicker) 
712 {
713   myCellPicker = theCellPicker;
714 }
715
716 void
717 SALOME_Actor
718 ::SetPointRectPicker(SVTK_RectPicker* theRectPicker) 
719 {
720   myPointRectPicker = theRectPicker;
721 }
722
723 void
724 SALOME_Actor
725 ::SetCellRectPicker(SVTK_RectPicker* theRectPicker) 
726 {
727   myCellRectPicker = theRectPicker;
728 }
729
730 //----------------------------------------------------------------------------
731 void
732 SALOME_Actor
733 ::SetPreHighlightProperty(vtkProperty* theProperty) 
734 {
735   myPreHighlightActor->SetProperty(theProperty);
736 }
737
738 void
739 SALOME_Actor
740 ::SetHighlightProperty(vtkProperty* theProperty) 
741 {
742   myHighlightActor->SetProperty(theProperty);
743 }