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"
18 #include "SUIT_FileDlg.h"
20 #include "VTKViewer_Transform.h"
21 #include "VTKViewer_Utilities.h"
23 #include "SVTK_Trihedron.h"
24 #include "SVTK_Selector.h"
25 #include "SVTK_ViewWindow.h"
26 #include "SVTK_ViewModel.h"
27 #include "SVTK_RenderWindow.h"
28 #include "SVTK_RenderWindowInteractor.h"
29 #include "SVTK_InteractorStyle.h"
31 #include "SALOME_ListIteratorOfListIO.hxx"
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_Selector();
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() );
77 SVTK_InteractorStyle* RWS = SVTK_InteractorStyle::New();
78 RWS->setGUIWindow( myRenderWindow );
79 RWS->setViewWindow( this );
80 myRWInteractor->SetInteractorStyle( RWS );
82 myRWInteractor->Initialize();
83 RWS->setTriedron( myTrihedron );
84 RWS->FindPokedRenderer( 0, 0 );
86 SetSelectionMode(ActorSelection);
88 setCentralWidget( myRenderWindow );
90 myToolBar = new QToolBar(this);
91 myToolBar->setCloseMode(QDockWindow::Undocked);
92 myToolBar->setLabel(tr("LBL_TOOLBAR_LABEL"));
97 connect( myRenderWindow, SIGNAL(KeyPressed( QKeyEvent* )),
98 this, SLOT(onKeyPressed( QKeyEvent* )) );
99 connect( myRenderWindow, SIGNAL(KeyReleased( QKeyEvent* )),
100 this, SLOT(onKeyReleased( QKeyEvent* )) );
101 connect( myRenderWindow, SIGNAL(MouseButtonPressed( QMouseEvent* )),
102 this, SLOT(onMousePressed( QMouseEvent* )) );
103 connect( myRenderWindow, SIGNAL(MouseButtonReleased( QMouseEvent* )),
104 this, SLOT(onMouseReleased( QMouseEvent* )) );
105 connect( myRenderWindow, SIGNAL(MouseDoubleClicked( QMouseEvent* )),
106 this, SLOT(onMouseDoubleClicked( QMouseEvent* )) );
107 connect( myRenderWindow, SIGNAL(MouseMove( QMouseEvent* )),
108 this, SLOT(onMouseMoving( QMouseEvent* )) );
110 connect( myRWInteractor, SIGNAL(RenderWindowModified()),
111 myRenderWindow, SLOT(update()) );
112 connect( myRWInteractor, SIGNAL(contextMenuRequested( QContextMenuEvent * )),
113 this, SIGNAL(contextMenuRequested( QContextMenuEvent * )) );
118 //----------------------------------------------------------------------------
122 myTransform->Delete();
123 // In order to ensure that the interactor unregisters
124 // this RenderWindow, we assign a NULL RenderWindow to
125 // it before deleting it.
126 myRWInteractor->SetRenderWindow( NULL );
127 myRWInteractor->Delete();
130 myRenderer->RemoveAllProps();
131 //m_Renderer->Delete() ;
132 myTrihedron->Delete();
135 //----------------------------------------------------------------------------
140 myRWInteractor->GetSInteractorStyle()->startZoom();
143 //----------------------------------------------------------------------------
148 myRWInteractor->GetSInteractorStyle()->startPan();
151 //----------------------------------------------------------------------------
156 myRWInteractor->GetSInteractorStyle()->startRotate();
159 //----------------------------------------------------------------------------
162 ::activateGlobalPanning()
164 if(myTrihedron->GetVisibleActorCount(myRenderer))
165 myRWInteractor->GetSInteractorStyle()->startGlobalPan();
168 //----------------------------------------------------------------------------
171 ::activateWindowFit()
173 myRWInteractor->GetSInteractorStyle()->startFitArea();
176 //----------------------------------------------------------------------------
181 if (!myActionsMap.isEmpty()) return;
183 SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
188 aAction = new QtxAction(tr("MNU_DUMP_VIEW"), aResMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_DUMP" ) ),
189 tr( "MNU_DUMP_VIEW" ), 0, this);
190 aAction->setStatusTip(tr("DSC_DUMP_VIEW"));
191 connect(aAction, SIGNAL(activated()), this, SLOT(onDumpView()));
192 myActionsMap[ DumpId ] = aAction;
195 aAction = new QtxAction(tr("MNU_FITALL"), aResMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_FITALL" ) ),
196 tr( "MNU_FITALL" ), 0, this);
197 aAction->setStatusTip(tr("DSC_FITALL"));
198 connect(aAction, SIGNAL(activated()), this, SLOT(onFitAll()));
199 myActionsMap[ FitAllId ] = aAction;
202 aAction = new QtxAction(tr("MNU_FITRECT"), aResMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_FITAREA" ) ),
203 tr( "MNU_FITRECT" ), 0, this);
204 aAction->setStatusTip(tr("DSC_FITRECT"));
205 connect(aAction, SIGNAL(activated()), this, SLOT(activateWindowFit()));
206 myActionsMap[ FitRectId ] = aAction;
209 aAction = new QtxAction(tr("MNU_ZOOM_VIEW"), aResMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_ZOOM" ) ),
210 tr( "MNU_ZOOM_VIEW" ), 0, this);
211 aAction->setStatusTip(tr("DSC_ZOOM_VIEW"));
212 connect(aAction, SIGNAL(activated()), this, SLOT(activateZoom()));
213 myActionsMap[ ZoomId ] = aAction;
216 aAction = new QtxAction(tr("MNU_PAN_VIEW"), aResMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_PAN" ) ),
217 tr( "MNU_PAN_VIEW" ), 0, this);
218 aAction->setStatusTip(tr("DSC_PAN_VIEW"));
219 connect(aAction, SIGNAL(activated()), this, SLOT(activatePanning()));
220 myActionsMap[ PanId ] = aAction;
223 aAction = new QtxAction(tr("MNU_GLOBALPAN_VIEW"), aResMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_GLOBALPAN" ) ),
224 tr( "MNU_GLOBALPAN_VIEW" ), 0, this);
225 aAction->setStatusTip(tr("DSC_GLOBALPAN_VIEW"));
226 connect(aAction, SIGNAL(activated()), this, SLOT(activateGlobalPanning()));
227 myActionsMap[ GlobalPanId ] = aAction;
230 aAction = new QtxAction(tr("MNU_ROTATE_VIEW"), aResMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_ROTATE" ) ),
231 tr( "MNU_ROTATE_VIEW" ), 0, this);
232 aAction->setStatusTip(tr("DSC_ROTATE_VIEW"));
233 connect(aAction, SIGNAL(activated()), this, SLOT(activateRotation()));
234 myActionsMap[ RotationId ] = aAction;
237 aAction = new QtxAction(tr("MNU_FRONT_VIEW"), aResMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_FRONT" ) ),
238 tr( "MNU_FRONT_VIEW" ), 0, this);
239 aAction->setStatusTip(tr("DSC_FRONT_VIEW"));
240 connect(aAction, SIGNAL(activated()), this, SLOT(onFrontView()));
241 myActionsMap[ FrontId ] = aAction;
243 aAction = new QtxAction(tr("MNU_BACK_VIEW"), aResMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_BACK" ) ),
244 tr( "MNU_BACK_VIEW" ), 0, this);
245 aAction->setStatusTip(tr("DSC_BACK_VIEW"));
246 connect(aAction, SIGNAL(activated()), this, SLOT(onBackView()));
247 myActionsMap[ BackId ] = aAction;
249 aAction = new QtxAction(tr("MNU_TOP_VIEW"), aResMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_TOP" ) ),
250 tr( "MNU_TOP_VIEW" ), 0, this);
251 aAction->setStatusTip(tr("DSC_TOP_VIEW"));
252 connect(aAction, SIGNAL(activated()), this, SLOT(onTopView()));
253 myActionsMap[ TopId ] = aAction;
255 aAction = new QtxAction(tr("MNU_BOTTOM_VIEW"), aResMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_BOTTOM" ) ),
256 tr( "MNU_BOTTOM_VIEW" ), 0, this);
257 aAction->setStatusTip(tr("DSC_BOTTOM_VIEW"));
258 connect(aAction, SIGNAL(activated()), this, SLOT(onBottomView()));
259 myActionsMap[ BottomId ] = aAction;
261 aAction = new QtxAction(tr("MNU_LEFT_VIEW"), aResMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_LEFT" ) ),
262 tr( "MNU_LEFT_VIEW" ), 0, this);
263 aAction->setStatusTip(tr("DSC_LEFT_VIEW"));
264 connect(aAction, SIGNAL(activated()), this, SLOT(onLeftView()));
265 myActionsMap[ LeftId ] = aAction;
267 aAction = new QtxAction(tr("MNU_RIGHT_VIEW"), aResMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_RIGHT" ) ),
268 tr( "MNU_RIGHT_VIEW" ), 0, this);
269 aAction->setStatusTip(tr("DSC_RIGHT_VIEW"));
270 connect(aAction, SIGNAL(activated()), this, SLOT(onRightView()));
271 myActionsMap[ RightId ] = aAction;
274 aAction = new QtxAction(tr("MNU_RESET_VIEW"), aResMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_RESET" ) ),
275 tr( "MNU_RESET_VIEW" ), 0, this);
276 aAction->setStatusTip(tr("DSC_RESET_VIEW"));
277 connect(aAction, SIGNAL(activated()), this, SLOT(onResetView()));
278 myActionsMap[ ResetId ] = aAction;
281 //----------------------------------------------------------------------------
286 myActionsMap[DumpId]->addTo(myToolBar);
288 SUIT_ToolButton* aScaleBtn = new SUIT_ToolButton(myToolBar);
289 aScaleBtn->AddAction(myActionsMap[FitAllId]);
290 aScaleBtn->AddAction(myActionsMap[FitRectId]);
291 aScaleBtn->AddAction(myActionsMap[ZoomId]);
293 SUIT_ToolButton* aPanningBtn = new SUIT_ToolButton(myToolBar);
294 aPanningBtn->AddAction(myActionsMap[PanId]);
295 aPanningBtn->AddAction(myActionsMap[GlobalPanId]);
297 myActionsMap[RotationId]->addTo(myToolBar);
299 SUIT_ToolButton* aViewsBtn = new SUIT_ToolButton(myToolBar);
300 aViewsBtn->AddAction(myActionsMap[FrontId]);
301 aViewsBtn->AddAction(myActionsMap[BackId]);
302 aViewsBtn->AddAction(myActionsMap[TopId]);
303 aViewsBtn->AddAction(myActionsMap[BottomId]);
304 aViewsBtn->AddAction(myActionsMap[LeftId]);
305 aViewsBtn->AddAction(myActionsMap[RightId]);
307 myActionsMap[ResetId]->addTo(myToolBar);
310 //----------------------------------------------------------------------------
315 vtkCamera* camera = myRenderer->GetActiveCamera();
316 camera->SetPosition(1,0,0);
317 camera->SetViewUp(0,0,1);
318 camera->SetFocalPoint(0,0,0);
322 //----------------------------------------------------------------------------
327 vtkCamera* camera = myRenderer->GetActiveCamera();
328 camera->SetPosition(-1,0,0);
329 camera->SetViewUp(0,0,1);
330 camera->SetFocalPoint(0,0,0);
334 //----------------------------------------------------------------------------
339 vtkCamera* camera = myRenderer->GetActiveCamera();
340 camera->SetPosition(0,0,1);
341 camera->SetViewUp(0,1,0);
342 camera->SetFocalPoint(0,0,0);
346 //----------------------------------------------------------------------------
351 vtkCamera* camera = myRenderer->GetActiveCamera();
352 camera->SetPosition(0,0,-1);
353 camera->SetViewUp(0,1,0);
354 camera->SetFocalPoint(0,0,0);
358 //----------------------------------------------------------------------------
363 vtkCamera* camera = myRenderer->GetActiveCamera();
364 camera->SetPosition(0,-1,0);
365 camera->SetViewUp(0,0,1);
366 camera->SetFocalPoint(0,0,0);
370 //----------------------------------------------------------------------------
375 vtkCamera* camera = myRenderer->GetActiveCamera();
376 camera->SetPosition(0,1,0);
377 camera->SetViewUp(0,0,1);
378 camera->SetFocalPoint(0,0,0);
382 //----------------------------------------------------------------------------
387 int aTrihedronIsVisible = isTrihedronDisplayed();
388 myTrihedron->SetVisibility( VTKViewer_Trihedron::eOnlyLineOn );
389 ::ResetCamera(myRenderer,true);
390 vtkCamera* aCamera = myRenderer->GetActiveCamera();
391 aCamera->SetPosition(1,-1,1);
392 aCamera->SetViewUp(0,0,1);
393 ::ResetCamera(myRenderer,true);
394 if(aTrihedronIsVisible) myTrihedron->VisibilityOn();
395 else myTrihedron->VisibilityOff();
396 static float aCoeff = 3.0;
397 aCamera->SetParallelScale(aCoeff*aCamera->GetParallelScale());
401 //----------------------------------------------------------------------------
406 myRWInteractor->GetSInteractorStyle()->ViewFitAll();
410 //----------------------------------------------------------------------------
415 QApplication::setOverrideCursor( Qt::waitCursor );
416 QPixmap px = QPixmap::grabWindow(myRenderWindow->winId());
417 QApplication::restoreOverrideCursor();
419 QString fileName = SUIT_FileDlg::getFileName(this,
421 tr("VTK_IMAGE_FILES"),
422 tr("INF_APP_DUMP_VIEW"),
424 if (!fileName.isNull()) {
425 QApplication::setOverrideCursor( Qt::waitCursor );
426 QString fmt = SUIT_Tools::extension( fileName ).upper();
428 fmt = QString("BMP"); // default format
431 bool bOk = px.save(fileName, fmt.latin1());
432 QApplication::restoreOverrideCursor();
434 SUIT_MessageBox::error1(this, tr("ERROR"), tr("ERR_DOC_CANT_SAVE_FILE"), tr("BUT_OK"));
439 //----------------------------------------------------------------
442 ::onSelectionChanged()
446 const SALOME_ListIO& aListIO = mySelector->StoredIObjects();
447 SALOME_ListIteratorOfListIO anIter(aListIO);
448 for(; anIter.More(); anIter.Next()){
449 highlight(anIter.Value(),true,!anIter.More());
452 emit selectionChanged();
455 //----------------------------------------------------------------
458 ::SetSelectionMode(Selection_Mode theMode)
460 mySelector->SetSelectionMode(theMode);
461 myRWInteractor->SetSelectionMode(theMode);
464 //----------------------------------------------------------------
467 ::SelectionMode() const
469 return mySelector->SelectionMode();
472 //----------------------------------------------------------------
477 myRWInteractor->unHighlightAll();
480 //----------------------------------------------------------------
483 ::highlight( const Handle(SALOME_InteractiveObject)& theIO,
487 myRWInteractor->highlight(theIO, theIsHighlight, theIsUpdate);
489 if(mySelector->HasIndex(theIO) && theIO->hasEntry()){
490 TColStd_IndexedMapOfInteger aMapIndex;
491 mySelector->GetIndex(theIO,aMapIndex);
493 const char* anEntry = theIO->getEntry();
494 vtkActorCollection* aCollection = myRenderer->GetActors();
495 if(SALOME_Actor* anActor = Find<SALOME_Actor>(aCollection,TIsSameEntry<SALOME_Actor>(anEntry))){
496 switch (mySelector->SelectionMode()) {
498 myRWInteractor->highlightPoint(aMapIndex,anActor,theIsHighlight,theIsUpdate);
500 case EdgeOfCellSelection:
501 myRWInteractor->highlightEdge(aMapIndex,anActor,theIsHighlight,theIsUpdate);
506 case VolumeSelection:
507 myRWInteractor->highlightCell(aMapIndex,anActor,theIsHighlight,theIsUpdate);
512 myRWInteractor->unHighlightSubSelection();
516 //----------------------------------------------------------------
519 ::isInViewer( const Handle(SALOME_InteractiveObject)& theIO )
521 return myRWInteractor->isInViewer( theIO );
524 //----------------------------------------------------------------
527 ::isVisible( const Handle(SALOME_InteractiveObject)& theIO )
529 return myRWInteractor->isVisible( theIO );
532 //----------------------------------------------------------------------------
535 ::setBackgroundColor( const QColor& color )
538 myRenderer->SetBackground( color.red()/255., color.green()/255., color.blue()/255. );
541 //----------------------------------------------------------------------------
544 ::backgroundColor() const
548 myRenderer->GetBackground( backint );
549 return QColor(int(backint[0]*255), int(backint[1]*255), int(backint[2]*255));
551 return SUIT_ViewWindow::backgroundColor();
554 //----------------------------------------------------------------------------
557 ::Repaint(bool theUpdateTrihedron)
559 if (theUpdateTrihedron)
561 myRenderWindow->update();
564 //----------------------------------------------------------------------------
567 ::GetScale( double theScale[3] )
569 myTransform->GetScale( theScale );
572 //----------------------------------------------------------------------------
575 ::SetScale( double theScale[3] )
577 myTransform->SetScale( theScale[0], theScale[1], theScale[2] );
578 myRWInteractor->Render();
582 //----------------------------------------------------------------------------
585 ::isTrihedronDisplayed()
587 return myTrihedron->GetVisibility() == VTKViewer_Trihedron::eOn;
590 //----------------------------------------------------------------------------
598 if(isTrihedronDisplayed())
599 myTrihedron->VisibilityOff();
601 myTrihedron->VisibilityOn();
606 //----------------------------------------------------------------------------
609 ::ComputeTrihedronSize( double& theNewSize, double& theSize )
611 // calculating diagonal of visible props of the renderer
613 myTrihedron->VisibilityOff();
615 if ( ::ComputeVisiblePropBounds( myRenderer, aBndBox ) == 0 ) {
616 aBndBox[ 1 ] = aBndBox[ 3 ] = aBndBox[ 5 ] = 100;
617 aBndBox[ 0 ] = aBndBox[ 2 ] = aBndBox[ 4 ] = 0;
620 myTrihedron->VisibilityOn();
622 static bool aCalcByDiag = false;
624 aLength = sqrt( ( aBndBox[1]-aBndBox[0])*(aBndBox[1]-aBndBox[0] )+
625 ( aBndBox[3]-aBndBox[2])*(aBndBox[3]-aBndBox[2] )+
626 ( aBndBox[5]-aBndBox[4])*(aBndBox[5]-aBndBox[4] ) );
628 aLength = aBndBox[ 1 ]-aBndBox[ 0 ];
629 aLength = max( ( aBndBox[ 3 ] - aBndBox[ 2 ] ),aLength );
630 aLength = max( ( aBndBox[ 5 ] - aBndBox[ 4 ] ),aLength );
633 static float aSizeInPercents = 105;
634 //QString aSetting = QAD_CONFIG->getSetting( "Viewer:TrihedronSize" );
635 //if ( !aSetting.isEmpty() )
636 // aSizeInPercents = aSetting.toFloat();
638 static float EPS_SIZE = 5.0E-3;
639 theSize = myTrihedron->GetSize();
640 theNewSize = aLength * aSizeInPercents / 100.0;
642 // if the new trihedron size have sufficient difference, then apply the value
643 return fabs( theNewSize - theSize) > theSize * EPS_SIZE ||
644 fabs( theNewSize-theSize ) > theNewSize * EPS_SIZE;
647 //----------------------------------------------------------------------------
650 ::GetTrihedronSize() const
652 return myTrihedron->GetSize();
655 //----------------------------------------------------------------------------
658 ::AdjustTrihedrons( const bool theIsForcedUpdate )
660 if ( !isTrihedronDisplayed() && !theIsForcedUpdate )
663 int aVisibleNum = myTrihedron->GetVisibleActorCount( myRenderer );
664 if ( aVisibleNum || theIsForcedUpdate ) {
665 // if the new trihedron size have sufficient difference, then apply the value
666 double aNewSize = 100, anOldSize;
667 if ( ComputeTrihedronSize( aNewSize, anOldSize ) || theIsForcedUpdate ) {
668 myTrihedron->SetSize( aNewSize );
669 // itearte throuh displayed objects and set size if necessary
671 vtkActorCollection* anActors = getRenderer()->GetActors();
672 anActors->InitTraversal();
673 while( vtkActor* anActor = anActors->GetNextActor() ) {
674 if( SALOME_Actor* aSActor = SALOME_Actor::SafeDownCast( anActor ) ) {
675 if ( aSActor->IsResizable() )
676 aSActor->SetSize( 0.5 * aNewSize );
682 ::ResetCameraClippingRange(myRenderer);
685 //----------------------------------------------------------------------------
688 ::onAdjustTrihedron()
690 AdjustTrihedrons( false );
693 #define INCREMENT_FOR_OP 10
695 //=======================================================================
697 // Purpose : Performs incremental panning to the left
698 //=======================================================================
703 myRWInteractor->GetSInteractorStyle()->IncrementalPan( -INCREMENT_FOR_OP, 0 );
706 //=======================================================================
708 // Purpose : Performs incremental panning to the right
709 //=======================================================================
714 myRWInteractor->GetSInteractorStyle()->IncrementalPan( INCREMENT_FOR_OP, 0 );
717 //=======================================================================
719 // Purpose : Performs incremental panning to the top
720 //=======================================================================
725 myRWInteractor->GetSInteractorStyle()->IncrementalPan( 0, INCREMENT_FOR_OP );
728 //=======================================================================
730 // Purpose : Performs incremental panning to the bottom
731 //=======================================================================
736 myRWInteractor->GetSInteractorStyle()->IncrementalPan( 0, -INCREMENT_FOR_OP );
739 //=======================================================================
741 // Purpose : Performs incremental zooming in
742 //=======================================================================
747 myRWInteractor->GetSInteractorStyle()->IncrementalZoom( INCREMENT_FOR_OP );
750 //=======================================================================
752 // Purpose : Performs incremental zooming out
753 //=======================================================================
758 myRWInteractor->GetSInteractorStyle()->IncrementalZoom( -INCREMENT_FOR_OP );
761 //=======================================================================
762 // name : onRotateLeft
763 // Purpose : Performs incremental rotating to the left
764 //=======================================================================
769 myRWInteractor->GetSInteractorStyle()->IncrementalRotate( -INCREMENT_FOR_OP, 0 );
772 //=======================================================================
773 // name : onRotateRight
774 // Purpose : Performs incremental rotating to the right
775 //=======================================================================
780 myRWInteractor->GetSInteractorStyle()->IncrementalRotate( INCREMENT_FOR_OP, 0 );
783 //=======================================================================
785 // Purpose : Performs incremental rotating to the top
786 //=======================================================================
791 myRWInteractor->GetSInteractorStyle()->IncrementalRotate( 0, -INCREMENT_FOR_OP );
794 //=======================================================================
797 ::onKeyPressed(QKeyEvent* event)
799 emit keyPressed( this, event );
802 //=======================================================================
805 ::onKeyReleased(QKeyEvent* event)
807 emit keyReleased( this, event );
810 //=======================================================================
813 ::onMousePressed(QMouseEvent* event)
815 emit mousePressed(this, event);
818 //=======================================================================
821 ::onMouseReleased(QMouseEvent* event)
823 emit mouseReleased( this, event );
826 //=======================================================================
829 ::onMouseMoving(QMouseEvent* event)
831 emit mouseMoving( this, event );
834 //=======================================================================
837 ::onMouseDoubleClicked( QMouseEvent* event )
839 emit mouseDoubleClicked( this, event );
842 //=======================================================================
843 // name : onRotateDown
844 // Purpose : Performs incremental rotating to the bottom
845 //=======================================================================
850 myRWInteractor->GetSInteractorStyle()->IncrementalRotate( 0, INCREMENT_FOR_OP );
853 //----------------------------------------------------------------------------
856 ::InsertActor( SALOME_Actor* theActor, bool theMoveInternalActors )
858 theActor->AddToRender(myRenderer);
859 theActor->SetTransform(myTransform);
860 if(theMoveInternalActors)
861 myRWInteractor->MoveInternalActors();
864 //----------------------------------------------------------------------------
867 ::AddActor( SALOME_Actor* theActor, bool theUpdate /*=false*/ )
869 InsertActor(theActor);
874 //----------------------------------------------------------------------------
877 ::RemoveActor( SALOME_Actor* theActor, bool theUpdate /*=false*/ )
879 theActor->RemoveFromRender(myRenderer);
884 //----------------------------------------------------------------------------
887 ::MoveActor( SALOME_Actor* theActor)
889 RemoveActor(theActor);
890 InsertActor(theActor,true);