]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
Help documentation was added. Behavior of OCC and VTK stereo projection toolbar butto...
authorakl <alexander.kovalev@opencascade.com>
Tue, 11 Aug 2015 10:17:01 +0000 (14:17 +0400)
committerakl <alexander.kovalev@opencascade.com>
Tue, 11 Aug 2015 10:17:39 +0000 (14:17 +0400)
14 files changed:
doc/salome/gui/images/occ_view_orthographic.png [new file with mode: 0644]
doc/salome/gui/images/occ_view_perspective.png [new file with mode: 0644]
doc/salome/gui/images/occ_view_stereo.png [new file with mode: 0644]
doc/salome/gui/images/occviewer_toolbar.png
doc/salome/gui/images/pref_salome_general.png
doc/salome/gui/images/pref_salome_occviewer.png
doc/salome/gui/images/pref_salome_vtkviewer.png
doc/salome/gui/input/occ_3d_viewer.doc
doc/salome/gui/input/setting_preferences.doc
src/OCCViewer/OCCViewer_ViewWindow.cxx
src/OCCViewer/OCCViewer_ViewWindow.h
src/SVTK/SVTK_ViewModel.cxx
src/SVTK/SVTK_ViewWindow.cxx
src/SVTK/SVTK_ViewWindow.h

diff --git a/doc/salome/gui/images/occ_view_orthographic.png b/doc/salome/gui/images/occ_view_orthographic.png
new file mode 100644 (file)
index 0000000..dd7a676
Binary files /dev/null and b/doc/salome/gui/images/occ_view_orthographic.png differ
diff --git a/doc/salome/gui/images/occ_view_perspective.png b/doc/salome/gui/images/occ_view_perspective.png
new file mode 100644 (file)
index 0000000..36cdd4c
Binary files /dev/null and b/doc/salome/gui/images/occ_view_perspective.png differ
diff --git a/doc/salome/gui/images/occ_view_stereo.png b/doc/salome/gui/images/occ_view_stereo.png
new file mode 100644 (file)
index 0000000..218a2a6
Binary files /dev/null and b/doc/salome/gui/images/occ_view_stereo.png differ
index 5a16df1760acf3ab06712be44c34fce7c7497ebd..c8eefa245bcc920a9ad472db4801c3da6b28be16 100644 (file)
Binary files a/doc/salome/gui/images/occviewer_toolbar.png and b/doc/salome/gui/images/occviewer_toolbar.png differ
index 81969122e49a6d51494963b760da70f72c86be0d..33abfe513ddc03951355f93d6ca8a06afa3af45e 100644 (file)
Binary files a/doc/salome/gui/images/pref_salome_general.png and b/doc/salome/gui/images/pref_salome_general.png differ
index 8d7e26994a73b5f06b128c69cc42d516066a8a13..72eef91a10c049744e9c130b815fd37c7bfcb0fc 100644 (file)
Binary files a/doc/salome/gui/images/pref_salome_occviewer.png and b/doc/salome/gui/images/pref_salome_occviewer.png differ
index 8efa707f6b4f6a59470e90093811135695b0f8ec..e8369e36b0fd4e6a73e883bc969ce9cc1fdef18b 100644 (file)
Binary files a/doc/salome/gui/images/pref_salome_vtkviewer.png and b/doc/salome/gui/images/pref_salome_vtkviewer.png differ
index e80bab975bc6524c31022b85afd27a851bb7a418..e4694409e087a63197f79d74f5c371b3eca43448 100644 (file)
@@ -137,6 +137,28 @@ These buttons orientate the scene strictly about coordinate axes:
 <b>Rotate clockwise</b> - rotates view 90 @htmlonly &deg; @endhtmlonly clockwise.
 <hr>
 
+\image html occ_view_orthographic.png
+
+<b>Ortographic projection</b> - default OCC viewer projection mode.
+<hr>
+
+\image html occ_view_perspective.png
+
+<b>Perspective projection</b> - perspective OCC viewer projection mode.
+<hr>
+
+\image html occ_view_stereo.png
+
+<b>Stereo projection</b> - stereoscopic rendering of the view.
+\note Activation of this mode also switches the view to perpective projection 
+in case if orthographic one has been active.
+\note By default, quad-buffered stereo is activated, if it is supported by graphic card. 
+If no stereo capabilities are available, an error message is shown.
+\note Settigs of stereoscopic view take place in 
+\ref occ_preferences "OCC 3D Viewer" preferences.
+
+<hr>
+
 \image html occ_view_reset.png
 
 <b>Reset</b> - restores the default position (isometric) of objects in
index 0d9c9094f94cf48f988ae7b45393463969e77537..b1c6bea108e00e004b51986af5093012fcb8af8b 100644 (file)
@@ -101,6 +101,9 @@ items in <b>Most Recently Used</b> list and the <b>Link type</b>:
   - \b Short - shows the file name only.
   - \b Auto - shows full paths to the files only if some files from
 different locations have the same name.
+- <b>Full-screen</b> - options concerned full-screen mode:
+  - <b>Hide object browser and viewers toolbars</b> - switches automatic hiding of 
+  Object Browser and OCC viewer toolbar in full-screen mode.
 
 <h2>3D Viewer Preferences</h2>
 
@@ -136,6 +139,36 @@ different locations have the same name.
 
 \image html pref_salome_occviewer.png
 
+- <b>Projection mode</b> - sets the default projection mode for the viewers: Orthogonal or Perpective.
+- <b>Stereo render</b> - group of stereoscopic view settings:
+  - <b>Stereo type</b> - specifies a stereo pair type:
+    - Shutter glasses (OpenGL quad-buffer)
+    - Anaglyph
+    - Row-interlaced
+    - Column-interlaced
+    - Chess-board stereo for DLP TVs
+    - Horizontal-anamorphic (side-by-side)
+    - Vertical-anamorphic (Half OverUnder)
+    \note The stereo pair type selected in this combobox is applied 
+    for all existing OCC 3D views with stereo rendering already turned on 
+    within the same SALOME GUI session. It is not possible to use 
+    different stereo modes in several OCC 3D views at the same time 
+    within the same SALOME GUI session.
+  - <b>Anaglyph filter</b> - specifies format of anaglyph stereo pair:
+    - Red-Cyan (default)
+    - Yellow-Blue
+    - Green-Magenta
+  - <b>Convergence distance type</b>: Absolute or Relative (default).
+  - <b>Stereographic focus value</b> - 1 by default.
+  - <b>IOD type</b> - Absolute or Relative (default).
+  - <b>Interocular distance (IOD) value</b> - 0.05 by default.
+  - <b>Reverse stereo</b> - option to swap left and right frames.
+  - <b>Enable V-Sync</b> - activates vertical synchronization.
+  - <b>Enable quad-buffer support</b> - allows quad-buffered rendering.
+  \note It is neccessary to enable quad-buffered stereoscopic rendering 
+  manually in graphic driver settings. SALOME does not do it automatically.
+  \note All existing OCC 3D views should be re-created for quad-buffer support.
+
 - <b>Background</b> - specifies the default background for the viewers,
   separately for (for more details, refer to the \ref viewer_background
   "this page"):
@@ -168,6 +201,30 @@ different locations have the same name.
   or [-] keyboard buttons.
 - <b>Modification Mode</b> - allows choosing between \b Arithmetic
   and \b Geometrical progression used for zooming.
+- <b>Stereo render</b> - group of stereoscopic view settings:
+  - <b>Stereo type</b> - specifies a stereo pair type:
+    - Crystal Eyes
+    - Red-Blue
+    - Interlaced
+    - Left
+    - Right
+    - Dresden
+    - Anaglyph
+    - Checkerboard
+    - Split View Port Horizontal
+    \note The stereo pair type selected in this combobox is applied 
+    for all existing VTK 3D views with stereo rendering already turned on 
+    within the same SALOME GUI session. It is not possible to use 
+    different stereo modes in several VTK 3D views at the same time 
+    within the same SALOME GUI session.
+  - <b>Anaglyph filter</b> - specifies format of anaglyph stereo pair:
+    - Red-Cyan (default)
+    - Yellow-Blue
+    - Green-Magenta
+  - <b>Enable quad-buffer support</b> - allows quad-buffered rendering.
+  \note It is neccessary to enable quad-buffered stereoscopic rendering 
+  manually in graphic driver settings. SALOME does not do it automatically.
+  \note All existing VTK 3D views should be re-created for quad-buffer support.
 - <b>Selection</b>
   - <b>Preselection</b> - allows to choose among three possible preselection modes:
     - <b>Standard</b> - this mode works quickly, by checking only 
index 6d03da7df0ddb8e68acd2c8b67194df9a5a9e718..7ceb65ef17e9c7ba92884ed0f2e834e0d3fae052 100755 (executable)
@@ -1292,7 +1292,6 @@ void OCCViewer_ViewWindow::createActions()
                           tr( "MNU_ORTHOGRAPHIC_MODE" ), 0, this);
   aAction->setStatusTip(tr("DSC_ORTHOGRAPHIC_MODE"));
   aAction->setCheckable(true);
-  //connect(aAction, SIGNAL(toggled(bool)), this, SLOT(onProjectionType()));
   toolMgr()->registerAction( aAction, OrthographicId );
 
   // - perspective projection
@@ -1300,7 +1299,6 @@ void OCCViewer_ViewWindow::createActions()
                           tr( "MNU_PERSPECTIVE_MODE" ), 0, this);
   aAction->setStatusTip(tr("DSC_PERSPECTIVE_MODE"));
   aAction->setCheckable(true);
-  //connect(aAction, SIGNAL(toggled(bool)), this, SLOT(onProjectionType()));
   toolMgr()->registerAction( aAction, PerspectiveId );
 #if OCC_VERSION_LARGE > 0x06090000
   // - stereo projection
@@ -1309,17 +1307,14 @@ void OCCViewer_ViewWindow::createActions()
   aAction->setStatusTip(tr("DSC_STEREO_MODE"));
   aAction->setCheckable(true);
   toolMgr()->registerAction( aAction, StereoId );
-  //connect(aAction, SIGNAL(toggled(bool)), this, SLOT(onProjectionType()));
+  connect(aAction, SIGNAL(triggered(bool)), this, SLOT(onStereoType(bool)));
 #endif
   // - add exclusive action group
   QActionGroup* aProjectionGroup = new QActionGroup( this );
   aProjectionGroup->addAction( toolMgr()->action( OrthographicId ) );
   aProjectionGroup->addAction( toolMgr()->action( PerspectiveId ) );
-#if OCC_VERSION_LARGE > 0x06090000
-  aProjectionGroup->addAction( toolMgr()->action( StereoId ) );
-#endif
-  connect(aProjectionGroup, SIGNAL(triggered(QAction*)), this, SLOT(onProjectionType()));
-
+  connect(aProjectionGroup, SIGNAL(triggered(QAction*)), this, SLOT(onProjectionType(QAction*)));
+  
   // Reset
   aAction = new QtxAction(tr("MNU_RESET_VIEW"), aResMgr->loadPixmap( "OCCViewer", tr( "ICON_OCCVIEWER_VIEW_RESET" ) ),
                            tr( "MNU_RESET_VIEW" ), 0, this, false, "Viewers:Reset view");
@@ -1643,24 +1638,159 @@ void OCCViewer_ViewWindow::onResetView()
 }
 
 /*!
-  \brief Perform "reset view" transformation.
+  \brief Set the given projection mode.
 
-  Sets default orientation of the viewport camera.
+  Set the given projection mode: Orthographic or Perspective.
+*/
+void OCCViewer_ViewWindow::onProjectionType( QAction* theAction )
+{
+  Handle(V3d_View) aView3d = myViewPort->getView();
+  if ( !aView3d.IsNull() ) {
+    Handle(Graphic3d_Camera) aCamera = aView3d->Camera();
+    if (theAction == toolMgr()->action( OrthographicId )) {
+      myModel->setProjectionType(Orthographic);
+      aCamera->SetProjectionType ( Graphic3d_Camera::Projection_Orthographic );
+    }
+    else if (theAction == toolMgr()->action( PerspectiveId )) {
+      myModel->setProjectionType(Perspective);
+      aCamera->SetProjectionType ( Graphic3d_Camera::Projection_Perspective );
+    }
+    if (toolMgr()->action( StereoId )->isChecked())
+      aCamera->SetProjectionType ( Graphic3d_Camera::Projection_Stereo );
+    aView3d->Redraw();
+    onViewFitAll();
+  }
+}
+
+/*!
+  \brief Sets Stereo projection mode.
+
+  Sets Stereo projection mode.
+*/
+void OCCViewer_ViewWindow::onStereoType( bool activate )
+{
+#if OCC_VERSION_LARGE > 0x06090000
+  Handle(V3d_View) aView3d = myViewPort->getView();
+  if ( !aView3d.IsNull() ) {
+    Handle(Graphic3d_Camera) aCamera = aView3d->Camera();
+    if (activate) {
+      toolMgr()->action( PerspectiveId )->setChecked(true);
+      aCamera->SetProjectionType(Graphic3d_Camera::Projection_Perspective);
+      toolMgr()->action( PerspectiveId )->actionGroup()->setEnabled(false);
+
+      aCamera->SetProjectionType ( Graphic3d_Camera::Projection_Stereo );
+      SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
+      setStereoType( aResMgr->integerValue( "OCCViewer", "stereo_type", 0 ) );
+      setAnaglyphFilter( aResMgr->integerValue( "OCCViewer", "anaglyph_filter", 0 ) );
+      setReverseStereo( aResMgr->booleanValue( "OCCViewer", "reverse_stereo", false ) );
+      setVSync( aResMgr->booleanValue( "OCCViewer", "enable_vsync", true ) );
+      setQuadBufferSupport( aResMgr->booleanValue( "OCCViewer", "enable_quad_buffer_support", false ) );
+    }
+    else {
+      toolMgr()->action( PerspectiveId )->actionGroup()->setEnabled(true);
+      if (myModel->projectionType() == Orthographic) {
+        toolMgr()->action( OrthographicId )->setChecked(true);
+        aCamera->SetProjectionType(Graphic3d_Camera::Projection_Orthographic);
+      }
+      else if (myModel->projectionType() == Perspective) {
+        toolMgr()->action( PerspectiveId )->setChecked(true);
+        aCamera->SetProjectionType(Graphic3d_Camera::Projection_Perspective);
+      }
+    }
+    aView3d->Redraw();
+    onViewFitAll();
+  }
+
+  if ( isQuadBufferSupport() && !isOpenGlStereoSupport() && stereoType() == QuadBuffer )
+    SUIT_MessageBox::warning( 0, tr( "WRN_WARNING" ),  tr( "WRN_SUPPORT_QUAD_BUFFER" ) );
+#endif
+}
+
+/*!
+  \brief Restore the view.
+
+  Restore the projection mode based on tool-buttons states.
 */
 void OCCViewer_ViewWindow::onProjectionType()
 {
   emit vpTransformationStarted( PROJECTION );
   if (toolMgr()->action( OrthographicId )->isChecked())
-    setProjectionType( Orthographic);
+    setProjectionType( Orthographic );
   if (toolMgr()->action( PerspectiveId )->isChecked())
-    setProjectionType( Perspective);
+    setProjectionType( Perspective );
 #if OCC_VERSION_LARGE > 0x06090000
   if (toolMgr()->action( StereoId )->isChecked())
-    setProjectionType( Stereo);
+    setProjectionType( Stereo );
 #endif
   emit vpTransformationFinished( PROJECTION );
 }
 
+void OCCViewer_ViewWindow::setProjectionType( int mode )
+{
+  QtxAction* anOrthographicAction = dynamic_cast<QtxAction*>( toolMgr()->action( OrthographicId ) );
+  QtxAction* aPerspectiveAction = dynamic_cast<QtxAction*>( toolMgr()->action( PerspectiveId ) );
+#if OCC_VERSION_LARGE > 0x06090000
+  QtxAction* aStereoAction = dynamic_cast<QtxAction*>( toolMgr()->action( StereoId ) );
+#endif
+  switch ( mode ) {
+    case Orthographic:
+      onProjectionType( anOrthographicAction );
+      break;
+    case Perspective:
+      onProjectionType( aPerspectiveAction );
+      break;
+    case Stereo:
+      onStereoType( true );
+      break;
+  }
+  // update action state if method is called outside
+  if ( mode == Orthographic && !anOrthographicAction->isChecked() ) {
+         anOrthographicAction->setChecked( true );
+    #if OCC_VERSION_LARGE > 0x06090000
+         aStereoAction->setChecked( false );
+    #endif
+  }
+  if ( mode == Perspective && !aPerspectiveAction->isChecked() ) {
+         aPerspectiveAction->setChecked( true );
+    #if OCC_VERSION_LARGE > 0x06090000
+         aStereoAction->setChecked( false );
+    #endif
+  }
+#if OCC_VERSION_LARGE > 0x06090000
+  if ( mode == Stereo ) {
+    aStereoAction->setChecked( true );
+    if ( anOrthographicAction->isEnabled() ) {
+      anOrthographicAction->setEnabled( false );
+      anOrthographicAction->setChecked( false );
+      aStereoAction->setChecked( false );
+    }
+    else {
+      anOrthographicAction->setEnabled( true );
+      aStereoAction->setChecked( false );
+      anOrthographicAction->setChecked(myModel->projectionType() == Orthographic);
+    }
+    if ( aPerspectiveAction->isEnabled() ) {
+      aPerspectiveAction->setEnabled( false );
+      aPerspectiveAction->setChecked( true );
+      if ( isQuadBufferSupport() && !isOpenGlStereoSupport() && stereoType() == QuadBuffer )
+        SUIT_MessageBox::warning( 0, tr( "WRN_WARNING" ),  tr( "WRN_SUPPORT_QUAD_BUFFER" ) );
+    }
+    else {
+      aPerspectiveAction->setEnabled( true );
+      aStereoAction->setChecked( false );
+      aPerspectiveAction->setChecked(myModel->projectionType() == Perspective);
+      onProjectionType();
+    }
+  }
+  else {
+    if ( !anOrthographicAction->isEnabled() )
+      anOrthographicAction->setEnabled( true );
+    if ( !aPerspectiveAction->isEnabled() )
+      aPerspectiveAction->setEnabled( true );
+  }
+#endif
+}
+
 /*!
   \brief Perform "fit all" transformation.
 */
@@ -2817,88 +2947,6 @@ void OCCViewer_ViewWindow::set2dMode(Mode2dType theType)
   my2dMode = theType;
 }
 
-void OCCViewer_ViewWindow::setProjectionType( int mode )
-{
-  Handle(V3d_View) aView3d = myViewPort->getView();
-  if ( !aView3d.IsNull() ) {
-    Handle(Graphic3d_Camera) aCamera = aView3d->Camera();
-    if (mode == Perspective) {
-      myModel->setProjectionType(Perspective);
-      aCamera->SetProjectionType ( Graphic3d_Camera::Projection_Perspective );
-    }
-    if (mode == Orthographic) {
-      myModel->setProjectionType(Orthographic);
-      aCamera->SetProjectionType ( Graphic3d_Camera::Projection_Orthographic );
-    }
-  #if OCC_VERSION_LARGE > 0x06090000
-    if (mode == Stereo) {
-      aCamera->SetProjectionType ( Graphic3d_Camera::Projection_Stereo );
-      SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
-      setStereoType( aResMgr->integerValue( "OCCViewer", "stereo_type", 0 ) );
-      setAnaglyphFilter( aResMgr->integerValue( "OCCViewer", "anaglyph_filter", 0 ) );
-      setReverseStereo( aResMgr->booleanValue( "OCCViewer", "reverse_stereo", false ) );
-      setVSync( aResMgr->booleanValue( "OCCViewer", "enable_vsync", true ) );
-      setQuadBufferSupport( aResMgr->booleanValue( "OCCViewer", "enable_quad_buffer_support", false ) );
-    }
-  #endif
-    aView3d->Redraw();
-    onViewFitAll();
-  }
-  // update action state if method is called outside
-  QtxAction* anOrthographicAction = dynamic_cast<QtxAction*>( toolMgr()->action( OrthographicId ) );
-  QtxAction* aPerspectiveAction = dynamic_cast<QtxAction*>( toolMgr()->action( PerspectiveId ) );
-#if OCC_VERSION_LARGE > 0x06090000
-  QtxAction* aStereoAction = dynamic_cast<QtxAction*>( toolMgr()->action( StereoId ) );
-#endif
-  if ( mode == Orthographic && !anOrthographicAction->isChecked() ) {
-         anOrthographicAction->setChecked( true );
-    #if OCC_VERSION_LARGE > 0x06090000
-         aStereoAction->setChecked( false );
-    #endif
-  }
-  if ( mode == Perspective && !aPerspectiveAction->isChecked() ) {
-         aPerspectiveAction->setChecked( true );
-    #if OCC_VERSION_LARGE > 0x06090000
-         aStereoAction->setChecked( false );
-    #endif
-  }
-#if OCC_VERSION_LARGE > 0x06090000
-  if ( mode == Stereo ) {
-    aStereoAction->setChecked( true );
-    if ( anOrthographicAction->isEnabled() ) {
-      anOrthographicAction->setEnabled( false );
-      anOrthographicAction->setChecked( false );
-      aStereoAction->setChecked( false );
-    }
-    else {
-      anOrthographicAction->setEnabled( true );
-      aStereoAction->setChecked( false );
-      anOrthographicAction->setChecked(myModel->projectionType() == Orthographic);
-    }
-    if ( aPerspectiveAction->isEnabled() ) {
-      aPerspectiveAction->setEnabled( false );
-      aPerspectiveAction->setChecked( true );
-    #if OCC_VERSION_LARGE > 0x06090000
-      if ( isQuadBufferSupport() && !isOpenGlStereoSupport() && stereoType() == QuadBuffer )
-        SUIT_MessageBox::warning( 0, tr( "WRN_WARNING" ),  tr( "WRN_SUPPORT_QUAD_BUFFER" ) );
-    #endif
-    }
-    else {
-      aPerspectiveAction->setEnabled( true );
-      aStereoAction->setChecked( false );
-      aPerspectiveAction->setChecked(myModel->projectionType() == Perspective);
-      onProjectionType();
-    }
-  }
-  else {
-    if ( !anOrthographicAction->isEnabled() )
-      anOrthographicAction->setEnabled( true );
-    if ( !aPerspectiveAction->isEnabled() )
-      aPerspectiveAction->setEnabled( true );
-  }
-#endif
-}
-
 int OCCViewer_ViewWindow::projectionType() const
 {
   int mode = Orthographic;
index 08f4202e36ebe299ccb832e69027767a49de7a94..dff660d7233df0ba2aa3ab9bc365aa9186917b33 100755 (executable)
@@ -279,6 +279,8 @@ public slots:
   virtual void onRightView();
   virtual void onClockWiseView();
   virtual void onAntiClockWiseView();
+  virtual void onProjectionType( QAction* theAction );
+  virtual void onStereoType( bool activate );
   virtual void onProjectionType();
   virtual void onResetView();
   virtual void onFitAll();
index 9109c2f80042c0cd43969418e747a8a50292b2b5..4a257b5f7fc07edd40b46805432cf651e6308e5f 100644 (file)
@@ -290,7 +290,7 @@ void SVTK_Viewer::setProjectionMode( const int theMode )
 {
   if ( myProjMode != theMode ) {
     if ( theMode != SVTK_ViewWindow::Stereo )
-         myProjMode = theMode;
+      myProjMode = theMode;
     if (SUIT_ViewManager* aViewManager = getViewManager()) {
       QVector<SUIT_ViewWindow*> aViews = aViewManager->getViews();
       for ( uint i = 0; i < aViews.count(); i++ )
index 88bee3fc564129f013c040b977cb08d48376f1f8..5352ef1450b442e839760ff00d6c6d1b08175305 100755 (executable)
@@ -859,27 +859,24 @@ double SVTK_ViewWindow::GetTrihedronSize() const
 */
 void SVTK_ViewWindow::SetProjectionMode(const int theMode)
 {
-  SVTK_Viewer* aViewer = dynamic_cast<SVTK_Viewer*>(myModel);
+  QtxAction* aParallelAction = dynamic_cast<QtxAction*>( toolMgr()->action( ParallelModeId ) );
+  QtxAction* aProjectionAction = dynamic_cast<QtxAction*>( toolMgr()->action( ProjectionModeId ) );
+  QtxAction* aStereoAction = dynamic_cast<QtxAction*>( toolMgr()->action( StereoModeId ) );
 
-  if ( theMode != Stereo ) {
-    aViewer->setProjectionMode(theMode);
-    bool anIsParallelMode = (theMode == Parallel);
-    vtkCamera* aCamera = getRenderer()->GetActiveCamera();
-    aCamera->SetParallelProjection(anIsParallelMode);
-    GetInteractor()->GetDevice()->CreateTimer(VTKI_TIMER_FIRST);
-    getRenderWindow()->SetStereoRender(0);
-  }
-  else {
-    SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
-    SetStereoType( aResMgr->integerValue( "VTKViewer", "stereo_type", 0 ) );
-    getRenderWindow()->SetStereoRender(1);
+  switch ( theMode ) {
+    case Parallel:
+      onProjectionMode( aParallelAction );
+      break;
+    case Projection:
+      onProjectionMode( aProjectionAction );
+      break;
+    case Stereo:
+      onStereoMode( true );
+      break;
   }
-  Repaint();
 
   // update action state if method is called outside
-  QtxAction* aParallelAction = dynamic_cast<QtxAction*>( toolMgr()->action( ParallelModeId ) );
-  QtxAction* aProjectionAction = dynamic_cast<QtxAction*>( toolMgr()->action( ProjectionModeId ) );
-  QtxAction* aStereoAction = dynamic_cast<QtxAction*>( toolMgr()->action( StereoModeId ) );
+  SVTK_Viewer* aViewer = dynamic_cast<SVTK_Viewer*>(myModel);
   QtxAction* aSwitchZoomingStyle = dynamic_cast<QtxAction*>( toolMgr()->action( SwitchZoomingStyleId ) );
   if ( theMode == Parallel && !aParallelAction->isChecked() ) {
       aParallelAction->setChecked( true );
@@ -914,7 +911,7 @@ void SVTK_ViewWindow::SetProjectionMode(const int theMode)
       aProjectionAction->setEnabled( true );
       aStereoAction->setChecked( false );
       aProjectionAction->setChecked( aViewer->projectionMode() == Projection );
-      onPerspectiveMode();
+      onProjectionMode();
     }
   }
   else {
@@ -2030,10 +2027,61 @@ void SVTK_ViewWindow::activateStartPointSelection( Selection_Mode theSelectionMo
   myEventDispatcher->InvokeEvent(SVTK::StartPointSelection,0);
 }
 
+/*!
+  \brief Set the given projection mode.
+
+  Set the given projection mode: Orthographic or Perspective.
+*/
+void SVTK_ViewWindow::onProjectionMode( QAction* theAction )
+{
+  int aMode = Parallel;
+  if (theAction == toolMgr()->action( ProjectionModeId ))
+    aMode = Projection;
+  SVTK_Viewer* aViewer = dynamic_cast<SVTK_Viewer*>(myModel);
+  aViewer->setProjectionMode(aMode);
+  bool anIsParallelMode = (aMode == Parallel);
+  vtkCamera* aCamera = getRenderer()->GetActiveCamera();
+  aCamera->SetParallelProjection(anIsParallelMode);
+  GetInteractor()->GetDevice()->CreateTimer(VTKI_TIMER_FIRST);
+  getRenderWindow()->SetStereoRender(0);
+  Repaint();
+}
+
+/*!
+  \brief Sets Stereo projection mode.
+
+  Sets Stereo projection mode.
+*/
+void SVTK_ViewWindow::onStereoMode( bool activate )
+{
+  if (activate) {
+    toolMgr()->action( ProjectionModeId )->setChecked(true);
+    vtkCamera* aCamera = getRenderer()->GetActiveCamera();
+    aCamera->SetParallelProjection(false);
+    toolMgr()->action( ProjectionModeId )->actionGroup()->setEnabled(false);
+    SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
+    SetStereoType( aResMgr->integerValue( "VTKViewer", "stereo_type", 0 ) );
+    getRenderWindow()->SetStereoRender(1);
+    Repaint();
+  }
+  else {
+    toolMgr()->action( ProjectionModeId )->actionGroup()->setEnabled(true);
+    SVTK_Viewer* aViewer = dynamic_cast<SVTK_Viewer*>(myModel);
+    if (aViewer->projectionMode() == Parallel) {
+      toolMgr()->action( ParallelModeId )->setChecked(true);
+      onProjectionMode(toolMgr()->action( ParallelModeId ));
+    }
+    else if (aViewer->projectionMode() == Projection) {
+      toolMgr()->action( ProjectionModeId )->setChecked(true);
+      onProjectionMode(toolMgr()->action( ProjectionModeId ));
+    }
+  }
+}
+
 /*!
   Set the view projection mode: orthogonal or perspective
 */
-void SVTK_ViewWindow::onPerspectiveMode()
+void SVTK_ViewWindow::onProjectionMode()
 {
   if (toolMgr()->action( ParallelModeId )->isChecked())
     SetProjectionMode( Parallel);
@@ -2250,7 +2298,6 @@ void SVTK_ViewWindow::createActions(SUIT_ResourceMgr* theResourceMgr)
                            tr( "MNU_SVTK_PARALLEL_MODE" ), 0, this);
   anAction->setStatusTip(tr("DSC_SVTK_PARALLEL_MODE"));
   anAction->setCheckable(true);
-  //connect(anAction, SIGNAL(toggled(bool)), this, SLOT(onPerspectiveMode()));
   mgr->registerAction( anAction, ParallelModeId );
 
   anAction = new QtxAction(tr("MNU_SVTK_PERSPECTIVE_MODE"), 
@@ -2258,7 +2305,6 @@ void SVTK_ViewWindow::createActions(SUIT_ResourceMgr* theResourceMgr)
                            tr( "MNU_SVTK_PERSPECTIVE_MODE" ), 0, this);
   anAction->setStatusTip(tr("DSC_SVTK_PERSPECTIVE_MODE"));
   anAction->setCheckable(true);
-  //connect(anAction, SIGNAL(toggled(bool)), this, SLOT(onPerspectiveMode()));
   mgr->registerAction( anAction, ProjectionModeId );
 
   anAction = new QtxAction(tr("MNU_SVTK_STEREO_MODE"),
@@ -2266,14 +2312,13 @@ void SVTK_ViewWindow::createActions(SUIT_ResourceMgr* theResourceMgr)
                              tr( "MNU_SVTK_STEREO_MODE" ), 0, this);
   anAction->setStatusTip(tr("DSC_SVTK_STEREO_MODE"));
   anAction->setCheckable(true);
-  //connect(anAction, SIGNAL(toggled(bool)), this, SLOT(onPerspectiveMode()));
+  connect(anAction, SIGNAL(triggered(bool)), this, SLOT(onStereoMode(bool)));
   mgr->registerAction( anAction, StereoModeId );
 
   QActionGroup* aPerspectiveGroup = new QActionGroup( this );
   aPerspectiveGroup->addAction( mgr->action( ParallelModeId ) );
   aPerspectiveGroup->addAction( mgr->action( ProjectionModeId ) );
-  aPerspectiveGroup->addAction( mgr->action( StereoModeId ) );
-  connect(aPerspectiveGroup, SIGNAL(triggered(QAction*)), this, SLOT(onPerspectiveMode()));
+  connect(aPerspectiveGroup, SIGNAL(triggered(QAction*)), this, SLOT(onProjectionMode(QAction*)));
 
   // View Parameters
   anAction = new QtxAction(tr("MNU_VIEWPARAMETERS_VIEW"), 
index b0de0c81bfd2310fd00bbc04fc77433ba1d968ef..cc1beb3e04b98a6c6c9412174b851cddfb79b5b6 100755 (executable)
@@ -315,7 +315,9 @@ public slots:
   void activatePanning(); 
   void activateGlobalPanning(); 
 
-  void onPerspectiveMode();
+  void onProjectionMode( QAction* theAction );
+  void onStereoMode( bool activate );
+  void onProjectionMode();
 
   void activateProjectionMode(int);