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