1 #include "SVTK_Selector.h"
2 #include "SALOME_Actor.h"
4 #include <qapplication.h>
6 #include <vtkActorCollection.h>
7 #include <vtkRenderWindow.h>
8 #include <vtkRenderer.h>
11 #include "QtxAction.h"
13 #include "SUIT_Session.h"
14 #include "SUIT_ToolButton.h"
15 #include "SUIT_MessageBox.h"
17 #include "SUIT_Tools.h"
18 #include "SUIT_ResourceMgr.h"
19 #include "SUIT_FileDlg.h"
21 #include "VTKViewer_Transform.h"
22 #include "VTKViewer_Utilities.h"
24 #include "SVTK_Trihedron.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() );
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;
283 //----------------------------------------------------------------------------
288 myActionsMap[DumpId]->addTo(myToolBar);
290 SUIT_ToolButton* aScaleBtn = new SUIT_ToolButton(myToolBar);
291 aScaleBtn->AddAction(myActionsMap[FitAllId]);
292 aScaleBtn->AddAction(myActionsMap[FitRectId]);
293 aScaleBtn->AddAction(myActionsMap[ZoomId]);
295 SUIT_ToolButton* aPanningBtn = new SUIT_ToolButton(myToolBar);
296 aPanningBtn->AddAction(myActionsMap[PanId]);
297 aPanningBtn->AddAction(myActionsMap[GlobalPanId]);
299 myActionsMap[RotationId]->addTo(myToolBar);
301 SUIT_ToolButton* aViewsBtn = new SUIT_ToolButton(myToolBar);
302 aViewsBtn->AddAction(myActionsMap[FrontId]);
303 aViewsBtn->AddAction(myActionsMap[BackId]);
304 aViewsBtn->AddAction(myActionsMap[TopId]);
305 aViewsBtn->AddAction(myActionsMap[BottomId]);
306 aViewsBtn->AddAction(myActionsMap[LeftId]);
307 aViewsBtn->AddAction(myActionsMap[RightId]);
309 myActionsMap[ResetId]->addTo(myToolBar);
312 //----------------------------------------------------------------------------
317 vtkCamera* camera = myRenderer->GetActiveCamera();
318 camera->SetPosition(1,0,0);
319 camera->SetViewUp(0,0,1);
320 camera->SetFocalPoint(0,0,0);
324 //----------------------------------------------------------------------------
329 vtkCamera* camera = myRenderer->GetActiveCamera();
330 camera->SetPosition(-1,0,0);
331 camera->SetViewUp(0,0,1);
332 camera->SetFocalPoint(0,0,0);
336 //----------------------------------------------------------------------------
341 vtkCamera* camera = myRenderer->GetActiveCamera();
342 camera->SetPosition(0,0,1);
343 camera->SetViewUp(0,1,0);
344 camera->SetFocalPoint(0,0,0);
348 //----------------------------------------------------------------------------
353 vtkCamera* camera = myRenderer->GetActiveCamera();
354 camera->SetPosition(0,0,-1);
355 camera->SetViewUp(0,1,0);
356 camera->SetFocalPoint(0,0,0);
360 //----------------------------------------------------------------------------
365 vtkCamera* camera = myRenderer->GetActiveCamera();
366 camera->SetPosition(0,-1,0);
367 camera->SetViewUp(0,0,1);
368 camera->SetFocalPoint(0,0,0);
372 //----------------------------------------------------------------------------
377 vtkCamera* camera = myRenderer->GetActiveCamera();
378 camera->SetPosition(0,1,0);
379 camera->SetViewUp(0,0,1);
380 camera->SetFocalPoint(0,0,0);
384 //----------------------------------------------------------------------------
389 int aTrihedronIsVisible = isTrihedronDisplayed();
390 myTrihedron->SetVisibility( VTKViewer_Trihedron::eOnlyLineOn );
391 ::ResetCamera(myRenderer,true);
392 vtkCamera* aCamera = myRenderer->GetActiveCamera();
393 aCamera->SetPosition(1,-1,1);
394 aCamera->SetViewUp(0,0,1);
395 ::ResetCamera(myRenderer,true);
396 if(aTrihedronIsVisible) myTrihedron->VisibilityOn();
397 else myTrihedron->VisibilityOff();
398 static float aCoeff = 3.0;
399 aCamera->SetParallelScale(aCoeff*aCamera->GetParallelScale());
403 //----------------------------------------------------------------------------
408 myRWInteractor->GetSInteractorStyle()->ViewFitAll();
412 //----------------------------------------------------------------------------
417 QApplication::setOverrideCursor( Qt::waitCursor );
418 QPixmap px = QPixmap::grabWindow(myRenderWindow->winId());
419 QApplication::restoreOverrideCursor();
421 QString fileName = SUIT_FileDlg::getFileName(this,
423 tr("VTK_IMAGE_FILES"),
424 tr("INF_APP_DUMP_VIEW"),
426 if (!fileName.isNull()) {
427 QApplication::setOverrideCursor( Qt::waitCursor );
428 QString fmt = SUIT_Tools::extension( fileName ).upper();
430 fmt = QString("BMP"); // default format
433 bool bOk = px.save(fileName, fmt.latin1());
434 QApplication::restoreOverrideCursor();
436 SUIT_MessageBox::error1(this, tr("ERROR"), tr("ERR_DOC_CANT_SAVE_FILE"), tr("BUT_OK"));
441 //----------------------------------------------------------------
444 ::onSelectionChanged()
448 const SALOME_ListIO& aListIO = mySelector->StoredIObjects();
449 SALOME_ListIteratorOfListIO anIter(aListIO);
450 for(; anIter.More(); anIter.Next()){
451 highlight(anIter.Value(),true,!anIter.More());
454 emit selectionChanged();
457 //----------------------------------------------------------------
460 ::SetSelectionMode(Selection_Mode theMode)
462 mySelector->SetSelectionMode(theMode);
463 myRWInteractor->SetSelectionMode(theMode);
466 //----------------------------------------------------------------
469 ::SelectionMode() const
471 return mySelector->SelectionMode();
474 //----------------------------------------------------------------
479 myRWInteractor->unHighlightAll();
482 //----------------------------------------------------------------
485 ::highlight( const Handle(SALOME_InteractiveObject)& theIO,
489 myRWInteractor->highlight(theIO, theIsHighlight, theIsUpdate);
491 if(mySelector->HasIndex(theIO) && theIO->hasEntry()){
492 TColStd_IndexedMapOfInteger aMapIndex;
493 mySelector->GetIndex(theIO,aMapIndex);
495 const char* anEntry = theIO->getEntry();
496 vtkActorCollection* aCollection = myRenderer->GetActors();
497 if(SALOME_Actor* anActor = Find<SALOME_Actor>(aCollection,TIsSameEntry<SALOME_Actor>(anEntry))){
498 switch (mySelector->SelectionMode()) {
500 myRWInteractor->highlightPoint(aMapIndex,anActor,theIsHighlight,theIsUpdate);
502 case EdgeOfCellSelection:
503 myRWInteractor->highlightEdge(aMapIndex,anActor,theIsHighlight,theIsUpdate);
508 case VolumeSelection:
509 myRWInteractor->highlightCell(aMapIndex,anActor,theIsHighlight,theIsUpdate);
514 myRWInteractor->unHighlightSubSelection();
518 //----------------------------------------------------------------
521 ::isInViewer( const Handle(SALOME_InteractiveObject)& theIO )
523 return myRWInteractor->isInViewer( theIO );
526 //----------------------------------------------------------------
529 ::isVisible( const Handle(SALOME_InteractiveObject)& theIO )
531 return myRWInteractor->isVisible( theIO );
534 //----------------------------------------------------------------------------
537 ::setBackgroundColor( const QColor& color )
540 myRenderer->SetBackground( color.red()/255., color.green()/255., color.blue()/255. );
543 //----------------------------------------------------------------------------
546 ::backgroundColor() const
550 myRenderer->GetBackground( backint );
551 return QColor(int(backint[0]*255), int(backint[1]*255), int(backint[2]*255));
553 return SUIT_ViewWindow::backgroundColor();
556 //----------------------------------------------------------------------------
559 ::Repaint(bool theUpdateTrihedron)
561 if (theUpdateTrihedron)
563 myRenderWindow->update();
566 //----------------------------------------------------------------------------
569 ::GetScale( double theScale[3] )
571 myTransform->GetScale( theScale );
574 //----------------------------------------------------------------------------
577 ::SetScale( double theScale[3] )
579 myTransform->SetScale( theScale[0], theScale[1], theScale[2] );
580 myRWInteractor->Render();
584 //----------------------------------------------------------------------------
587 ::isTrihedronDisplayed()
589 return myTrihedron->GetVisibility() == VTKViewer_Trihedron::eOn;
592 //----------------------------------------------------------------------------
600 if(isTrihedronDisplayed())
601 myTrihedron->VisibilityOff();
603 myTrihedron->VisibilityOn();
608 //----------------------------------------------------------------------------
611 ::ComputeTrihedronSize( double& theNewSize, double& theSize )
613 // calculating diagonal of visible props of the renderer
615 myTrihedron->VisibilityOff();
617 if ( ::ComputeVisiblePropBounds( myRenderer, aBndBox ) == 0 ) {
618 aBndBox[ 1 ] = aBndBox[ 3 ] = aBndBox[ 5 ] = 100;
619 aBndBox[ 0 ] = aBndBox[ 2 ] = aBndBox[ 4 ] = 0;
622 myTrihedron->VisibilityOn();
624 static bool aCalcByDiag = false;
626 aLength = sqrt( ( aBndBox[1]-aBndBox[0])*(aBndBox[1]-aBndBox[0] )+
627 ( aBndBox[3]-aBndBox[2])*(aBndBox[3]-aBndBox[2] )+
628 ( aBndBox[5]-aBndBox[4])*(aBndBox[5]-aBndBox[4] ) );
630 aLength = aBndBox[ 1 ]-aBndBox[ 0 ];
631 aLength = max( ( aBndBox[ 3 ] - aBndBox[ 2 ] ),aLength );
632 aLength = max( ( aBndBox[ 5 ] - aBndBox[ 4 ] ),aLength );
635 static float aSizeInPercents = 105;
636 //QString aSetting = QAD_CONFIG->getSetting( "Viewer:TrihedronSize" );
637 //if ( !aSetting.isEmpty() )
638 // aSizeInPercents = aSetting.toFloat();
640 static float EPS_SIZE = 5.0E-3;
641 theSize = myTrihedron->GetSize();
642 theNewSize = aLength * aSizeInPercents / 100.0;
644 // if the new trihedron size have sufficient difference, then apply the value
645 return fabs( theNewSize - theSize) > theSize * EPS_SIZE ||
646 fabs( theNewSize-theSize ) > theNewSize * EPS_SIZE;
649 //----------------------------------------------------------------------------
652 ::GetTrihedronSize() const
654 return myTrihedron->GetSize();
657 //----------------------------------------------------------------------------
660 ::AdjustTrihedrons( const bool theIsForcedUpdate )
662 if ( !isTrihedronDisplayed() && !theIsForcedUpdate )
665 int aVisibleNum = myTrihedron->GetVisibleActorCount( myRenderer );
666 if ( aVisibleNum || theIsForcedUpdate ) {
667 // if the new trihedron size have sufficient difference, then apply the value
668 double aNewSize = 100, anOldSize;
669 if ( ComputeTrihedronSize( aNewSize, anOldSize ) || theIsForcedUpdate ) {
670 myTrihedron->SetSize( aNewSize );
671 // itearte throuh displayed objects and set size if necessary
673 vtkActorCollection* anActors = getRenderer()->GetActors();
674 anActors->InitTraversal();
675 while( vtkActor* anActor = anActors->GetNextActor() ) {
676 if( SALOME_Actor* aSActor = SALOME_Actor::SafeDownCast( anActor ) ) {
677 if ( aSActor->IsResizable() )
678 aSActor->SetSize( 0.5 * aNewSize );
684 ::ResetCameraClippingRange(myRenderer);
687 //----------------------------------------------------------------------------
690 ::onAdjustTrihedron()
692 AdjustTrihedrons( false );
695 #define INCREMENT_FOR_OP 10
697 //=======================================================================
699 // Purpose : Performs incremental panning to the left
700 //=======================================================================
705 myRWInteractor->GetSInteractorStyle()->IncrementalPan( -INCREMENT_FOR_OP, 0 );
708 //=======================================================================
710 // Purpose : Performs incremental panning to the right
711 //=======================================================================
716 myRWInteractor->GetSInteractorStyle()->IncrementalPan( INCREMENT_FOR_OP, 0 );
719 //=======================================================================
721 // Purpose : Performs incremental panning to the top
722 //=======================================================================
727 myRWInteractor->GetSInteractorStyle()->IncrementalPan( 0, INCREMENT_FOR_OP );
730 //=======================================================================
732 // Purpose : Performs incremental panning to the bottom
733 //=======================================================================
738 myRWInteractor->GetSInteractorStyle()->IncrementalPan( 0, -INCREMENT_FOR_OP );
741 //=======================================================================
743 // Purpose : Performs incremental zooming in
744 //=======================================================================
749 myRWInteractor->GetSInteractorStyle()->IncrementalZoom( INCREMENT_FOR_OP );
752 //=======================================================================
754 // Purpose : Performs incremental zooming out
755 //=======================================================================
760 myRWInteractor->GetSInteractorStyle()->IncrementalZoom( -INCREMENT_FOR_OP );
763 //=======================================================================
764 // name : onRotateLeft
765 // Purpose : Performs incremental rotating to the left
766 //=======================================================================
771 myRWInteractor->GetSInteractorStyle()->IncrementalRotate( -INCREMENT_FOR_OP, 0 );
774 //=======================================================================
775 // name : onRotateRight
776 // Purpose : Performs incremental rotating to the right
777 //=======================================================================
782 myRWInteractor->GetSInteractorStyle()->IncrementalRotate( INCREMENT_FOR_OP, 0 );
785 //=======================================================================
787 // Purpose : Performs incremental rotating to the top
788 //=======================================================================
793 myRWInteractor->GetSInteractorStyle()->IncrementalRotate( 0, -INCREMENT_FOR_OP );
796 //=======================================================================
799 ::onKeyPressed(QKeyEvent* event)
801 emit keyPressed( this, event );
804 //=======================================================================
807 ::onKeyReleased(QKeyEvent* event)
809 emit keyReleased( this, event );
812 //=======================================================================
815 ::onMousePressed(QMouseEvent* event)
817 emit mousePressed(this, event);
820 //=======================================================================
823 ::onMouseReleased(QMouseEvent* event)
825 emit mouseReleased( this, event );
828 //=======================================================================
831 ::onMouseMoving(QMouseEvent* event)
833 emit mouseMoving( this, event );
836 //=======================================================================
839 ::onMouseDoubleClicked( QMouseEvent* event )
841 emit mouseDoubleClicked( this, event );
844 //=======================================================================
845 // name : onRotateDown
846 // Purpose : Performs incremental rotating to the bottom
847 //=======================================================================
852 myRWInteractor->GetSInteractorStyle()->IncrementalRotate( 0, INCREMENT_FOR_OP );
855 //----------------------------------------------------------------------------
858 ::InsertActor( SALOME_Actor* theActor, bool theMoveInternalActors )
860 theActor->AddToRender(myRenderer);
861 theActor->SetTransform(myTransform);
862 if(theMoveInternalActors)
863 myRWInteractor->MoveInternalActors();
866 //----------------------------------------------------------------------------
869 ::AddActor( SALOME_Actor* theActor, bool theUpdate /*=false*/ )
871 InsertActor(theActor);
876 //----------------------------------------------------------------------------
879 ::RemoveActor( SALOME_Actor* theActor, bool theUpdate /*=false*/ )
881 theActor->RemoveFromRender(myRenderer);
886 //----------------------------------------------------------------------------
889 ::MoveActor( SALOME_Actor* theActor)
891 RemoveActor(theActor);
892 InsertActor(theActor,true);