From 829633f46e04106145cde29742a8b9b9d6e54a65 Mon Sep 17 00:00:00 2001 From: nds Date: Tue, 7 Oct 2008 09:04:53 +0000 Subject: [PATCH] Merging GUI_SRC module with the BR_HDF_dev_merged branch, which has been merged with the BR_V5_DEV branch. --- src/SVTK/SVTK_InteractorStyle.cxx | 56 ++----- src/SVTK/SVTK_MainWindow.cxx | 186 +++++++++++------------ src/SVTK/SVTK_MainWindow.h | 21 +-- src/SVTK/SVTK_RectPicker.cxx | 21 ++- src/SVTK/SVTK_RenderWindowInteractor.cxx | 5 +- 5 files changed, 126 insertions(+), 163 deletions(-) diff --git a/src/SVTK/SVTK_InteractorStyle.cxx b/src/SVTK/SVTK_InteractorStyle.cxx index e9032bdcd..6c8d32111 100644 --- a/src/SVTK/SVTK_InteractorStyle.cxx +++ b/src/SVTK/SVTK_InteractorStyle.cxx @@ -49,7 +49,6 @@ #include #include #include -#include #include #include #include @@ -79,38 +78,18 @@ namespace theInteractor->GetEventPosition(theX,theY); theY = theInteractor->GetSize()[1] - theY - 1; } - - //================================================================== - // function : GetFirstSALOMEActor - // purpose : - //================================================================== - struct THaveIO - { - bool - operator()(SALOME_Actor* theActor) - { - return theActor->hasIO(); - } - }; - - inline - SALOME_Actor* - GetFirstSALOMEActor(vtkPicker *thePicker) - { - return VTK::Find(thePicker->GetActors(),THaveIO()); - } } vtkStandardNewMacro(SVTK_InteractorStyle); + /*! Constructor */ SVTK_InteractorStyle ::SVTK_InteractorStyle(): mySelectionEvent(new SVTK_SelectionEvent()), - myPicker(vtkPicker::New()), myPointPicker(vtkPointPicker::New()), myLastHighlitedActor(NULL), myLastPreHighlitedActor(NULL), @@ -119,7 +98,6 @@ SVTK_InteractorStyle myHighlightRotationPointActor(SVTK_Actor::New()), myRectBand(0) { - myPicker->Delete(); myPointPicker->Delete(); myPointPicker->SetTolerance(0.025); @@ -514,11 +492,10 @@ SVTK_InteractorStyle else if ( myCurrRotationPointType == SVTK::StartPointSelection ) { SVTK_SelectionEvent* aSelectionEvent = GetSelectionEventFlipY(); - myPicker->Pick(aSelectionEvent->myX, - aSelectionEvent->myY, - 0.0, - GetCurrentRenderer()); - if ( SALOME_Actor* anActor = GetFirstSALOMEActor(myPicker.GetPointer()) ) + + SALOME_Actor* anActor = GetSelector()->Pick(aSelectionEvent, GetCurrentRenderer()); + + if ( anActor ) { myPointPicker->Pick( aSelectionEvent->myX, aSelectionEvent->myY, @@ -1090,12 +1067,8 @@ SVTK_InteractorStyle this->FindPokedRenderer(aSelectionEvent->myX, aSelectionEvent->myY); Interactor->StartPickCallback(); - myPicker->Pick(aSelectionEvent->myX, - aSelectionEvent->myY, - 0.0, - GetCurrentRenderer()); - // - SALOME_Actor* anActor = GetFirstSALOMEActor(myPicker.GetPointer()); + SALOME_Actor* anActor = GetSelector()->Pick(aSelectionEvent, GetCurrentRenderer()); + aSelectionEvent->myIsRectangle = false; if(!myShiftState) @@ -1228,24 +1201,13 @@ SVTK_InteractorStyle bool anIsChanged = false; - myPicker->Pick(aSelectionEvent->myX, - aSelectionEvent->myY, - 0.0, - GetCurrentRenderer()); - - SALOME_Actor *anActor = GetFirstSALOMEActor(myPicker.GetPointer()); + SALOME_Actor *anActor = GetSelector()->Pick(aSelectionEvent, GetCurrentRenderer()); if ( myCurrRotationPointType == SVTK::StartPointSelection ) { myHighlightRotationPointActor->SetVisibility( false ); - SALOME_Actor *anCurrActor; - if ( anActor ) anCurrActor = anActor; - else if ( myLastPreHighlitedActor.GetPointer() - && - myLastPreHighlitedActor.GetPointer() != anActor ) - anCurrActor = myLastPreHighlitedActor.GetPointer(); - if ( anCurrActor ) + if ( anActor ) { myPointPicker->Pick( aSelectionEvent->myX, aSelectionEvent->myY, 0.0, GetCurrentRenderer() ); int aVtkId = myPointPicker->GetPointId(); diff --git a/src/SVTK/SVTK_MainWindow.cxx b/src/SVTK/SVTK_MainWindow.cxx index 106edad4a..d23d48393 100644 --- a/src/SVTK/SVTK_MainWindow.cxx +++ b/src/SVTK/SVTK_MainWindow.cxx @@ -30,24 +30,27 @@ #include #include -#include + +#include +#include +#include #include #include #include +#include #include #include #include #include +#include #include "SVTK_NonIsometricDlg.h" #include "SVTK_UpdateRateDlg.h" #include "SVTK_CubeAxesDlg.h" #include "SVTK_SetRotationPointDlg.h" - #include "SVTK_TextRegionDlg.h" - #include "SVTK_MainWindow.h" #include "SVTK_Event.h" #include "SVTK_Renderer.h" @@ -55,10 +58,6 @@ #include "SVTK_InteractorStyle.h" #include "SVTK_Selector.h" -#include -#include -#include - /*! Constructor */ @@ -72,11 +71,6 @@ SVTK_MainWindow { setObjectName(theName); setWindowFlags( windowFlags() & ~Qt::Window ); - - myToolBar = new QtxToolBar( true, tr("LBL_TOOLBAR_LABEL"), this ); - - createActions(theResourceMgr); - createToolBar(); } /*! @@ -86,6 +80,11 @@ void SVTK_MainWindow ::Initialize(SVTK_RenderWindowInteractor* theInteractor) { + myToolBar = toolMgr()->createToolBar( tr("LBL_TOOLBAR_LABEL"), -1, this ); + + createActions( SUIT_Session::session()->activeApplication()->resourceMgr() ); + createToolBar(); + myInteractor = theInteractor; SetEventDispatcher(myInteractor->GetDevice()); @@ -96,12 +95,12 @@ SVTK_MainWindow myInteractor->setFocus(); setFocusProxy(myInteractor); - myUpdateRateDlg = new SVTK_UpdateRateDlg(myActionsMap[UpdateRate], this, "SVTK_UpdateRateDlg"); - myNonIsometricDlg = new SVTK_NonIsometricDlg(myActionsMap[NonIsometric], this," SVTK_NonIsometricDlg"); - myCubeAxesDlg = new SVTK_CubeAxesDlg(myActionsMap[GraduatedAxes], this, "SVTK_CubeAxesDlg"); - mySetRotationPointDlg = new SVTK_SetRotationPointDlg(myActionsMap[ChangeRotationPointId], this, "SVTK_SetRotationPointDlg"); - myTextRegionDlg = new SVTK_TextRegionDlg(myActionsMap[TextRegion], this, "SVTK_TextRegionDlg"); - + myUpdateRateDlg = new SVTK_UpdateRateDlg( action( UpdateRate ), this, "SVTK_UpdateRateDlg" ); + myNonIsometricDlg = new SVTK_NonIsometricDlg( action( NonIsometric ), this, "SVTK_NonIsometricDlg" ); + myCubeAxesDlg = new SVTK_CubeAxesDlg( action( GraduatedAxes ), this, "SVTK_CubeAxesDlg" ); + mySetRotationPointDlg = new SVTK_SetRotationPointDlg + ( action( ChangeRotationPointId ), this, "SVTK_SetRotationPointDlg" ); + myTextRegionDlg = new SVTK_TextRegionDlg( action( TextRegion ), this, "SVTK_TextRegionDlg"); } /*! @@ -112,6 +111,14 @@ SVTK_MainWindow { } +/*! + \return assigned tool manager +*/ +QtxActionToolMgr* SVTK_MainWindow::toolMgr() const +{ + return myViewWindow->toolMgr(); +} + /*! \return used SVTK_RenderWindowInteractor */ @@ -403,7 +410,7 @@ QToolBar* SVTK_MainWindow ::getToolBar() { - return myToolBar; + return toolMgr()->toolBar( myToolBar ); } void @@ -424,10 +431,8 @@ void SVTK_MainWindow ::createActions(SUIT_ResourceMgr* theResourceMgr) { - if(!myActionsMap.isEmpty()) - return; - QtxAction* anAction; + QtxActionToolMgr* mgr = toolMgr(); // Dump view anAction = new QtxAction(tr("MNU_DUMP_VIEW"), @@ -435,7 +440,7 @@ SVTK_MainWindow tr( "MNU_DUMP_VIEW" ), 0, this); anAction->setStatusTip(tr("DSC_DUMP_VIEW")); connect(anAction, SIGNAL(triggered(bool)), myViewWindow, SLOT(onDumpView())); - myActionsMap[ DumpId ] = anAction; + mgr->registerAction( anAction, DumpId ); // FitAll anAction = new QtxAction(tr("MNU_FITALL"), @@ -443,7 +448,7 @@ SVTK_MainWindow tr( "MNU_FITALL" ), 0, this); anAction->setStatusTip(tr("DSC_FITALL")); connect(anAction, SIGNAL(triggered(bool)), this, SLOT(onFitAll())); - myActionsMap[ FitAllId ] = anAction; + mgr->registerAction( anAction, FitAllId ); // FitRect anAction = new QtxAction(tr("MNU_FITRECT"), @@ -451,7 +456,7 @@ SVTK_MainWindow tr( "MNU_FITRECT" ), 0, this); anAction->setStatusTip(tr("DSC_FITRECT")); connect(anAction, SIGNAL(triggered(bool)), this, SLOT(activateWindowFit())); - myActionsMap[ FitRectId ] = anAction; + mgr->registerAction( anAction, FitRectId ); // Zoom anAction = new QtxAction(tr("MNU_ZOOM_VIEW"), @@ -459,7 +464,7 @@ SVTK_MainWindow tr( "MNU_ZOOM_VIEW" ), 0, this); anAction->setStatusTip(tr("DSC_ZOOM_VIEW")); connect(anAction, SIGNAL(triggered(bool)), this, SLOT(activateZoom())); - myActionsMap[ ZoomId ] = anAction; + mgr->registerAction( anAction, ZoomId ); // Panning anAction = new QtxAction(tr("MNU_PAN_VIEW"), @@ -467,7 +472,7 @@ SVTK_MainWindow tr( "MNU_PAN_VIEW" ), 0, this); anAction->setStatusTip(tr("DSC_PAN_VIEW")); connect(anAction, SIGNAL(triggered(bool)), this, SLOT(activatePanning())); - myActionsMap[ PanId ] = anAction; + mgr->registerAction( anAction, PanId ); // Global Panning anAction = new QtxAction(tr("MNU_GLOBALPAN_VIEW"), @@ -475,16 +480,16 @@ SVTK_MainWindow tr( "MNU_GLOBALPAN_VIEW" ), 0, this); anAction->setStatusTip(tr("DSC_GLOBALPAN_VIEW")); connect(anAction, SIGNAL(triggered(bool)), this, SLOT(activateGlobalPanning())); - myActionsMap[ GlobalPanId ] = anAction; + mgr->registerAction( anAction, GlobalPanId ); // Change rotation point anAction = new QtxAction(tr("MNU_CHANGINGROTATIONPOINT_VIEW"), - theResourceMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_ROTATION_POINT" ) ), + theResourceMgr->loadPixmap( "VTKViewer", tr( "ICON_SVTK_ROTATION_POINT" ) ), tr( "MNU_CHANGINGROTATIONPOINT_VIEW" ), 0, this); anAction->setStatusTip(tr("DSC_CHANGINGROTATIONPOINT_VIEW")); anAction->setCheckable(true); connect(anAction, SIGNAL(toggled(bool)), this, SLOT(onChangeRotationPoint(bool))); - myActionsMap[ ChangeRotationPointId ] = anAction; + mgr->registerAction( anAction, ChangeRotationPointId ); // Rotation anAction = new QtxAction(tr("MNU_ROTATE_VIEW"), @@ -492,7 +497,7 @@ SVTK_MainWindow tr( "MNU_ROTATE_VIEW" ), 0, this); anAction->setStatusTip(tr("DSC_ROTATE_VIEW")); connect(anAction, SIGNAL(triggered(bool)), this, SLOT(activateRotation())); - myActionsMap[ RotationId ] = anAction; + mgr->registerAction( anAction, RotationId ); // Projections anAction = new QtxAction(tr("MNU_FRONT_VIEW"), @@ -500,42 +505,42 @@ SVTK_MainWindow tr( "MNU_FRONT_VIEW" ), 0, this); anAction->setStatusTip(tr("DSC_FRONT_VIEW")); connect(anAction, SIGNAL(triggered(bool)), this, SLOT(onFrontView())); - myActionsMap[ FrontId ] = anAction; + mgr->registerAction( anAction, FrontId ); anAction = new QtxAction(tr("MNU_BACK_VIEW"), theResourceMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_BACK" ) ), tr( "MNU_BACK_VIEW" ), 0, this); anAction->setStatusTip(tr("DSC_BACK_VIEW")); connect(anAction, SIGNAL(triggered(bool)), this, SLOT(onBackView())); - myActionsMap[ BackId ] = anAction; + mgr->registerAction( anAction, BackId ); anAction = new QtxAction(tr("MNU_TOP_VIEW"), theResourceMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_TOP" ) ), tr( "MNU_TOP_VIEW" ), 0, this); anAction->setStatusTip(tr("DSC_TOP_VIEW")); connect(anAction, SIGNAL(triggered(bool)), this, SLOT(onTopView())); - myActionsMap[ TopId ] = anAction; + mgr->registerAction( anAction, TopId ); anAction = new QtxAction(tr("MNU_BOTTOM_VIEW"), theResourceMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_BOTTOM" ) ), tr( "MNU_BOTTOM_VIEW" ), 0, this); anAction->setStatusTip(tr("DSC_BOTTOM_VIEW")); connect(anAction, SIGNAL(triggered(bool)), this, SLOT(onBottomView())); - myActionsMap[ BottomId ] = anAction; + mgr->registerAction( anAction, BottomId ); anAction = new QtxAction(tr("MNU_LEFT_VIEW"), theResourceMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_LEFT" ) ), tr( "MNU_LEFT_VIEW" ), 0, this); anAction->setStatusTip(tr("DSC_LEFT_VIEW")); connect(anAction, SIGNAL(triggered(bool)), this, SLOT(onLeftView())); - myActionsMap[ LeftId ] = anAction; + mgr->registerAction( anAction, LeftId ); anAction = new QtxAction(tr("MNU_RIGHT_VIEW"), theResourceMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_RIGHT" ) ), tr( "MNU_RIGHT_VIEW" ), 0, this); anAction->setStatusTip(tr("DSC_RIGHT_VIEW")); connect(anAction, SIGNAL(triggered(bool)), this, SLOT(onRightView())); - myActionsMap[ RightId ] = anAction; + mgr->registerAction( anAction, RightId ); // Reset anAction = new QtxAction(tr("MNU_RESET_VIEW"), @@ -543,7 +548,7 @@ SVTK_MainWindow tr( "MNU_RESET_VIEW" ), 0, this); anAction->setStatusTip(tr("DSC_RESET_VIEW")); connect(anAction, SIGNAL(triggered(bool)), this, SLOT(onResetView())); - myActionsMap[ ResetId ] = anAction; + mgr->registerAction( anAction, ResetId ); // onViewTrihedron: Shows - Hides Trihedron anAction = new QtxAction(tr("MNU_SHOW_TRIHEDRON"), @@ -551,7 +556,7 @@ SVTK_MainWindow tr( "MNU_SHOW_TRIHEDRON" ), 0, this); anAction->setStatusTip(tr("DSC_SHOW_TRIHEDRON")); connect(anAction, SIGNAL(triggered(bool)), this, SLOT(onViewTrihedron())); - myActionsMap[ ViewTrihedronId ] = anAction; + mgr->registerAction( anAction, ViewTrihedronId ); // onNonIsometric: Manage non-isometric params anAction = new QtxAction(tr("MNU_SVTK_SCALING"), @@ -560,25 +565,25 @@ SVTK_MainWindow anAction->setStatusTip(tr("DSC_SVTK_SCALING")); anAction->setCheckable(true); connect(anAction, SIGNAL(toggled(bool)), this, SLOT(onNonIsometric(bool))); - myActionsMap[ NonIsometric ] = anAction; + mgr->registerAction( anAction, NonIsometric ); // onGraduatedAxes: Manage graduated axes params anAction = new QtxAction(tr("MNU_SVTK_GRADUATED_AXES"), - theResourceMgr->loadPixmap( "VTKViewer", tr( "ICON_GRADUATED_AXES" ) ), + theResourceMgr->loadPixmap( "VTKViewer", tr( "ICON_SVTK_GRADUATED_AXES" ) ), tr( "MNU_SVTK_GRADUATED_AXES" ), 0, this); anAction->setStatusTip(tr("DSC_SVTK_GRADUATED_AXES")); anAction->setCheckable(true); connect(anAction, SIGNAL(toggled(bool)), this, SLOT(onGraduatedAxes(bool))); - myActionsMap[ GraduatedAxes ] = anAction; + mgr->registerAction( anAction, GraduatedAxes ); // onGraduatedAxes: Manage graduated axes params anAction = new QtxAction(tr("MNU_SVTK_UPDATE_RATE"), - theResourceMgr->loadPixmap( "VTKViewer", tr( "ICON_UPDATE_RATE" ) ), + theResourceMgr->loadPixmap( "VTKViewer", tr( "ICON_SVTK_UPDATE_RATE" ) ), tr( "MNU_SVTK_UPDATE_RATE" ), 0, this); anAction->setStatusTip(tr("DSC_SVTK_UPDATE_RATE")); anAction->setCheckable(true); connect(anAction, SIGNAL(toggled(bool)), this, SLOT(onUpdateRate(bool))); - myActionsMap[ UpdateRate ] = anAction; + mgr->registerAction( anAction, UpdateRate ); // onTextRegion: Create Text Region anAction = new QtxAction(tr("MNU_SVTK_TEXT_REGION"), @@ -586,7 +591,7 @@ SVTK_MainWindow tr( "MNU_SVTK_TEXT_REGION" ), 0, this); anAction->setStatusTip(tr("DSC_SVTK_TEXT_REGION")); connect(anAction, SIGNAL(triggered(bool)), this, SLOT(onTextRegion())); - myActionsMap[ TextRegion ] = anAction; + mgr->registerAction( anAction, TextRegion ); // print view anAction = new QtxAction(tr("MNU_PRINT_VIEW"), @@ -594,7 +599,7 @@ SVTK_MainWindow tr( "MNU_PRINT_VIEW" ), 0, this); anAction->setStatusTip(tr("DSC_PRINT_VIEW")); connect(anAction, SIGNAL(triggered(bool)), this, SLOT(onPrintView())); - myActionsMap[ PrintId ] = anAction; + mgr->registerAction( anAction, PrintId ); } #if defined(WIN32) && !defined(_DEBUG) @@ -608,40 +613,42 @@ void SVTK_MainWindow ::createToolBar() { - myToolBar->addAction( myActionsMap[DumpId] ); - myToolBar->addAction( myActionsMap[ViewTrihedronId] ); + QtxActionToolMgr* mgr = toolMgr(); + + mgr->append( DumpId, myToolBar ); + mgr->append( ViewTrihedronId, myToolBar ); QtxMultiAction* aScaleAction = new QtxMultiAction( this ); - aScaleAction->insertAction( myActionsMap[FitAllId] ); - aScaleAction->insertAction( myActionsMap[FitRectId] ); - aScaleAction->insertAction( myActionsMap[ZoomId] ); - myToolBar->addAction( aScaleAction ); + aScaleAction->insertAction( action( FitAllId ) ); + aScaleAction->insertAction( action( FitRectId ) ); + aScaleAction->insertAction( action( ZoomId ) ); + mgr->append( aScaleAction, myToolBar ); QtxMultiAction* aPanningAction = new QtxMultiAction( this ); - aPanningAction->insertAction( myActionsMap[PanId] ); - aPanningAction->insertAction( myActionsMap[GlobalPanId] ); - myToolBar->addAction( aPanningAction ); + aPanningAction->insertAction( action( PanId ) ); + aPanningAction->insertAction( action( GlobalPanId ) ); + mgr->append( aPanningAction, myToolBar ); - myToolBar->addAction( myActionsMap[ChangeRotationPointId] ); + mgr->append( ChangeRotationPointId, myToolBar ); - myToolBar->addAction( myActionsMap[RotationId] ); + mgr->append( RotationId, myToolBar ); QtxMultiAction* aViewsAction = new QtxMultiAction( this ); - aViewsAction->insertAction( myActionsMap[FrontId] ); - aViewsAction->insertAction( myActionsMap[BackId] ); - aViewsAction->insertAction( myActionsMap[TopId] ); - aViewsAction->insertAction( myActionsMap[BottomId] ); - aViewsAction->insertAction( myActionsMap[LeftId] ); - aViewsAction->insertAction( myActionsMap[RightId] ); - myToolBar->addAction( aViewsAction ); + aViewsAction->insertAction( action( FrontId ) ); + aViewsAction->insertAction( action( BackId ) ); + aViewsAction->insertAction( action( TopId ) ); + aViewsAction->insertAction( action( BottomId ) ); + aViewsAction->insertAction( action( LeftId ) ); + aViewsAction->insertAction( action( RightId ) ); + mgr->append( aViewsAction, myToolBar ); - myToolBar->addAction( myActionsMap[ResetId] ); + mgr->append( ResetId, myToolBar ); - myToolBar->addAction( myActionsMap[UpdateRate] ); - myToolBar->addAction( myActionsMap[NonIsometric] ); - myToolBar->addAction( myActionsMap[GraduatedAxes] ); - myToolBar->addAction( myActionsMap[TextRegion] ); - myToolBar->addAction( myActionsMap[PrintId] ); + mgr->append( UpdateRate, myToolBar ); + mgr->append( NonIsometric, myToolBar ); + mgr->append( GraduatedAxes, myToolBar ); + mgr->append( TextRegion, myToolBar ); + mgr->append( PrintId, myToolBar ); } /*! @@ -924,6 +931,16 @@ SVTK_MainWindow GetRenderer()->OnAdjustCubeAxes(); } +/*! + \brief Called when the "Print view" action is activated. +*/ +void SVTK_MainWindow::onPrintView() +{ + QImage img = dumpView(); + if ( myViewWindow ) + myViewWindow->printImage( img, this ); +} + /*! \return QImage, containing all scene rendering in window */ @@ -947,32 +964,9 @@ SVTK_MainWindow } /*! - \brief Called when the "Print view" action is activated. + \return action by it's id */ -void SVTK_MainWindow::onPrintView() +QtxAction* SVTK_MainWindow::action( int id ) const { - QImage img = dumpView(); - if ( myViewWindow ) - myViewWindow->printImage( img, this ); + return dynamic_cast( toolMgr()->action( id ) ); } - - - - - - - - - - - - - - - - - - - - - diff --git a/src/SVTK/SVTK_MainWindow.h b/src/SVTK/SVTK_MainWindow.h index 95503a88e..b2e892634 100644 --- a/src/SVTK/SVTK_MainWindow.h +++ b/src/SVTK/SVTK_MainWindow.h @@ -26,12 +26,10 @@ #include "SVTK.h" #include "SVTK_Selection.h" -#include - #include #include -class QtxAction; +#include class vtkObject; class vtkRenderer; @@ -39,6 +37,9 @@ class vtkRenderWindow; class vtkInteractorStyle; class vtkRenderWindowInteractor; +class QtxAction; +class QtxActionToolMgr; + class SUIT_ResourceMgr; class SUIT_ViewWindow; @@ -49,13 +50,11 @@ class SVTK_CubeAxesActor2D; class SVTK_CubeAxesDlg; class SVTK_SetRotationPointDlg; class SVTK_TextRegionDlg; - -class VTKViewer_Trihedron; -class VTKViewer_Actor; - class SVTK_Renderer; class SVTK_Selector; +class VTKViewer_Trihedron; +class VTKViewer_Actor; //! The class is a container for #SVTK_RenderWindowInteractor. /*! @@ -243,6 +242,8 @@ public: QImage dumpView(); protected: + virtual QtxActionToolMgr* toolMgr() const; + void createActions(SUIT_ResourceMgr* theResourceMgr); @@ -252,12 +253,13 @@ public: void SetEventDispatcher(vtkObject* theDispatcher); + QtxAction* action( int ) const; + enum { DumpId, FitAllId, FitRectId, ZoomId, PanId, GlobalPanId, ChangeRotationPointId, RotationId, FrontId, BackId, TopId, BottomId, LeftId, RightId, ResetId, ViewTrihedronId, NonIsometric, GraduatedAxes, UpdateRate, TextRegion, PrintId }; - typedef QMap TActionsMap; SUIT_ViewWindow* myViewWindow; @@ -268,8 +270,7 @@ public: SVTK_TextRegionDlg* myTextRegionDlg; vtkSmartPointer myEventDispatcher; - TActionsMap myActionsMap; - QToolBar* myToolBar; + int myToolBar; SVTK_RenderWindowInteractor* myInteractor; }; diff --git a/src/SVTK/SVTK_RectPicker.cxx b/src/SVTK/SVTK_RectPicker.cxx index 9aaad409e..8d6cfe07b 100644 --- a/src/SVTK/SVTK_RectPicker.cxx +++ b/src/SVTK/SVTK_RectPicker.cxx @@ -115,22 +115,29 @@ namespace // WorldToView() is called. This is expensive, so we get the matrix once // and handle the transformation ourselves. vtkMatrix4x4 *aMatrix = vtkMatrix4x4::New(); - aMatrix->DeepCopy(theRenderer->GetActiveCamera()-> - GetCompositePerspectiveTransformMatrix(1,0,1)); + aMatrix->DeepCopy( theRenderer->GetActiveCamera()-> + GetCompositePerspectiveTransformMatrix( theRenderer->GetTiledAspectRatio(), 0, 1 ) ); // We grab the z-buffer for the selection region all at once and probe the resulting array. float *aZPtr = theRenderer->GetRenderWindow()-> GetZbufferData(theSelection[0], theSelection[1], theSelection[2], theSelection[3]); //cout<<"theSelection = {"<DeepCopy(theRenderer->GetActiveCamera()-> - GetCompositePerspectiveTransformMatrix(1,0,1)); + GetCompositePerspectiveTransformMatrix( theRenderer->GetTiledAspectRatio(), 0, 1 ) ); for(vtkIdType aCellId = 0; aCellId < aNumCells; aCellId++){ vtkCell* aCell = theInput->GetCell(aCellId); diff --git a/src/SVTK/SVTK_RenderWindowInteractor.cxx b/src/SVTK/SVTK_RenderWindowInteractor.cxx index 439837e68..e2853e1d6 100644 --- a/src/SVTK/SVTK_RenderWindowInteractor.cxx +++ b/src/SVTK/SVTK_RenderWindowInteractor.cxx @@ -38,9 +38,8 @@ // Put Qt includes before the X11 includes which #define the symbol None // (see SVTK_SpaceMouse.h) to avoid the compilation error. #ifndef WIN32 -#include +# include #endif - #include #include "SVTK_SpaceMouse.h" @@ -420,7 +419,7 @@ QVTK_RenderWindowInteractor bool QVTK_RenderWindowInteractor::winEvent( MSG* msg, long* result ) { // TODO: Implement event handling for SpaceMouse - return QWidget::winEvent( msg, result ); + return QWidget::winEvent( msg, result); } #else -- 2.39.2