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