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