Salome HOME
Implement generic "Dump view" method to be used by all views (toolbar & context menu)
[modules/gui.git] / src / VTKViewer / VTKViewer_ViewWindow.cxx
1 #include "VTKViewer_ViewWindow.h"
2 #include "VTKViewer_ViewModel.h"
3 #include "VTKViewer_RenderWindow.h"
4 #include "VTKViewer_RenderWindowInteractor.h"
5 #include "VTKViewer_InteractorStyle.h"
6 #include "VTKViewer_Trihedron.h"
7 #include "VTKViewer_Transform.h"
8 #include "VTKViewer_Utilities.h"
9
10 #include "SUIT_Session.h"
11 #include "SUIT_ToolButton.h"
12 #include "SUIT_MessageBox.h"
13
14 #include "SUIT_Tools.h"
15 #include "SUIT_ResourceMgr.h"
16
17 #include <qapplication.h>
18
19 #include <vtkRenderer.h>
20 #include <vtkCamera.h>
21
22 //////////////////////////////////////////////////////////////////////
23 // Construction/Destruction
24 //////////////////////////////////////////////////////////////////////
25 VTKViewer_ViewWindow::VTKViewer_ViewWindow( SUIT_Desktop* theDesktop, 
26                                             VTKViewer_Viewer* theModel,
27                                             VTKViewer_InteractorStyle* iStyle,
28                                             VTKViewer_RenderWindowInteractor* rw )
29 : SUIT_ViewWindow( theDesktop )
30 {
31   myModel = theModel;
32
33   myTrihedron = VTKViewer_Trihedron::New();
34   myTransform = VTKViewer_Transform::New();
35   myRenderer  = vtkRenderer::New() ;
36
37   myTrihedron->AddToRender( myRenderer );
38
39   myRenderWindow = new VTKViewer_RenderWindow( this, "RenderWindow" );
40   setCentralWidget(myRenderWindow);
41   myRenderWindow->setFocusPolicy( StrongFocus );
42   myRenderWindow->setFocus();
43
44   myRenderWindow->getRenderWindow()->AddRenderer( myRenderer );
45
46   myRenderer->GetActiveCamera()->ParallelProjectionOn();
47   myRenderer->LightFollowCameraOn();
48   myRenderer->TwoSidedLightingOn();
49
50   // Set BackgroundColor
51   QString BgrColorRed   = "0";//SUIT_CONFIG->getSetting("VTKViewer:BackgroundColorRed");
52   QString BgrColorGreen = "0";//SUIT_CONFIG->getSetting("VTKViewer:BackgroundColorGreen");
53   QString BgrColorBlue  = "0";//SUIT_CONFIG->getSetting("VTKViewer:BackgroundColorBlue");
54
55   if( !BgrColorRed.isEmpty() && !BgrColorGreen.isEmpty() && !BgrColorBlue.isEmpty() ) 
56     myRenderer->SetBackground( BgrColorRed.toInt()/255., BgrColorGreen.toInt()/255., BgrColorBlue.toInt()/255. );
57   else
58     myRenderer->SetBackground( 0, 0, 0 );
59   
60   // Create an interactor.
61   myRWInteractor = rw ? rw : VTKViewer_RenderWindowInteractor::New();
62   myRWInteractor->SetRenderWindow( myRenderWindow->getRenderWindow() );
63
64   VTKViewer_InteractorStyle* RWS = iStyle ? iStyle : VTKViewer_InteractorStyle::New();
65   RWS->setGUIWindow( myRenderWindow );
66   myRWInteractor->SetInteractorStyle( RWS ); 
67
68   myRWInteractor->Initialize();
69   RWS->setTriedron( myTrihedron );
70   RWS->FindPokedRenderer( 0, 0 );
71
72   setCentralWidget( myRenderWindow );
73
74   myToolBar = new QToolBar(this);
75   myToolBar->setCloseMode(QDockWindow::Undocked);
76   myToolBar->setLabel(tr("LBL_TOOLBAR_LABEL"));
77
78   createActions();
79   createToolBar();
80
81   connect( myRenderWindow, SIGNAL(KeyPressed( QKeyEvent* )),
82            this,           SLOT(onKeyPressed( QKeyEvent* )) );
83   connect( myRenderWindow, SIGNAL(KeyReleased( QKeyEvent* )),
84            this,           SLOT(onKeyReleased( QKeyEvent* )) );
85   connect( myRenderWindow, SIGNAL(MouseButtonPressed( QMouseEvent* )),
86            this,           SLOT(onMousePressed( QMouseEvent* )) );
87   connect( myRenderWindow, SIGNAL(MouseButtonReleased( QMouseEvent* )),
88            this,           SLOT(onMouseReleased( QMouseEvent* )) );
89   connect( myRenderWindow, SIGNAL(MouseDoubleClicked( QMouseEvent* )),
90            this,           SLOT(onMouseDoubleClicked( QMouseEvent* )) );
91   connect( myRenderWindow, SIGNAL(MouseMove( QMouseEvent* )),
92            this,           SLOT(onMouseMoving( QMouseEvent* )) );
93   connect( myRWInteractor, SIGNAL(RenderWindowModified()),
94            myRenderWindow, SLOT(update()) );
95
96   connect( myRenderWindow, SIGNAL(contextMenuRequested( QContextMenuEvent * )),
97            this,           SIGNAL(contextMenuRequested( QContextMenuEvent * )) );
98
99   connect( myRWInteractor, SIGNAL(contextMenuRequested( QContextMenuEvent * )),
100            this,           SIGNAL(contextMenuRequested( QContextMenuEvent * )) );
101
102
103   onResetView();
104 }
105
106 VTKViewer_ViewWindow::~VTKViewer_ViewWindow()
107 {
108   myTransform->Delete();
109   // In order to ensure that the interactor unregisters
110   // this RenderWindow, we assign a NULL RenderWindow to 
111   // it before deleting it.
112   myRWInteractor->SetRenderWindow( NULL );
113   myRWInteractor->Delete();
114   
115   //m_RW->Delete() ;
116   myRenderer->RemoveAllProps();
117   //m_Renderer->Delete() ;
118   myTrihedron->Delete();
119 }
120
121 bool VTKViewer_ViewWindow::isTrihedronDisplayed(){
122   return myTrihedron->GetVisibility() == VTKViewer_Trihedron::eOn;
123 }
124
125 /*!
126     Activates 'zooming' transformation
127 */
128 void VTKViewer_ViewWindow::activateZoom()
129 {
130   myRWInteractor->GetInteractorStyle()->startZoom();
131 }
132
133 //****************************************************************
134 /*!
135     Activates 'panning' transformation
136 */
137 void VTKViewer_ViewWindow::activatePanning()
138 {
139   myRWInteractor->GetInteractorStyle()->startPan();
140 }
141
142 //****************************************************************
143 /*!
144     Activates 'rotation' transformation
145 */
146 void VTKViewer_ViewWindow::activateRotation()
147 {
148   myRWInteractor->GetInteractorStyle()->startRotate();
149 }
150
151 //****************************************************************
152 void VTKViewer_ViewWindow::activateGlobalPanning()
153 {
154   //if(myTrihedron->GetVisibleActorCount(myRenderer))
155   myRWInteractor->GetInteractorStyle()->startGlobalPan();
156 }
157
158 //****************************************************************
159 /*!
160     Activates 'fit area' transformation
161 */
162 void VTKViewer_ViewWindow::activateWindowFit()
163 {
164   myRWInteractor->GetInteractorStyle()->startFitArea();
165 }
166
167 //****************************************************************
168 void VTKViewer_ViewWindow::createActions()
169 {
170   if (!myActionsMap.isEmpty()) return;
171   
172   SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
173   
174   QtxAction* aAction;
175
176   // Dump view
177   aAction = new QtxAction(tr("MNU_DUMP_VIEW"), aResMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_DUMP" ) ),
178                            tr( "MNU_DUMP_VIEW" ), 0, this);
179   aAction->setStatusTip(tr("DSC_DUMP_VIEW"));
180   connect(aAction, SIGNAL(activated()), this, SLOT(onDumpView()));
181   myActionsMap[ DumpId ] = aAction;
182
183   // FitAll
184   aAction = new QtxAction(tr("MNU_FITALL"), aResMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_FITALL" ) ),
185                            tr( "MNU_FITALL" ), 0, this);
186   aAction->setStatusTip(tr("DSC_FITALL"));
187   connect(aAction, SIGNAL(activated()), this, SLOT(onFitAll()));
188   myActionsMap[ FitAllId ] = aAction;
189
190   // FitRect
191   aAction = new QtxAction(tr("MNU_FITRECT"), aResMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_FITAREA" ) ),
192                            tr( "MNU_FITRECT" ), 0, this);
193   aAction->setStatusTip(tr("DSC_FITRECT"));
194   connect(aAction, SIGNAL(activated()), this, SLOT(activateWindowFit()));
195   myActionsMap[ FitRectId ] = aAction;
196
197   // Zoom
198   aAction = new QtxAction(tr("MNU_ZOOM_VIEW"), aResMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_ZOOM" ) ),
199                            tr( "MNU_ZOOM_VIEW" ), 0, this);
200   aAction->setStatusTip(tr("DSC_ZOOM_VIEW"));
201   connect(aAction, SIGNAL(activated()), this, SLOT(activateZoom()));
202   myActionsMap[ ZoomId ] = aAction;
203
204   // Panning
205   aAction = new QtxAction(tr("MNU_PAN_VIEW"), aResMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_PAN" ) ),
206                            tr( "MNU_PAN_VIEW" ), 0, this);
207   aAction->setStatusTip(tr("DSC_PAN_VIEW"));
208   connect(aAction, SIGNAL(activated()), this, SLOT(activatePanning()));
209   myActionsMap[ PanId ] = aAction;
210
211   // Global Panning
212   aAction = new QtxAction(tr("MNU_GLOBALPAN_VIEW"), aResMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_GLOBALPAN" ) ),
213                            tr( "MNU_GLOBALPAN_VIEW" ), 0, this);
214   aAction->setStatusTip(tr("DSC_GLOBALPAN_VIEW"));
215   connect(aAction, SIGNAL(activated()), this, SLOT(activateGlobalPanning()));
216   myActionsMap[ GlobalPanId ] = aAction;
217
218   // Rotation
219   aAction = new QtxAction(tr("MNU_ROTATE_VIEW"), aResMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_ROTATE" ) ),
220                            tr( "MNU_ROTATE_VIEW" ), 0, this);
221   aAction->setStatusTip(tr("DSC_ROTATE_VIEW"));
222   connect(aAction, SIGNAL(activated()), this, SLOT(activateRotation()));
223   myActionsMap[ RotationId ] = aAction;
224
225   // Projections
226   aAction = new QtxAction(tr("MNU_FRONT_VIEW"), aResMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_FRONT" ) ),
227                            tr( "MNU_FRONT_VIEW" ), 0, this);
228   aAction->setStatusTip(tr("DSC_FRONT_VIEW"));
229   connect(aAction, SIGNAL(activated()), this, SLOT(onFrontView()));
230   myActionsMap[ FrontId ] = aAction;
231
232   aAction = new QtxAction(tr("MNU_BACK_VIEW"), aResMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_BACK" ) ),
233                            tr( "MNU_BACK_VIEW" ), 0, this);
234   aAction->setStatusTip(tr("DSC_BACK_VIEW"));
235   connect(aAction, SIGNAL(activated()), this, SLOT(onBackView()));
236   myActionsMap[ BackId ] = aAction;
237
238   aAction = new QtxAction(tr("MNU_TOP_VIEW"), aResMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_TOP" ) ),
239                            tr( "MNU_TOP_VIEW" ), 0, this);
240   aAction->setStatusTip(tr("DSC_TOP_VIEW"));
241   connect(aAction, SIGNAL(activated()), this, SLOT(onTopView()));
242   myActionsMap[ TopId ] = aAction;
243
244   aAction = new QtxAction(tr("MNU_BOTTOM_VIEW"), aResMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_BOTTOM" ) ),
245                            tr( "MNU_BOTTOM_VIEW" ), 0, this);
246   aAction->setStatusTip(tr("DSC_BOTTOM_VIEW"));
247   connect(aAction, SIGNAL(activated()), this, SLOT(onBottomView()));
248   myActionsMap[ BottomId ] = aAction;
249
250   aAction = new QtxAction(tr("MNU_LEFT_VIEW"), aResMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_LEFT" ) ),
251                            tr( "MNU_LEFT_VIEW" ), 0, this);
252   aAction->setStatusTip(tr("DSC_LEFT_VIEW"));
253   connect(aAction, SIGNAL(activated()), this, SLOT(onLeftView()));
254   myActionsMap[ LeftId ] = aAction;
255
256   aAction = new QtxAction(tr("MNU_RIGHT_VIEW"), aResMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_RIGHT" ) ),
257                            tr( "MNU_RIGHT_VIEW" ), 0, this);
258   aAction->setStatusTip(tr("DSC_RIGHT_VIEW"));
259   connect(aAction, SIGNAL(activated()), this, SLOT(onRightView()));
260   myActionsMap[ RightId ] = aAction;
261
262   // Reset
263   aAction = new QtxAction(tr("MNU_RESET_VIEW"), aResMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_RESET" ) ),
264                            tr( "MNU_RESET_VIEW" ), 0, this);
265   aAction->setStatusTip(tr("DSC_RESET_VIEW"));
266   connect(aAction, SIGNAL(activated()), this, SLOT(onResetView()));
267   myActionsMap[ ResetId ] = aAction;
268
269   aAction = new QtxAction(tr("MNU_SHOW_TRIHEDRON"), aResMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_TRIHEDRON" ) ),
270                            tr( "MNU_SHOW_TRIHEDRON" ), 0, this);
271   aAction->setStatusTip(tr("DSC_SHOW_TRIHEDRON"));
272   connect(aAction, SIGNAL(activated()), this, SLOT(onTrihedronShow()));
273   myActionsMap[ TrihedronShowId ] = aAction;
274 }
275
276 //****************************************************************
277 void VTKViewer_ViewWindow::createToolBar()
278 {
279   myActionsMap[DumpId]->addTo(myToolBar);
280   myActionsMap[TrihedronShowId]->addTo(myToolBar);
281
282   SUIT_ToolButton* aScaleBtn = new SUIT_ToolButton(myToolBar);
283   aScaleBtn->AddAction(myActionsMap[FitAllId]);
284   aScaleBtn->AddAction(myActionsMap[FitRectId]);
285   aScaleBtn->AddAction(myActionsMap[ZoomId]);
286
287   SUIT_ToolButton* aPanningBtn = new SUIT_ToolButton(myToolBar);
288   aPanningBtn->AddAction(myActionsMap[PanId]);
289   aPanningBtn->AddAction(myActionsMap[GlobalPanId]);
290
291   myActionsMap[RotationId]->addTo(myToolBar);
292
293   SUIT_ToolButton* aViewsBtn = new SUIT_ToolButton(myToolBar);
294   aViewsBtn->AddAction(myActionsMap[FrontId]);
295   aViewsBtn->AddAction(myActionsMap[BackId]);
296   aViewsBtn->AddAction(myActionsMap[TopId]);
297   aViewsBtn->AddAction(myActionsMap[BottomId]);
298   aViewsBtn->AddAction(myActionsMap[LeftId]);
299   aViewsBtn->AddAction(myActionsMap[RightId]);
300
301   myActionsMap[ResetId]->addTo(myToolBar);
302 }
303
304 //****************************************************************
305 void VTKViewer_ViewWindow::onFrontView()
306 {
307   vtkCamera* camera = myRenderer->GetActiveCamera();
308   camera->SetPosition(1,0,0);
309   camera->SetViewUp(0,0,1);
310   camera->SetFocalPoint(0,0,0);
311   onFitAll();
312 }
313
314 //****************************************************************
315 void VTKViewer_ViewWindow::onBackView()
316 {
317   vtkCamera* camera = myRenderer->GetActiveCamera();
318   camera->SetPosition(-1,0,0);
319   camera->SetViewUp(0,0,1);
320   camera->SetFocalPoint(0,0,0);
321   onFitAll();
322 }
323
324 //****************************************************************
325 void VTKViewer_ViewWindow::onTopView()
326 {
327   vtkCamera* camera = myRenderer->GetActiveCamera();
328   camera->SetPosition(0,0,1);
329   camera->SetViewUp(0,1,0);
330   camera->SetFocalPoint(0,0,0);
331   onFitAll();
332 }
333
334 //****************************************************************
335 void VTKViewer_ViewWindow::onBottomView()
336 {
337   vtkCamera* camera = myRenderer->GetActiveCamera();
338   camera->SetPosition(0,0,-1);
339   camera->SetViewUp(0,1,0);
340   camera->SetFocalPoint(0,0,0);
341   onFitAll();
342 }
343
344 //****************************************************************
345 void VTKViewer_ViewWindow::onLeftView()
346 {
347   vtkCamera* camera = myRenderer->GetActiveCamera(); 
348   camera->SetPosition(0,-1,0);
349   camera->SetViewUp(0,0,1);
350   camera->SetFocalPoint(0,0,0);
351   onFitAll();
352 }
353
354 //****************************************************************
355 void VTKViewer_ViewWindow::onRightView()
356 {
357   vtkCamera* camera = myRenderer->GetActiveCamera();
358   camera->SetPosition(0,1,0);
359   camera->SetViewUp(0,0,1);
360   camera->SetFocalPoint(0,0,0);
361   onFitAll();
362 }
363
364 //****************************************************************
365 void VTKViewer_ViewWindow::onResetView()
366 {
367   int aTriedronIsVisible = isTrihedronDisplayed();
368   myTrihedron->SetVisibility( VTKViewer_Trihedron::eOnlyLineOn );
369   ::ResetCamera(myRenderer,true);  
370   vtkCamera* aCamera = myRenderer->GetActiveCamera();
371   aCamera->SetPosition(1,-1,1);
372   aCamera->SetViewUp(0,0,1);
373   ::ResetCamera(myRenderer,true);  
374   if(aTriedronIsVisible) myTrihedron->VisibilityOn();
375   else myTrihedron->VisibilityOff();
376   static float aCoeff = 3.0;
377   aCamera->SetParallelScale(aCoeff*aCamera->GetParallelScale());
378   Repaint();
379 }
380
381 //****************************************************************
382 void VTKViewer_ViewWindow::onFitAll()
383 {
384   myRWInteractor->GetInteractorStyle()->ViewFitAll();
385   Repaint();
386 }
387
388 //****************************************************************
389 /*!
390     Set background of the viewport
391 */
392 void VTKViewer_ViewWindow::setBackgroundColor( const QColor& color )
393 {
394   if ( myRenderer )
395     myRenderer->SetBackground( color.red()/255., color.green()/255., color.blue()/255. );
396 }
397
398 //****************************************************************
399 /*!
400     Returns background of the viewport
401 */
402 QColor VTKViewer_ViewWindow::backgroundColor() const
403 {
404   float backint[3];
405   if ( myRenderer ) {
406     myRenderer->GetBackground( backint );
407     return QColor(int(backint[0]*255), int(backint[1]*255), int(backint[2]*255));
408   }
409   return SUIT_ViewWindow::backgroundColor();
410 }
411
412 //****************************************************************
413 void VTKViewer_ViewWindow::Repaint(bool theUpdateTrihedron)
414 {
415   if (theUpdateTrihedron) onAdjustTrihedron();
416   myRenderWindow->update();
417 }
418
419 //****************************************************************
420 void VTKViewer_ViewWindow::GetScale( double theScale[3] ) {
421   myTransform->GetScale( theScale );
422 }
423
424 //****************************************************************
425 void VTKViewer_ViewWindow::SetScale( double theScale[3] ) {
426   myTransform->SetScale( theScale[0], theScale[1], theScale[2] );
427   myRWInteractor->Render();
428   Repaint();
429 }
430
431 //****************************************************************
432 void VTKViewer_ViewWindow::onAdjustTrihedron(){   
433   if( !isTrihedronDisplayed() ) 
434     return;
435   int aVisibleNum = myTrihedron->GetVisibleActorCount(myRenderer);
436   if(aVisibleNum){
437     // calculating diagonal of visible props of the renderer
438     float bnd[6];
439     myTrihedron->VisibilityOff();
440     ::ComputeVisiblePropBounds(myRenderer,bnd);
441     myTrihedron->VisibilityOn();
442     float aLength = 0;
443     static bool CalcByDiag = false;
444     if(CalcByDiag){
445       aLength = sqrt((bnd[1]-bnd[0])*(bnd[1]-bnd[0])+
446                      (bnd[3]-bnd[2])*(bnd[3]-bnd[2])+
447                      (bnd[5]-bnd[4])*(bnd[5]-bnd[4]));
448     }else{
449       aLength = bnd[1]-bnd[0];
450       aLength = max((bnd[3]-bnd[2]),aLength);
451       aLength = max((bnd[5]-bnd[4]),aLength);
452     }
453    
454     static float aSizeInPercents = 105;
455     QString aSetting;// = SUIT_CONFIG->getSetting("Viewer:TrihedronSize");
456     if(!aSetting.isEmpty()) aSizeInPercents = aSetting.toFloat();
457
458     static float EPS_SIZE = 5.0E-3;
459     float aSize = myTrihedron->GetSize();
460     float aNewSize = aLength*aSizeInPercents/100.0;
461     // if the new trihedron size have sufficient difference, then apply the value
462     if(fabs(aNewSize-aSize) > aSize*EPS_SIZE || fabs(aNewSize-aSize) > aNewSize*EPS_SIZE){
463       myTrihedron->SetSize(aNewSize);
464     }
465   }
466   ::ResetCameraClippingRange(myRenderer);
467 }
468
469 //****************************************************************
470 void VTKViewer_ViewWindow::onKeyPressed(QKeyEvent* event)
471 {
472   emit keyPressed( this, event );
473 }
474
475 //****************************************************************
476 void VTKViewer_ViewWindow::onKeyReleased(QKeyEvent* event)
477 {
478   emit keyReleased( this, event );
479 }
480
481 //****************************************************************
482 void VTKViewer_ViewWindow::onMousePressed(QMouseEvent* event)
483 {
484   emit mousePressed(this, event);
485 }
486
487 //****************************************************************
488 void VTKViewer_ViewWindow::onMouseReleased(QMouseEvent* event)
489 {
490   emit mouseReleased( this, event );
491 }
492
493 //****************************************************************
494 void VTKViewer_ViewWindow::onMouseMoving(QMouseEvent* event)
495 {
496   emit mouseMoving( this, event );
497 }
498
499 //****************************************************************
500 void VTKViewer_ViewWindow::onMouseDoubleClicked( QMouseEvent* event )
501 {
502   emit mouseDoubleClicked( this, event );
503 }
504
505 void VTKViewer_ViewWindow::InsertActor( VTKViewer_Actor* theActor, bool theMoveInternalActors ){
506   theActor->AddToRender(myRenderer);
507   theActor->SetTransform(myTransform);
508   if(theMoveInternalActors) 
509     myRWInteractor->MoveInternalActors();
510 }
511
512 void VTKViewer_ViewWindow::AddActor( VTKViewer_Actor* theActor, bool theUpdate /*=false*/ ){
513   InsertActor(theActor);
514   if(theUpdate) 
515     Repaint();
516 }
517
518 void VTKViewer_ViewWindow::RemoveActor( VTKViewer_Actor* theActor, bool theUpdate /*=false*/ ){
519   theActor->RemoveFromRender(myRenderer);
520   if(theUpdate) 
521     Repaint();
522 }
523
524 void VTKViewer_ViewWindow::MoveActor( VTKViewer_Actor* theActor)
525 {
526   RemoveActor(theActor);
527   InsertActor(theActor,true);
528 }
529
530 //****************************************************************
531 void VTKViewer_ViewWindow::onTrihedronShow()
532 {
533   if (isTrihedronDisplayed())
534     myTrihedron->VisibilityOff();
535   else
536     myTrihedron->VisibilityOn();
537   myRenderWindow->update();
538 }
539
540 //****************************************************************
541 QImage VTKViewer_ViewWindow::dumpView()
542 {
543   QPixmap px = QPixmap::grabWindow( myRenderWindow->winId() );
544   return px.convertToImage();
545 }