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