1 #include "SALOME_Actor.h"
3 #include <qapplication.h>
5 #include <vtkActorCollection.h>
6 #include <vtkRenderWindow.h>
7 #include <vtkRenderer.h>
10 #include "QtxAction.h"
12 #include "SUIT_Session.h"
13 #include "SUIT_ToolButton.h"
14 #include "SUIT_MessageBox.h"
16 #include "SUIT_Tools.h"
17 #include "SUIT_ResourceMgr.h"
19 #include "VTKViewer_Transform.h"
20 #include "VTKViewer_Utilities.h"
22 #include "SVTK_Trihedron.h"
23 #include "SVTK_ViewWindow.h"
24 #include "SVTK_ViewModel.h"
25 #include "SVTK_RenderWindow.h"
26 #include "SVTK_RenderWindowInteractor.h"
27 #include "SVTK_InteractorStyle.h"
29 #include "SALOME_ListIteratorOfListIO.hxx"
31 #include "SVTK_SelectorDef.h"
33 #include "VTKViewer_Algorithm.h"
34 #include "SVTK_Functor.h"
36 //----------------------------------------------------------------------------
38 ::SVTK_ViewWindow( SUIT_Desktop* theDesktop,
39 SVTK_Viewer* theModel)
40 : SUIT_ViewWindow(theDesktop)
43 mySelector = new SVTK_SelectorDef();
44 connect(this,SIGNAL(selectionChanged()),theModel,SLOT(onSelectionChanged()));
46 myTransform = VTKViewer_Transform::New();
47 myTrihedron = SVTK_Trihedron::New();
48 myRenderer = vtkRenderer::New() ;
50 myTrihedron->AddToRender( myRenderer );
52 myRenderWindow = new SVTK_RenderWindow( this, "RenderWindow" );
53 setCentralWidget(myRenderWindow);
54 myRenderWindow->setFocusPolicy( StrongFocus );
55 myRenderWindow->setFocus();
57 myRenderWindow->getRenderWindow()->AddRenderer( myRenderer );
59 myRenderer->GetActiveCamera()->ParallelProjectionOn();
60 myRenderer->LightFollowCameraOn();
61 myRenderer->TwoSidedLightingOn();
63 // Set BackgroundColor
64 QString BgrColorRed = "0";//SUIT_CONFIG->getSetting("VTKViewer:BackgroundColorRed");
65 QString BgrColorGreen = "0";//SUIT_CONFIG->getSetting("VTKViewer:BackgroundColorGreen");
66 QString BgrColorBlue = "0";//SUIT_CONFIG->getSetting("VTKViewer:BackgroundColorBlue");
68 if( !BgrColorRed.isEmpty() && !BgrColorGreen.isEmpty() && !BgrColorBlue.isEmpty() )
69 myRenderer->SetBackground( BgrColorRed.toInt()/255., BgrColorGreen.toInt()/255., BgrColorBlue.toInt()/255. );
71 myRenderer->SetBackground( 0, 0, 0 );
73 // Create an interactor.
74 myRWInteractor = SVTK_RenderWindowInteractor::New();
75 myRWInteractor->SetRenderWindow( myRenderWindow->getRenderWindow() );
76 myRWInteractor->setViewWindow( this );
78 SVTK_InteractorStyle* RWS = SVTK_InteractorStyle::New();
79 RWS->setGUIWindow( myRenderWindow );
80 RWS->setViewWindow( this );
82 myRWInteractor->SetInteractorStyle( RWS );
83 myRWInteractor->Initialize();
85 RWS->setTriedron( myTrihedron );
86 RWS->FindPokedRenderer( 0, 0 );
88 SetSelectionMode(ActorSelection);
90 setCentralWidget( myRenderWindow );
92 myToolBar = new QToolBar(this);
93 myToolBar->setCloseMode(QDockWindow::Undocked);
94 myToolBar->setLabel(tr("LBL_TOOLBAR_LABEL"));
99 connect( myRenderWindow, SIGNAL(KeyPressed( QKeyEvent* )),
100 this, SLOT(onKeyPressed( QKeyEvent* )) );
101 connect( myRenderWindow, SIGNAL(KeyReleased( QKeyEvent* )),
102 this, SLOT(onKeyReleased( QKeyEvent* )) );
103 connect( myRenderWindow, SIGNAL(MouseButtonPressed( QMouseEvent* )),
104 this, SLOT(onMousePressed( QMouseEvent* )) );
105 connect( myRenderWindow, SIGNAL(MouseButtonReleased( QMouseEvent* )),
106 this, SLOT(onMouseReleased( QMouseEvent* )) );
107 connect( myRenderWindow, SIGNAL(MouseDoubleClicked( QMouseEvent* )),
108 this, SLOT(onMouseDoubleClicked( QMouseEvent* )) );
109 connect( myRenderWindow, SIGNAL(MouseMove( QMouseEvent* )),
110 this, SLOT(onMouseMoving( QMouseEvent* )) );
112 connect( myRWInteractor, SIGNAL(RenderWindowModified()),
113 myRenderWindow, SLOT(update()) );
114 connect( myRWInteractor, SIGNAL(contextMenuRequested( QContextMenuEvent * )),
115 this, SIGNAL(contextMenuRequested( QContextMenuEvent * )) );
120 //----------------------------------------------------------------------------
124 myTransform->Delete();
125 // In order to ensure that the interactor unregisters
126 // this RenderWindow, we assign a NULL RenderWindow to
127 // it before deleting it.
128 myRWInteractor->SetRenderWindow( NULL );
129 myRWInteractor->Delete();
132 myRenderer->RemoveAllProps();
133 //m_Renderer->Delete() ;
134 myTrihedron->Delete();
137 //----------------------------------------------------------------------------
142 myRWInteractor->GetSInteractorStyle()->startZoom();
145 //----------------------------------------------------------------------------
150 myRWInteractor->GetSInteractorStyle()->startPan();
153 //----------------------------------------------------------------------------
158 myRWInteractor->GetSInteractorStyle()->startRotate();
161 //----------------------------------------------------------------------------
164 ::activateGlobalPanning()
166 if(myTrihedron->GetVisibleActorCount(myRenderer))
167 myRWInteractor->GetSInteractorStyle()->startGlobalPan();
170 //----------------------------------------------------------------------------
173 ::activateWindowFit()
175 myRWInteractor->GetSInteractorStyle()->startFitArea();
178 //----------------------------------------------------------------------------
183 if (!myActionsMap.isEmpty()) return;
185 SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
190 aAction = new QtxAction(tr("MNU_DUMP_VIEW"), aResMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_DUMP" ) ),
191 tr( "MNU_DUMP_VIEW" ), 0, this);
192 aAction->setStatusTip(tr("DSC_DUMP_VIEW"));
193 connect(aAction, SIGNAL(activated()), this, SLOT(onDumpView()));
194 myActionsMap[ DumpId ] = aAction;
197 aAction = new QtxAction(tr("MNU_FITALL"), aResMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_FITALL" ) ),
198 tr( "MNU_FITALL" ), 0, this);
199 aAction->setStatusTip(tr("DSC_FITALL"));
200 connect(aAction, SIGNAL(activated()), this, SLOT(onFitAll()));
201 myActionsMap[ FitAllId ] = aAction;
204 aAction = new QtxAction(tr("MNU_FITRECT"), aResMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_FITAREA" ) ),
205 tr( "MNU_FITRECT" ), 0, this);
206 aAction->setStatusTip(tr("DSC_FITRECT"));
207 connect(aAction, SIGNAL(activated()), this, SLOT(activateWindowFit()));
208 myActionsMap[ FitRectId ] = aAction;
211 aAction = new QtxAction(tr("MNU_ZOOM_VIEW"), aResMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_ZOOM" ) ),
212 tr( "MNU_ZOOM_VIEW" ), 0, this);
213 aAction->setStatusTip(tr("DSC_ZOOM_VIEW"));
214 connect(aAction, SIGNAL(activated()), this, SLOT(activateZoom()));
215 myActionsMap[ ZoomId ] = aAction;
218 aAction = new QtxAction(tr("MNU_PAN_VIEW"), aResMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_PAN" ) ),
219 tr( "MNU_PAN_VIEW" ), 0, this);
220 aAction->setStatusTip(tr("DSC_PAN_VIEW"));
221 connect(aAction, SIGNAL(activated()), this, SLOT(activatePanning()));
222 myActionsMap[ PanId ] = aAction;
225 aAction = new QtxAction(tr("MNU_GLOBALPAN_VIEW"), aResMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_GLOBALPAN" ) ),
226 tr( "MNU_GLOBALPAN_VIEW" ), 0, this);
227 aAction->setStatusTip(tr("DSC_GLOBALPAN_VIEW"));
228 connect(aAction, SIGNAL(activated()), this, SLOT(activateGlobalPanning()));
229 myActionsMap[ GlobalPanId ] = aAction;
232 aAction = new QtxAction(tr("MNU_ROTATE_VIEW"), aResMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_ROTATE" ) ),
233 tr( "MNU_ROTATE_VIEW" ), 0, this);
234 aAction->setStatusTip(tr("DSC_ROTATE_VIEW"));
235 connect(aAction, SIGNAL(activated()), this, SLOT(activateRotation()));
236 myActionsMap[ RotationId ] = aAction;
239 aAction = new QtxAction(tr("MNU_FRONT_VIEW"), aResMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_FRONT" ) ),
240 tr( "MNU_FRONT_VIEW" ), 0, this);
241 aAction->setStatusTip(tr("DSC_FRONT_VIEW"));
242 connect(aAction, SIGNAL(activated()), this, SLOT(onFrontView()));
243 myActionsMap[ FrontId ] = aAction;
245 aAction = new QtxAction(tr("MNU_BACK_VIEW"), aResMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_BACK" ) ),
246 tr( "MNU_BACK_VIEW" ), 0, this);
247 aAction->setStatusTip(tr("DSC_BACK_VIEW"));
248 connect(aAction, SIGNAL(activated()), this, SLOT(onBackView()));
249 myActionsMap[ BackId ] = aAction;
251 aAction = new QtxAction(tr("MNU_TOP_VIEW"), aResMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_TOP" ) ),
252 tr( "MNU_TOP_VIEW" ), 0, this);
253 aAction->setStatusTip(tr("DSC_TOP_VIEW"));
254 connect(aAction, SIGNAL(activated()), this, SLOT(onTopView()));
255 myActionsMap[ TopId ] = aAction;
257 aAction = new QtxAction(tr("MNU_BOTTOM_VIEW"), aResMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_BOTTOM" ) ),
258 tr( "MNU_BOTTOM_VIEW" ), 0, this);
259 aAction->setStatusTip(tr("DSC_BOTTOM_VIEW"));
260 connect(aAction, SIGNAL(activated()), this, SLOT(onBottomView()));
261 myActionsMap[ BottomId ] = aAction;
263 aAction = new QtxAction(tr("MNU_LEFT_VIEW"), aResMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_LEFT" ) ),
264 tr( "MNU_LEFT_VIEW" ), 0, this);
265 aAction->setStatusTip(tr("DSC_LEFT_VIEW"));
266 connect(aAction, SIGNAL(activated()), this, SLOT(onLeftView()));
267 myActionsMap[ LeftId ] = aAction;
269 aAction = new QtxAction(tr("MNU_RIGHT_VIEW"), aResMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_RIGHT" ) ),
270 tr( "MNU_RIGHT_VIEW" ), 0, this);
271 aAction->setStatusTip(tr("DSC_RIGHT_VIEW"));
272 connect(aAction, SIGNAL(activated()), this, SLOT(onRightView()));
273 myActionsMap[ RightId ] = aAction;
276 aAction = new QtxAction(tr("MNU_RESET_VIEW"), aResMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_RESET" ) ),
277 tr( "MNU_RESET_VIEW" ), 0, this);
278 aAction->setStatusTip(tr("DSC_RESET_VIEW"));
279 connect(aAction, SIGNAL(activated()), this, SLOT(onResetView()));
280 myActionsMap[ ResetId ] = aAction;
282 // onViewTrihedron: Shows - Hides Trihedron
283 aAction = new QtxAction(tr("MNU_SHOW_TRIHEDRON"), aResMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_TRIHEDRON" ) ),
284 tr( "MNU_SHOW_TRIHEDRON" ), 0, this);
285 aAction->setStatusTip(tr("DSC_SHOW_TRIHEDRON"));
286 connect(aAction, SIGNAL(activated()), this, SLOT(onViewTrihedron()));
287 myActionsMap[ ViewTrihedronId ] = aAction;
290 //----------------------------------------------------------------------------
295 myActionsMap[DumpId]->addTo(myToolBar);
296 myActionsMap[ViewTrihedronId]->addTo(myToolBar);
298 SUIT_ToolButton* aScaleBtn = new SUIT_ToolButton(myToolBar);
299 aScaleBtn->AddAction(myActionsMap[FitAllId]);
300 aScaleBtn->AddAction(myActionsMap[FitRectId]);
301 aScaleBtn->AddAction(myActionsMap[ZoomId]);
303 SUIT_ToolButton* aPanningBtn = new SUIT_ToolButton(myToolBar);
304 aPanningBtn->AddAction(myActionsMap[PanId]);
305 aPanningBtn->AddAction(myActionsMap[GlobalPanId]);
307 myActionsMap[RotationId]->addTo(myToolBar);
309 SUIT_ToolButton* aViewsBtn = new SUIT_ToolButton(myToolBar);
310 aViewsBtn->AddAction(myActionsMap[FrontId]);
311 aViewsBtn->AddAction(myActionsMap[BackId]);
312 aViewsBtn->AddAction(myActionsMap[TopId]);
313 aViewsBtn->AddAction(myActionsMap[BottomId]);
314 aViewsBtn->AddAction(myActionsMap[LeftId]);
315 aViewsBtn->AddAction(myActionsMap[RightId]);
317 myActionsMap[ResetId]->addTo(myToolBar);
320 //----------------------------------------------------------------------------
325 vtkCamera* camera = myRenderer->GetActiveCamera();
326 camera->SetPosition(1,0,0);
327 camera->SetViewUp(0,0,1);
328 camera->SetFocalPoint(0,0,0);
332 //----------------------------------------------------------------------------
337 vtkCamera* camera = myRenderer->GetActiveCamera();
338 camera->SetPosition(-1,0,0);
339 camera->SetViewUp(0,0,1);
340 camera->SetFocalPoint(0,0,0);
344 //----------------------------------------------------------------------------
349 vtkCamera* camera = myRenderer->GetActiveCamera();
350 camera->SetPosition(0,0,1);
351 camera->SetViewUp(0,1,0);
352 camera->SetFocalPoint(0,0,0);
356 //----------------------------------------------------------------------------
361 vtkCamera* camera = myRenderer->GetActiveCamera();
362 camera->SetPosition(0,0,-1);
363 camera->SetViewUp(0,1,0);
364 camera->SetFocalPoint(0,0,0);
368 //----------------------------------------------------------------------------
373 vtkCamera* camera = myRenderer->GetActiveCamera();
374 camera->SetPosition(0,-1,0);
375 camera->SetViewUp(0,0,1);
376 camera->SetFocalPoint(0,0,0);
380 //----------------------------------------------------------------------------
385 vtkCamera* camera = myRenderer->GetActiveCamera();
386 camera->SetPosition(0,1,0);
387 camera->SetViewUp(0,0,1);
388 camera->SetFocalPoint(0,0,0);
392 //----------------------------------------------------------------------------
397 int aTrihedronIsVisible = isTrihedronDisplayed();
398 myTrihedron->SetVisibility( VTKViewer_Trihedron::eOnlyLineOn );
399 ::ResetCamera(myRenderer,true);
400 vtkCamera* aCamera = myRenderer->GetActiveCamera();
401 aCamera->SetPosition(1,-1,1);
402 aCamera->SetViewUp(0,0,1);
403 ::ResetCamera(myRenderer,true);
404 if(aTrihedronIsVisible) myTrihedron->VisibilityOn();
405 else myTrihedron->VisibilityOff();
406 static float aCoeff = 3.0;
407 aCamera->SetParallelScale(aCoeff*aCamera->GetParallelScale());
411 //----------------------------------------------------------------------------
416 myRWInteractor->GetSInteractorStyle()->ViewFitAll();
420 //----------------------------------------------------------------
423 ::onSelectionChanged()
427 const SALOME_ListIO& aListIO = mySelector->StoredIObjects();
428 SALOME_ListIteratorOfListIO anIter(aListIO);
429 for(; anIter.More(); anIter.Next()){
430 highlight(anIter.Value(),true,!anIter.More());
433 emit selectionChanged();
436 //----------------------------------------------------------------
439 ::SetSelectionMode(Selection_Mode theMode)
441 mySelector->SetSelectionMode(theMode);
442 myRWInteractor->SetSelectionMode(theMode);
445 //----------------------------------------------------------------
448 ::SelectionMode() const
450 return mySelector->SelectionMode();
453 //----------------------------------------------------------------
458 myRWInteractor->unHighlightAll();
461 //----------------------------------------------------------------
464 ::highlight( const Handle(SALOME_InteractiveObject)& theIO,
468 myRWInteractor->highlight(theIO, theIsHighlight, theIsUpdate);
470 if(mySelector->HasIndex(theIO) && theIO->hasEntry()){
471 TColStd_IndexedMapOfInteger aMapIndex;
472 mySelector->GetIndex(theIO,aMapIndex);
474 const char* anEntry = theIO->getEntry();
475 vtkActorCollection* aCollection = myRenderer->GetActors();
476 if(SALOME_Actor* anActor = Find<SALOME_Actor>(aCollection,TIsSameEntry<SALOME_Actor>(anEntry))){
477 switch (mySelector->SelectionMode()) {
479 myRWInteractor->highlightPoint(aMapIndex,anActor,theIsHighlight,theIsUpdate);
481 case EdgeOfCellSelection:
482 myRWInteractor->highlightEdge(aMapIndex,anActor,theIsHighlight,theIsUpdate);
487 case VolumeSelection:
488 myRWInteractor->highlightCell(aMapIndex,anActor,theIsHighlight,theIsUpdate);
493 myRWInteractor->unHighlightSubSelection();
497 //----------------------------------------------------------------
500 ::isInViewer( const Handle(SALOME_InteractiveObject)& theIO )
502 return myRWInteractor->isInViewer( theIO );
505 //----------------------------------------------------------------
508 ::isVisible( const Handle(SALOME_InteractiveObject)& theIO )
510 return myRWInteractor->isVisible( theIO );
513 //----------------------------------------------------------------------------
516 ::setBackgroundColor( const QColor& color )
519 myRenderer->SetBackground( color.red()/255., color.green()/255., color.blue()/255. );
522 //----------------------------------------------------------------------------
525 ::backgroundColor() const
529 myRenderer->GetBackground( backint );
530 return QColor(int(backint[0]*255), int(backint[1]*255), int(backint[2]*255));
532 return SUIT_ViewWindow::backgroundColor();
535 //----------------------------------------------------------------------------
538 ::Repaint(bool theUpdateTrihedron)
540 if (theUpdateTrihedron)
542 myRenderWindow->update();
545 //----------------------------------------------------------------------------
548 ::GetScale( double theScale[3] )
550 myTransform->GetScale( theScale );
553 //----------------------------------------------------------------------------
556 ::SetScale( double theScale[3] )
558 myTransform->SetScale( theScale[0], theScale[1], theScale[2] );
559 myRWInteractor->Render();
563 //----------------------------------------------------------------------------
566 ::isTrihedronDisplayed()
568 return myTrihedron->GetVisibility() == VTKViewer_Trihedron::eOn;
571 //----------------------------------------------------------------------------
579 if(isTrihedronDisplayed())
580 myTrihedron->VisibilityOff();
582 myTrihedron->VisibilityOn();
587 //----------------------------------------------------------------------------
590 ::ComputeTrihedronSize( double& theNewSize, double& theSize )
592 // calculating diagonal of visible props of the renderer
594 myTrihedron->VisibilityOff();
596 if ( ::ComputeVisiblePropBounds( myRenderer, aBndBox ) == 0 ) {
597 aBndBox[ 1 ] = aBndBox[ 3 ] = aBndBox[ 5 ] = 100;
598 aBndBox[ 0 ] = aBndBox[ 2 ] = aBndBox[ 4 ] = 0;
601 myTrihedron->VisibilityOn();
603 static bool aCalcByDiag = false;
605 aLength = sqrt( ( aBndBox[1]-aBndBox[0])*(aBndBox[1]-aBndBox[0] )+
606 ( aBndBox[3]-aBndBox[2])*(aBndBox[3]-aBndBox[2] )+
607 ( aBndBox[5]-aBndBox[4])*(aBndBox[5]-aBndBox[4] ) );
609 aLength = aBndBox[ 1 ]-aBndBox[ 0 ];
610 aLength = max( ( aBndBox[ 3 ] - aBndBox[ 2 ] ),aLength );
611 aLength = max( ( aBndBox[ 5 ] - aBndBox[ 4 ] ),aLength );
614 static float aSizeInPercents = 105;
615 //QString aSetting = QAD_CONFIG->getSetting( "Viewer:TrihedronSize" );
616 //if ( !aSetting.isEmpty() )
617 // aSizeInPercents = aSetting.toFloat();
619 static float EPS_SIZE = 5.0E-3;
620 theSize = myTrihedron->GetSize();
621 theNewSize = aLength * aSizeInPercents / 100.0;
623 // if the new trihedron size have sufficient difference, then apply the value
624 return fabs( theNewSize - theSize) > theSize * EPS_SIZE ||
625 fabs( theNewSize-theSize ) > theNewSize * EPS_SIZE;
628 //----------------------------------------------------------------------------
631 ::GetTrihedronSize() const
633 return myTrihedron->GetSize();
636 //----------------------------------------------------------------------------
639 ::AdjustTrihedrons( const bool theIsForcedUpdate )
641 if ( !isTrihedronDisplayed() && !theIsForcedUpdate )
644 int aVisibleNum = myTrihedron->GetVisibleActorCount( myRenderer );
645 if ( aVisibleNum || theIsForcedUpdate ) {
646 // if the new trihedron size have sufficient difference, then apply the value
647 double aNewSize = 100, anOldSize;
648 if ( ComputeTrihedronSize( aNewSize, anOldSize ) || theIsForcedUpdate ) {
649 myTrihedron->SetSize( aNewSize );
650 // itearte throuh displayed objects and set size if necessary
652 vtkActorCollection* anActors = getRenderer()->GetActors();
653 anActors->InitTraversal();
654 while( vtkActor* anActor = anActors->GetNextActor() ) {
655 if( SALOME_Actor* aSActor = SALOME_Actor::SafeDownCast( anActor ) ) {
656 if ( aSActor->IsResizable() )
657 aSActor->SetSize( 0.5 * aNewSize );
663 ::ResetCameraClippingRange(myRenderer);
666 //----------------------------------------------------------------------------
669 ::onAdjustTrihedron()
671 AdjustTrihedrons( false );
674 #define INCREMENT_FOR_OP 10
676 //=======================================================================
678 // Purpose : Performs incremental panning to the left
679 //=======================================================================
684 myRWInteractor->GetSInteractorStyle()->IncrementalPan( -INCREMENT_FOR_OP, 0 );
687 //=======================================================================
689 // Purpose : Performs incremental panning to the right
690 //=======================================================================
695 myRWInteractor->GetSInteractorStyle()->IncrementalPan( INCREMENT_FOR_OP, 0 );
698 //=======================================================================
700 // Purpose : Performs incremental panning to the top
701 //=======================================================================
706 myRWInteractor->GetSInteractorStyle()->IncrementalPan( 0, INCREMENT_FOR_OP );
709 //=======================================================================
711 // Purpose : Performs incremental panning to the bottom
712 //=======================================================================
717 myRWInteractor->GetSInteractorStyle()->IncrementalPan( 0, -INCREMENT_FOR_OP );
720 //=======================================================================
722 // Purpose : Performs incremental zooming in
723 //=======================================================================
728 myRWInteractor->GetSInteractorStyle()->IncrementalZoom( INCREMENT_FOR_OP );
731 //=======================================================================
733 // Purpose : Performs incremental zooming out
734 //=======================================================================
739 myRWInteractor->GetSInteractorStyle()->IncrementalZoom( -INCREMENT_FOR_OP );
742 //=======================================================================
743 // name : onRotateLeft
744 // Purpose : Performs incremental rotating to the left
745 //=======================================================================
750 myRWInteractor->GetSInteractorStyle()->IncrementalRotate( -INCREMENT_FOR_OP, 0 );
753 //=======================================================================
754 // name : onRotateRight
755 // Purpose : Performs incremental rotating to the right
756 //=======================================================================
761 myRWInteractor->GetSInteractorStyle()->IncrementalRotate( INCREMENT_FOR_OP, 0 );
764 //=======================================================================
766 // Purpose : Performs incremental rotating to the top
767 //=======================================================================
772 myRWInteractor->GetSInteractorStyle()->IncrementalRotate( 0, -INCREMENT_FOR_OP );
775 //=======================================================================
778 ::onKeyPressed(QKeyEvent* event)
780 emit keyPressed( this, event );
783 //=======================================================================
786 ::onKeyReleased(QKeyEvent* event)
788 emit keyReleased( this, event );
791 //=======================================================================
794 ::onMousePressed(QMouseEvent* event)
796 emit mousePressed(this, event);
799 //=======================================================================
802 ::onMouseReleased(QMouseEvent* event)
804 emit mouseReleased( this, event );
807 //=======================================================================
810 ::onMouseMoving(QMouseEvent* event)
812 emit mouseMoving( this, event );
815 //=======================================================================
818 ::onMouseDoubleClicked( QMouseEvent* event )
820 emit mouseDoubleClicked( this, event );
823 //=======================================================================
824 // name : onRotateDown
825 // Purpose : Performs incremental rotating to the bottom
826 //=======================================================================
831 myRWInteractor->GetSInteractorStyle()->IncrementalRotate( 0, INCREMENT_FOR_OP );
834 //----------------------------------------------------------------------------
837 ::InsertActor( SALOME_Actor* theActor, bool theMoveInternalActors )
839 theActor->AddToRender(myRenderer);
840 theActor->SetTransform(myTransform);
841 if(theMoveInternalActors)
842 myRWInteractor->MoveInternalActors();
845 //----------------------------------------------------------------------------
848 ::AddActor( SALOME_Actor* theActor, bool theUpdate /*=false*/ )
850 InsertActor(theActor);
855 //----------------------------------------------------------------------------
858 ::RemoveActor( SALOME_Actor* theActor, bool theUpdate /*=false*/ )
860 theActor->RemoveFromRender(myRenderer);
865 //----------------------------------------------------------------------------
868 ::MoveActor( SALOME_Actor* theActor)
870 RemoveActor(theActor);
871 InsertActor(theActor,true);
874 //----------------------------------------------------------------------------
879 QPixmap px = QPixmap::grabWindow( myRenderWindow->winId() );
880 return px.convertToImage();