]> SALOME platform Git repositories - modules/gui.git/blob - src/SVTK/SVTK_Renderer.cxx
Salome HOME
369520b1ece46540132695bffbfee35a805758e3
[modules/gui.git] / src / SVTK / SVTK_Renderer.cxx
1 //  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, 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.
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 //  SALOME VTKViewer : build VTK viewer into Salome desktop
23 //  File   :
24 //  Author :
25 //  Module :
26 //  $Header$
27 //
28 #include "SVTK_Renderer.h"
29
30 #include "SVTK_Trihedron.h"
31 #include "SVTK_CubeAxesActor2D.h"
32 #include "SVTK_RectPicker.h"
33
34 #include "SALOME_Actor.h"
35 #include "VTKViewer_Actor.h"
36 #include "VTKViewer_Transform.h"
37 #include "VTKViewer_Utilities.h"
38
39 #include <vtkCamera.h>
40 #include <vtkRenderer.h>
41 #include <vtkTextProperty.h>
42 #include <vtkObjectFactory.h>
43 #include <vtkCallbackCommand.h>
44
45 #include <vtkPicker.h>
46 #include <vtkPointPicker.h>
47 #include <vtkCellPicker.h>
48
49 #include <vtkProperty.h>
50
51 // undefining min and max because CASCADE's defines them and
52 // it clashes with std::min(), std::max() included in utilities.h
53 #undef min
54 #undef max
55
56
57 vtkStandardNewMacro(SVTK_Renderer);
58
59 /*!
60   Constructor
61 */
62 SVTK_Renderer
63 ::SVTK_Renderer():
64   myDevice(vtkRenderer::New()),
65   myInteractor(NULL),
66   myPriority(0.0),
67   myEventCallbackCommand(vtkCallbackCommand::New()),
68   myPointPicker(vtkPointPicker::New()),
69   myCellPicker(vtkCellPicker::New()),
70   myPointRectPicker(SVTK_RectPicker::New()),
71   myCellRectPicker(SVTK_RectPicker::New()),
72   myPreHighlightProperty(vtkProperty::New()),
73   myHighlightProperty(vtkProperty::New()),
74   myTransform(VTKViewer_Transform::New()),
75   myCubeAxes(SVTK_CubeAxesActor2D::New()),
76   myTrihedron(SVTK_Trihedron::New()),
77   myTrihedronSize(105),
78   myIsTrihedronRelative(true)
79 {
80   myDevice->Delete();
81   myTransform->Delete();
82
83   myPointPicker->Delete();
84   myCellPicker->Delete();
85
86   myPointRectPicker->Delete();
87   myPointRectPicker->PickFromListOn();
88
89   myCellRectPicker->Delete();
90   myCellRectPicker->PickFromListOn();
91   myCellRectPicker->PickPointsOff();
92
93   //SetPreselectionProp();
94   myPreHighlightProperty->Delete();
95   myPreHighlightProperty->SetColor(0,1,1);
96   myPreHighlightProperty->SetPointSize(SALOME_POINT_SIZE+2);
97   myPreHighlightProperty->SetLineWidth(SALOME_LINE_WIDTH+2);
98   myPreHighlightProperty->SetRepresentationToPoints();
99
100   //SetSelectionProp();
101   myHighlightProperty->Delete();
102   myHighlightProperty->SetColor(1,1,0);
103   myHighlightProperty->SetPointSize(SALOME_POINT_SIZE+2);
104   myHighlightProperty->SetLineWidth(SALOME_LINE_WIDTH+2);
105   myHighlightProperty->SetRepresentationToPoints();
106
107   myTrihedron->Delete();
108   myCubeAxes->Delete();
109   myEventCallbackCommand->Delete();
110
111   myTrihedron->AddToRender(GetDevice());
112   GetDevice()->AddViewProp(GetCubeAxes());
113
114   myBndBox[0] = myBndBox[2] = myBndBox[4] = 0;
115   myBndBox[1] = myBndBox[3] = myBndBox[5] = myTrihedron->GetSize();
116
117   myCubeAxes->SetBounds(myBndBox);
118   myCubeAxes->SetCamera(GetDevice()->GetActiveCamera());
119
120   myCubeAxes->SetLabelFormat("%6.4g");
121   myCubeAxes->SetFlyModeToOuterEdges(); // ENK remarks: it must bee
122   myCubeAxes->SetFontFactor(0.8);
123   myCubeAxes->SetCornerOffset(0);
124   myCubeAxes->SetScaling(0);
125   myCubeAxes->SetNumberOfLabels(5);
126   myCubeAxes->VisibilityOff();
127   myCubeAxes->SetTransform(GetTransform());
128
129   vtkTextProperty* aTextProp = vtkTextProperty::New();
130   aTextProp->SetColor(1, 1, 1);
131   aTextProp->ShadowOn();
132   myCubeAxes->SetAxisTitleTextProperty(aTextProp);
133   myCubeAxes->SetAxisLabelTextProperty(aTextProp);
134   aTextProp->Delete();
135
136   GetDevice()->GetActiveCamera()->ParallelProjectionOn();
137   GetDevice()->LightFollowCameraOn();
138   GetDevice()->TwoSidedLightingOn();
139
140   myEventCallbackCommand->SetClientData(this);
141   myEventCallbackCommand->SetCallback(SVTK_Renderer::ProcessEvents);
142   GetDevice()->AddObserver(vtkCommand::ConfigureEvent,
143                            myEventCallbackCommand.GetPointer(), 
144                            myPriority);
145   GetDevice()->AddObserver(vtkCommand::ResetCameraEvent,
146                            myEventCallbackCommand.GetPointer(), 
147                            myPriority);
148   GetDevice()->AddObserver(vtkCommand::ResetCameraClippingRangeEvent,
149                            myEventCallbackCommand.GetPointer(), 
150                            myPriority);
151 }
152
153 /*!
154   Destructor
155 */
156 SVTK_Renderer
157 ::~SVTK_Renderer()
158 {
159   vtkActorCollection* anActors = GetDevice()->GetActors();
160   vtkActorCollection* anActors2 = vtkActorCollection::New();
161
162   anActors->InitTraversal();
163   while(vtkActor* anAct = anActors->GetNextActor()){
164     if(SALOME_Actor* anActor = dynamic_cast<SALOME_Actor*>(anAct)){
165       anActors2->AddItem(anActor);
166     }
167   }
168
169   anActors2->InitTraversal();
170   while(vtkActor* anAct = anActors2->GetNextActor()){
171     if(SALOME_Actor* anActor = dynamic_cast<SALOME_Actor*>(anAct)){
172       RemoveActor(anActor);
173     }
174   }
175
176   anActors2->Delete();
177 }
178
179
180 /*!
181   Main process event method
182 */
183 void 
184 SVTK_Renderer
185 ::ProcessEvents(vtkObject* vtkNotUsed(theObject), 
186                 unsigned long theEvent,
187                 void* theClientData, 
188                 void* vtkNotUsed(theCallData))
189 {
190   SVTK_Renderer* self = reinterpret_cast<SVTK_Renderer*>(theClientData);
191
192   switch(theEvent){
193   case vtkCommand::ConfigureEvent:
194     self->OnResetView();
195     break;
196   case vtkCommand::ResetCameraEvent:
197     self->OnFitAll();
198     break;
199   case vtkCommand::ResetCameraClippingRangeEvent:
200     self->OnResetClippingRange();
201     break;
202   }
203 }
204
205 /*!
206   \return renderer's device
207 */
208 vtkRenderer* 
209 SVTK_Renderer
210 ::GetDevice()
211 {
212   return myDevice.GetPointer();
213 }
214
215 /*!
216   Initialize renderer
217 */
218 void 
219 SVTK_Renderer
220 ::Initialize(vtkRenderWindowInteractor* theInteractor,
221              SVTK_Selector* theSelector)
222 {
223   myInteractor = theInteractor;
224   mySelector = theSelector;
225   SetSelectionTolerance();
226 }
227
228 /*!
229   Publishes pointed actor into the renderer
230 */
231 void
232 SVTK_Renderer
233 ::AddActor(VTKViewer_Actor* theActor)
234 {
235   if(SALOME_Actor* anActor = dynamic_cast<SALOME_Actor*>(theActor)){
236     anActor->SetInteractor(myInteractor);
237     anActor->SetTransform(GetTransform());
238     anActor->SetSelector(mySelector.GetPointer());
239
240     anActor->SetPointPicker(myPointPicker.GetPointer());
241     anActor->SetCellPicker(myCellPicker.GetPointer());
242
243     anActor->SetPointRectPicker(myPointRectPicker.GetPointer());
244     anActor->SetCellRectPicker(myCellRectPicker.GetPointer());
245
246     anActor->SetPreHighlightProperty(myPreHighlightProperty.GetPointer());
247     anActor->SetHighlightProperty(myHighlightProperty.GetPointer());
248
249     anActor->AddToRender(GetDevice());
250     AdjustActors();
251   }
252 }
253
254 /*!
255   Removes pointed actor from the renderer
256 */
257 void
258 SVTK_Renderer
259 ::RemoveActor(VTKViewer_Actor* theActor)
260 {
261   if(SALOME_Actor* anActor = dynamic_cast<SALOME_Actor*>(theActor)){
262     // Order of the calls are important because VTKViewer_Actor::RemoveFromRender
263     //   can leads do destruction of the actor
264     anActor->SetInteractor(NULL);
265     anActor->SetTransform(NULL);
266     anActor->SetSelector(NULL);
267
268     anActor->SetPointPicker(NULL);
269     anActor->SetCellPicker(NULL);
270
271     anActor->SetPointRectPicker(NULL);
272     anActor->SetCellRectPicker(NULL);
273
274     anActor->SetPreHighlightProperty(NULL);
275     anActor->SetHighlightProperty(NULL);
276
277     anActor->RemoveFromRender(GetDevice());
278     AdjustActors();
279   }
280 }
281
282 /*!
283   Get special container that keeps scaling of the scene
284 */
285 VTKViewer_Transform* 
286 SVTK_Renderer
287 ::GetTransform()
288 {
289   return myTransform.GetPointer();
290 }
291
292 /*!
293   Allows to get a scale that is applied on the whole scene
294 */
295 void
296 SVTK_Renderer
297 ::GetScale( double theScale[3] ) 
298 {
299   myTransform->GetMatrixScale( theScale );
300 }
301
302 /*!
303   Allows to apply a scale on the whole scene
304 */
305 void
306 SVTK_Renderer
307 ::SetScale( double theScale[3] ) 
308 {
309   myTransform->SetMatrixScale( theScale[0], theScale[1], theScale[2] );
310   AdjustActors();
311
312   vtkActorCollection* anActors = GetDevice()->GetActors();
313   anActors->InitTraversal();
314   while(vtkActor* anAct = anActors->GetNextActor())
315     if(SALOME_Actor* anActor = dynamic_cast<SALOME_Actor*>(anAct))
316       if(anActor->isHighlighted() && !anActor->IsInfinitive())
317         anActor->highlight(true);
318 }
319
320 /*!
321   Applies color and size (PointSize and LineWidth) of primitives in selection mode
322 */
323 void
324 SVTK_Renderer
325 ::SetSelectionProp(const double& theRed, 
326                    const double& theGreen, 
327                    const double& theBlue, 
328                    const int& theWidth) 
329 {
330   myHighlightProperty->SetColor( theRed, theGreen, theBlue );
331   myHighlightProperty->SetLineWidth( theWidth );
332   myHighlightProperty->SetPointSize( theWidth );
333 }
334
335 /*!
336   Applies color and size (PointSize and LineWidth) of primitives in preselection mode
337 */
338 void
339 SVTK_Renderer
340 ::SetPreselectionProp(const double& theRed, 
341                       const double& theGreen, 
342                       const double& theBlue, 
343                       const int& theWidth) 
344 {
345   myPreHighlightProperty->SetColor( theRed, theGreen, theBlue );
346   myPreHighlightProperty->SetLineWidth( theWidth );
347   myPreHighlightProperty->SetPointSize( theWidth );
348 }
349
350 /*!
351   Setup requested tolerance for the picking
352 */
353 void
354 SVTK_Renderer
355 ::SetSelectionTolerance(const double& theTolNodes, 
356                         const double& theTolCell,
357                         const double& theTolObjects)
358 {
359   myPointPicker->SetTolerance( theTolNodes );
360   myCellPicker->SetTolerance( theTolCell );
361
362   myPointRectPicker->SetTolerance( theTolNodes );
363   myCellRectPicker->SetTolerance( theTolCell );
364
365   mySelector->SetTolerance( theTolObjects );
366 }
367
368
369 /*! If parameter theIsForcedUpdate is true, recalculate parameters for
370  *  trihedron and cube axes, even if trihedron and cube axes is invisible.
371  */
372
373 inline
374 bool
375 CheckBndBox(const vtkFloatingPointType theBounds[6])
376 {
377   if(theBounds[0] > -VTK_LARGE_FLOAT && theBounds[1] < VTK_LARGE_FLOAT &&
378      theBounds[2] > -VTK_LARGE_FLOAT && theBounds[3] < VTK_LARGE_FLOAT &&
379      theBounds[4] > -VTK_LARGE_FLOAT && theBounds[5] < VTK_LARGE_FLOAT)
380     return true;
381   return false;
382 }
383
384 /*!
385   Adjusts size of actors
386 */
387 bool
388 SVTK_Renderer
389 ::OnAdjustActors()
390 {
391   bool aTDisplayed = IsTrihedronDisplayed();
392   bool aCDisplayed = IsCubeAxesDisplayed();
393
394   vtkFloatingPointType aNewBndBox[6];
395   aNewBndBox[ 0 ] = aNewBndBox[ 2 ] = aNewBndBox[ 4 ] = VTK_LARGE_FLOAT;
396   aNewBndBox[ 1 ] = aNewBndBox[ 3 ] = aNewBndBox[ 5 ] = -VTK_LARGE_FLOAT;
397
398   int aVisibleNum = myTrihedron->GetVisibleActorCount(GetDevice());
399   if(aVisibleNum){
400     if(aTDisplayed)
401       myTrihedron->VisibilityOff();
402
403     if(aCDisplayed) 
404       myCubeAxes->VisibilityOff();
405
406     // if the new trihedron size have sufficient difference, then apply the value
407     vtkFloatingPointType aSize = myTrihedron->GetSize();
408     if ( IsTrihedronRelative() )
409       {
410         ComputeTrihedronSize(GetDevice(),aSize,aSize,myTrihedronSize);
411         myTrihedron->SetSize(aSize);
412       }
413     else
414       myTrihedron->SetSize( myTrihedronSize );
415
416     // iterate through displayed objects and set size if necessary
417     vtkActorCollection* anActors = GetDevice()->GetActors();
418     anActors->InitTraversal();
419     while(vtkActor* anAct = anActors->GetNextActor()){
420       if(SALOME_Actor* anActor = dynamic_cast<SALOME_Actor*>(anAct)){
421         if(anActor->IsResizable())
422           anActor->SetSize(0.5*aSize);
423         if(anActor->GetVisibility() && !anActor->IsInfinitive()){
424           vtkFloatingPointType *aBounds = anActor->GetBounds();
425           if(CheckBndBox(aBounds))
426             for(int i = 0; i < 5; i = i + 2){
427               if(aBounds[i] < aNewBndBox[i]) 
428                 aNewBndBox[i] = aBounds[i];
429               if(aBounds[i+1] > aNewBndBox[i+1]) 
430                 aNewBndBox[i+1] = aBounds[i+1];
431             }
432         }
433       }
434     }
435
436     if(aTDisplayed) 
437       myTrihedron->VisibilityOn();
438
439     if(aCDisplayed) 
440       myCubeAxes->VisibilityOn();
441     
442   }else{
443     double aSize = myTrihedron->GetSize();
444     aNewBndBox[0] = aNewBndBox[2] = aNewBndBox[4] = 0;
445     aNewBndBox[1] = aNewBndBox[3] = aNewBndBox[5] = aSize;
446   }
447   
448   if(CheckBndBox(aNewBndBox)){
449     for(int i = 0; i < 6; i++)
450       myBndBox[i] = aNewBndBox[i];
451     myCubeAxes->SetBounds(myBndBox);
452     return true;
453   }
454
455   return false;
456 }
457
458 /*!
459   Adjusts size of actors
460 */
461 void
462 SVTK_Renderer
463 ::AdjustActors()
464 {
465   if(OnAdjustActors())
466     ::ResetCameraClippingRange(GetDevice());
467 }
468
469 /*!
470   Set size of the trihedron
471   \param theSize - new size
472   \param theRelative - if it is true, then size is mesured in percents from bounding box of the scene,
473   otherwise - in viewer units
474 */
475 void
476 SVTK_Renderer
477 ::SetTrihedronSize(vtkFloatingPointType theSize, const bool theRelative)
478 {
479   if(myTrihedronSize != theSize || myIsTrihedronRelative != theRelative){
480     myTrihedronSize = theSize;
481     myIsTrihedronRelative = theRelative;
482     AdjustActors();
483   }
484 }
485
486 /*!
487   \return size of the trihedron in percents from bounding box of the scene
488 */
489 vtkFloatingPointType
490 SVTK_Renderer
491 ::GetTrihedronSize() const
492 {
493   return myTrihedronSize;
494 }
495
496 /*!
497   \return true if the size of the trihedron is relative
498 */
499 bool 
500 SVTK_Renderer
501 ::IsTrihedronRelative() const
502 {
503   return myIsTrihedronRelative;
504 }
505
506 /*!
507   \return trihedron control
508 */
509 VTKViewer_Trihedron* 
510 SVTK_Renderer
511 ::GetTrihedron()
512 {
513   return myTrihedron.GetPointer();
514 }
515
516 /*!
517   \return true if trihedron is displayed
518 */
519 bool
520 SVTK_Renderer
521 ::IsTrihedronDisplayed()
522 {
523   return myTrihedron->GetVisibility() == VTKViewer_Trihedron::eOn;
524 }
525
526 /*!
527   Toggle trihedron visibility
528 */
529 void 
530 SVTK_Renderer
531 ::OnViewTrihedron()
532 {
533   if(IsTrihedronDisplayed())
534     myTrihedron->VisibilityOff();
535   else
536     myTrihedron->VisibilityOn();
537 }
538
539 /*!
540   Adjust size of the trihedron to the bounding box of the scene
541 */
542 void
543 SVTK_Renderer
544 ::OnAdjustTrihedron()
545 {   
546   AdjustActors();
547 }
548
549 /*!
550   \return graduated rules control
551 */
552 SVTK_CubeAxesActor2D* 
553 SVTK_Renderer
554 ::GetCubeAxes()
555 {
556   return myCubeAxes.GetPointer();
557 }
558
559 /*!
560   \return true if graduated rules displayed
561 */
562 bool
563 SVTK_Renderer
564 ::IsCubeAxesDisplayed()
565 {
566   return myCubeAxes->GetVisibility() == 1;
567 }
568
569 /*!
570   Toggle graduated rules visibility
571 */
572 void
573 SVTK_Renderer
574 ::OnViewCubeAxes()
575 {
576   if(IsCubeAxesDisplayed())
577     myCubeAxes->VisibilityOff();
578   else
579     myCubeAxes->VisibilityOn();
580 }
581
582 /*!
583   Adjust size of the graduated rules to the bounding box of the scene
584 */
585 void
586 SVTK_Renderer
587 ::OnAdjustCubeAxes()
588 {   
589   AdjustActors();
590 }
591
592 /*!
593   Sets camera into predefined state
594 */
595 void
596 SVTK_Renderer
597 ::OnResetView()
598 {
599   int aTrihedronIsVisible = IsTrihedronDisplayed();
600   int aCubeAxesIsVisible = IsCubeAxesDisplayed();
601
602   myTrihedron->SetVisibility( VTKViewer_Trihedron::eOnlyLineOn );
603   myCubeAxes->SetVisibility(0);
604
605   ::ResetCamera(GetDevice(),true);  
606   vtkCamera* aCamera = GetDevice()->GetActiveCamera();
607   aCamera->SetPosition(1,-1,1);
608   aCamera->SetViewUp(0,0,1);
609   ::ResetCamera(GetDevice(),true);  
610
611   if(aTrihedronIsVisible) 
612     myTrihedron->VisibilityOn();
613   else
614     myTrihedron->VisibilityOff();
615
616   if(aCubeAxesIsVisible) 
617     myCubeAxes->VisibilityOn();
618   else
619     myCubeAxes->VisibilityOff();
620
621   static vtkFloatingPointType aCoeff = 3.0;
622   aCamera->SetParallelScale(aCoeff*aCamera->GetParallelScale());
623 }
624
625 /*!
626   Fit all presentation in the scene into the window
627 */
628 void
629 SVTK_Renderer
630 ::OnFitAll()
631 {
632   int aTrihedronWasVisible = false;
633   int aCubeAxesWasVisible = false;
634
635   aTrihedronWasVisible = IsTrihedronDisplayed();
636   if(aTrihedronWasVisible)
637     myTrihedron->VisibilityOff();
638
639   aCubeAxesWasVisible = IsCubeAxesDisplayed();
640   if(aCubeAxesWasVisible)
641     myCubeAxes->VisibilityOff();
642
643   if(myTrihedron->GetVisibleActorCount(GetDevice())){
644     myTrihedron->VisibilityOff();
645     myCubeAxes->VisibilityOff();
646     ::ResetCamera(GetDevice());
647   }else{
648     myTrihedron->SetVisibility(VTKViewer_Trihedron::eOnlyLineOn);
649     myCubeAxes->SetVisibility(2);
650     ::ResetCamera(GetDevice(),true);
651   }
652
653   if(aTrihedronWasVisible)
654     myTrihedron->VisibilityOn();
655   else
656     myTrihedron->VisibilityOff();
657   
658   if(aCubeAxesWasVisible)
659     myCubeAxes->VisibilityOn();
660   else
661     myCubeAxes->VisibilityOff();
662
663   ::ResetCameraClippingRange(GetDevice());
664 }
665
666 /*!
667   Reset camera clipping range to adjust the range to the bounding box of the scene
668 */
669 void
670 SVTK_Renderer
671 ::OnResetClippingRange()
672 {
673   return;
674   ::ResetCameraClippingRange(GetDevice());
675 }
676
677 /*!
678   To reset direction of the camera to front view
679 */
680 void
681 SVTK_Renderer
682 ::OnFrontView()
683 {
684   vtkCamera* aCamera = GetDevice()->GetActiveCamera();
685   aCamera->SetPosition(1,0,0);
686   aCamera->SetViewUp(0,0,1);
687   aCamera->SetFocalPoint(0,0,0);
688   this->OnFitAll();
689 }
690
691 /*!
692   To reset direction of the camera to back view
693 */
694 void
695 SVTK_Renderer
696 ::OnBackView()
697 {
698   vtkCamera* aCamera = GetDevice()->GetActiveCamera();
699   aCamera->SetPosition(-1,0,0);
700   aCamera->SetViewUp(0,0,1);
701   aCamera->SetFocalPoint(0,0,0);
702   this->OnFitAll();
703 }
704
705 /*!
706   To reset direction of the camera to top view
707 */
708 void
709 SVTK_Renderer
710 ::OnTopView()
711 {
712   vtkCamera* aCamera = GetDevice()->GetActiveCamera();
713   aCamera->SetPosition(0,0,1);
714   aCamera->SetViewUp(0,1,0);
715   aCamera->SetFocalPoint(0,0,0);
716   this->OnFitAll();
717 }
718
719 /*!
720   To reset direction of the camera to bottom view
721 */
722 void
723 SVTK_Renderer
724 ::OnBottomView()
725 {
726   vtkCamera* aCamera = GetDevice()->GetActiveCamera();
727   aCamera->SetPosition(0,0,-1);
728   aCamera->SetViewUp(0,1,0);
729   aCamera->SetFocalPoint(0,0,0);
730   this->OnFitAll();
731 }
732
733 /*!
734   To reset direction of the camera to left view
735 */
736 void
737 SVTK_Renderer
738 ::OnLeftView()
739 {
740   vtkCamera* aCamera = GetDevice()->GetActiveCamera(); 
741   aCamera->SetPosition(0,-1,0);
742   aCamera->SetViewUp(0,0,1);
743   aCamera->SetFocalPoint(0,0,0);
744   this->OnFitAll();
745 }
746
747 /*!
748   To reset direction of the camera to right view
749 */
750 void
751 SVTK_Renderer
752 ::OnRightView()
753 {
754   vtkCamera* aCamera = GetDevice()->GetActiveCamera();
755   aCamera->SetPosition(0,1,0);
756   aCamera->SetViewUp(0,0,1);
757   aCamera->SetFocalPoint(0,0,0);
758   this->OnFitAll();
759 }