]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
Merging GUI_SRC module with the BR_HDF_dev_merged branch, which has been merged with...
authornds <nds@opencascade.com>
Tue, 7 Oct 2008 09:04:53 +0000 (09:04 +0000)
committernds <nds@opencascade.com>
Tue, 7 Oct 2008 09:04:53 +0000 (09:04 +0000)
src/SVTK/SVTK_InteractorStyle.cxx
src/SVTK/SVTK_MainWindow.cxx
src/SVTK/SVTK_MainWindow.h
src/SVTK/SVTK_RectPicker.cxx
src/SVTK/SVTK_RenderWindowInteractor.cxx

index e9032bdcdbf7d7d4939cb50d9f2570a932b842a9..6c8d3211119ffbe46f1386bcb19259712db06d15 100644 (file)
@@ -49,7 +49,6 @@
 #include <vtkCommand.h>
 #include <vtkCamera.h>
 #include <vtkRenderer.h>
-#include <vtkPicker.h>
 #include <vtkPointPicker.h>
 #include <vtkRenderWindow.h>
 #include <vtkRenderWindowInteractor.h>
@@ -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<SALOME_Actor>(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();
index 106edad4a3173555ffc62ddb54945798e5e27e07..d23d48393e005d88e6d4c38eada44e9f412a0eed 100644 (file)
 
 #include <QImage>
 #include <QPainter>
-#include <QApplication>
+
+#include <vtkGenericRenderWindowInteractor.h>
+#include <vtkRenderer.h>
+#include <vtkRenderWindow.h>
 
 #include <QtxAction.h>
 #include <QtxMultiAction.h>
 #include <QtxToolBar.h>
+#include <QtxActionToolMgr.h>
 
 #include <SUIT_MessageBox.h>
 #include <SUIT_ViewWindow.h>
 #include <SUIT_Tools.h>
 #include <SUIT_ResourceMgr.h>
+#include <SUIT_Session.h>
 
 #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"
 #include "SVTK_InteractorStyle.h"
 #include "SVTK_Selector.h"
 
-#include <vtkGenericRenderWindowInteractor.h>
-#include <vtkRenderer.h>
-#include <vtkRenderWindow.h>
-
 /*!
   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<QtxAction*>( toolMgr()->action( id ) );
 }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
index 95503a88ed5248f3f1b4aeb488d0f81615629050..b2e892634d9d9080adf03d39c6a2755dac90900e 100644 (file)
 #include "SVTK.h"
 #include "SVTK_Selection.h"
 
-#include <vtkSmartPointer.h>
-
 #include <QMainWindow>
 #include <QMap>
 
-class QtxAction;
+#include <vtkSmartPointer.h>
 
 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<int, QtxAction*> TActionsMap;
 
   SUIT_ViewWindow* myViewWindow;
 
@@ -268,8 +270,7 @@ public:
   SVTK_TextRegionDlg* myTextRegionDlg;
 
   vtkSmartPointer<vtkObject> myEventDispatcher;
-  TActionsMap myActionsMap;  
-  QToolBar* myToolBar;
+  int myToolBar;
 
   SVTK_RenderWindowInteractor* myInteractor;
 };
index 9aaad409eeb3d19dc660ec8b3f1f176c99b17b14..8d6cfe07b8b3307eddf25cd5d38580ee392529ab 100644 (file)
@@ -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 = {"<<theSelection[0]<<", "<<theSelection[1]<<", "<<theSelection[2]<<", "<<theSelection[3]<<"}\n";
-    /*
+
+    //cout<<"\t";
+    for(int iX = theSelection[0]; iX <= theSelection[2];  iX++){
+      //cout<<iX<<"\t";
+    }
+    //cout<<endl;
+
     for(int iY = theSelection[1]; iY <= theSelection[3];  iY++){
+      //cout<<iY<<"\t";
       for(int iX = theSelection[0]; iX <= theSelection[2];  iX++){
-       cout<<GetZ(aZPtr,theSelection,iX,iY)<<" ";
+       //cout<<std::setprecision(4)<<GetZ(aZPtr,theSelection,iX,iY)<<"\t";
       }
-      cout<<endl;
+      //cout<<endl;
     }
-    */
+
     for(vtkIdType aPntId = 0; aPntId < aNumPts; aPntId++){
       // perform conversion
       vtkFloatingPointType aX[4] = {1.0, 1.0, 1.0, 1.0};
@@ -254,7 +261,7 @@ namespace
     // and handle the transformation ourselves.
     vtkMatrix4x4 *aMatrix = vtkMatrix4x4::New();
     aMatrix->DeepCopy(theRenderer->GetActiveCamera()->
-                     GetCompositePerspectiveTransformMatrix(1,0,1));
+                     GetCompositePerspectiveTransformMatrix( theRenderer->GetTiledAspectRatio(), 0, 1 ) );
 
     for(vtkIdType aCellId = 0; aCellId < aNumCells; aCellId++){
       vtkCell* aCell = theInput->GetCell(aCellId);
index 439837e68907cad7ca5a0c0a40d88b0dec7d6b45..e2853e1d6b352cc4afd71b3b0357f602c5725965 100644 (file)
@@ -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 <QX11Info>
+# include <QX11Info>
 #endif
-
 #include <QMouseEvent>
 
 #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