From: imn Date: Fri, 1 Nov 2013 13:33:03 +0000 (+0000) Subject: Issue 0022171: X-Git-Tag: BR_hydro_v_0_3_1~17 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=78f34627dfd8f4f0749cde421df3a33e1b876c96;p=modules%2Fgui.git Issue 0022171: - Additinally: show "Return to 3D" button in 2D projection views to quickly switch to 3D mode --- diff --git a/doc/salome/gui/input/occ_3d_viewer.doc b/doc/salome/gui/input/occ_3d_viewer.doc index 647318992..bb4818e14 100644 --- a/doc/salome/gui/input/occ_3d_viewer.doc +++ b/doc/salome/gui/input/occ_3d_viewer.doc @@ -248,6 +248,11 @@ on/off. view area to the minimized / maximized state.
+\image html occ_view_return_3d_view.png + +Return to 3D - this button switches from 2D view projection back to the 3D view mode. +
+ \image html occ_view_sync.png Synchronize view - allows to synchronize 3d view diff --git a/src/OCCViewer/CMakeLists.txt b/src/OCCViewer/CMakeLists.txt index 6e811c887..b0644ce2a 100755 --- a/src/OCCViewer/CMakeLists.txt +++ b/src/OCCViewer/CMakeLists.txt @@ -116,6 +116,7 @@ SET(_other_RESOURCES resources/occ_view_preselection.png resources/occ_view_presets.png resources/occ_view_reset.png + resources/occ_view_return_3d_view.png resources/occ_view_right.png resources/occ_view_rotate.png resources/occ_view_rotation_point.png diff --git a/src/OCCViewer/OCCViewer_ViewFrame.cxx b/src/OCCViewer/OCCViewer_ViewFrame.cxx index dae1db07e..9115688f1 100644 --- a/src/OCCViewer/OCCViewer_ViewFrame.cxx +++ b/src/OCCViewer/OCCViewer_ViewFrame.cxx @@ -85,6 +85,24 @@ void OCCViewer_ViewFrame::setViewManager( SUIT_ViewManager* theMgr ) } } +//************************************************************************************** +void OCCViewer_ViewFrame::returnTo3dView() +{ + OCCViewer_ViewWindow* view = 0; + for (int i = BOTTOM_RIGHT; i <= TOP_RIGHT; i++ ) { + view = myViews.at(i); + view->setVisible( view->get2dMode() == No2dMode ); + view->setMaximized( true, false ); + if (view->get2dMode() == No2dMode) myMaximizedView = view; + } + myLayout->setColumnStretch(0, 0); + myLayout->setColumnStretch(1, 0); + myLayout->addWidget( myMaximizedView, 0, 0 ); + mySplitMode = -1; + myViewsMode.clear(); + myLayout->invalidate(); +} + //************************************************************************************** void OCCViewer_ViewFrame::onMaximizedView( OCCViewer_ViewWindow* theView, bool isMaximized) { @@ -227,6 +245,7 @@ void OCCViewer_ViewFrame::splitSubViews() } OCCViewer_ViewWindow* view = 0; + bool isVisible3dView = false; for ( int i = 0; i< myViews.count(); i++ ) { view = myViews.at(i); bool isShowed = false; @@ -239,6 +258,7 @@ void OCCViewer_ViewFrame::splitSubViews() if( isShowed ) { view->show(); view->setMaximized( false, false ); + if ( view->get2dMode() == No2dMode ) isVisible3dView = true; ///////////////QApplication::processEvents(); // VSR: hangs up ? if ( view != myMaximizedView ) view->onViewFitAll(); @@ -246,6 +266,13 @@ void OCCViewer_ViewFrame::splitSubViews() else view->setVisible( false ); } + if ( !isVisible3dView ) { + for ( int i = 0; i< myViews.count(); i++ ){ + view = myViews.at(i); + if( view->isVisible() ) + view->setReturnedTo3dView( false ); + } + } } //************************************************************************************** @@ -300,6 +327,8 @@ void OCCViewer_ViewFrame::setZoomingStyle( const int i ) //************************************************************************************** void OCCViewer_ViewFrame::connectViewSignals(OCCViewer_ViewWindow* theView) { + connect( theView, SIGNAL( returnedTo3d( ) ), this, SLOT( returnTo3dView( ) ) ); + connect( theView, SIGNAL( maximized( OCCViewer_ViewWindow*, bool ) ), this, SLOT( onMaximizedView( OCCViewer_ViewWindow*, bool ) ) ); diff --git a/src/OCCViewer/OCCViewer_ViewFrame.h b/src/OCCViewer/OCCViewer_ViewFrame.h index 35935b630..26eacfd0f 100644 --- a/src/OCCViewer/OCCViewer_ViewFrame.h +++ b/src/OCCViewer/OCCViewer_ViewFrame.h @@ -122,6 +122,7 @@ public slots: virtual void updateGravityCoords() {} void onMaximizedView( OCCViewer_ViewWindow*, bool ); + void returnTo3dView(); virtual void onDumpView(); diff --git a/src/OCCViewer/OCCViewer_ViewWindow.cxx b/src/OCCViewer/OCCViewer_ViewWindow.cxx index 4697e6acb..2c52f50c3 100755 --- a/src/OCCViewer/OCCViewer_ViewWindow.cxx +++ b/src/OCCViewer/OCCViewer_ViewWindow.cxx @@ -1299,6 +1299,15 @@ void OCCViewer_ViewWindow::createActions() connect(aAction, SIGNAL(triggered()), this, SLOT(onMaximizedView())); toolMgr()->registerAction( aAction, MaximizedId ); + // Return to 3d view + if (my2dMode!=No2dMode){ + aAction = new QtxAction(tr("MNU_RETURN_3D_VIEW"), aResMgr->loadPixmap( "OCCViewer", tr( "ICON_OCCVIEWER_RETURN_3D_VIEW" ) ), + tr( "MNU_RETURN_3D_VIEW" ), 0, this ); + aAction->setStatusTip(tr("DSC_RETURN_3D_VIEW")); + connect(aAction, SIGNAL(triggered()), this, SLOT(returnTo3dView())); + toolMgr()->registerAction( aAction, ReturnTo3dViewId ); + } + // Synchronize View toolMgr()->registerAction( synchronizeAction(), SynchronizeId ); } @@ -1324,7 +1333,10 @@ void OCCViewer_ViewWindow::createToolBar() } int tid = toolMgr()->createToolBar( aToolbarName, false ); - + if ( my2dMode != No2dMode ){ + toolMgr()->append( ReturnTo3dViewId, tid ); + toolMgr()->append( toolMgr()->separator(), tid ); + } toolMgr()->append( DumpId, tid ); toolMgr()->append( SwitchInteractionStyleId, tid ); #if OCC_VERSION_LARGE > 0x0603000A // available only with OCC-6.3-sp11 and higher version @@ -2587,16 +2599,34 @@ void OCCViewer_ViewWindow::onMaximizedView() setMaximized(!isMaximized()); } +void OCCViewer_ViewWindow::returnTo3dView() +{ + setReturnedTo3dView( true ); +} + +void OCCViewer_ViewWindow::setReturnedTo3dView(bool isVisible3dView) +{ + if ( !toolMgr()->action( ReturnTo3dViewId ) || + toolMgr()->isShown(ReturnTo3dViewId) != isVisible3dView ) return; + if ( !isVisible3dView ) + toolMgr()->show( ReturnTo3dViewId ); + else + toolMgr()->hide( ReturnTo3dViewId ); + if ( isVisible3dView ) emit returnedTo3d( ); +} + void OCCViewer_ViewWindow::setMaximized(bool toMaximize, bool toSendSignal) { QAction* anAction = toolMgr()->action( MaximizedId ); + QAction* anAction2 = toolMgr()->action( ReturnTo3dViewId ); SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr(); if ( toMaximize ) { anAction->setText( tr( "MNU_MINIMIZE_VIEW" ) ); anAction->setToolTip( tr( "MNU_MINIMIZE_VIEW" ) ); anAction->setIcon( aResMgr->loadPixmap( "OCCViewer", tr( "ICON_OCCVIEWER_MINIMIZE" ) ) ); anAction->setStatusTip( tr( "DSC_MINIMIZE_VIEW" ) ); + if ( anAction2 && my2dMode != No2dMode ) toolMgr()->show( ReturnTo3dViewId ); if (toSendSignal) { emit maximized( this, true ); } @@ -2606,13 +2636,13 @@ void OCCViewer_ViewWindow::setMaximized(bool toMaximize, bool toSendSignal) anAction->setToolTip( tr( "MNU_MAXIMIZE_VIEW" ) ); anAction->setIcon( aResMgr->loadPixmap( "OCCViewer", tr( "ICON_OCCVIEWER_MAXIMIZE" ) ) ); anAction->setStatusTip( tr( "DSC_MAXIMIZE_VIEW" ) ); + if ( anAction2 && my2dMode != No2dMode ) toolMgr()->hide( ReturnTo3dViewId ); if (toSendSignal) { emit maximized( this, false ); } } } - bool OCCViewer_ViewWindow::isMaximized() const { return !(toolMgr()->action( MaximizedId )->text() == tr( "MNU_MAXIMIZE_VIEW" )); diff --git a/src/OCCViewer/OCCViewer_ViewWindow.h b/src/OCCViewer/OCCViewer_ViewWindow.h index a203a2bf2..afd98e550 100755 --- a/src/OCCViewer/OCCViewer_ViewWindow.h +++ b/src/OCCViewer/OCCViewer_ViewWindow.h @@ -123,7 +123,7 @@ public: TrihedronShowId, AxialScaleId, GraduatedAxesId, AmbientId, SwitchInteractionStyleId, SwitchZoomingStyleId, SwitchPreselectionId, SwitchSelectionId, - MaximizedId, SynchronizeId, + MaximizedId, SynchronizeId, ReturnTo3dViewId, UserId }; enum OperationType{ NOTHING, PANVIEW, ZOOMVIEW, ROTATE, @@ -188,6 +188,7 @@ public: void setMaximized( bool, bool = true ); bool isMaximized() const; + void setReturnedTo3dView( bool = true ); void setSketcherStyle( bool enable ); bool isSketcherStyle() const; @@ -246,6 +247,7 @@ public slots: virtual void hideEvent( QHideEvent * ); virtual void onMaximizedView(); + virtual void returnTo3dView(); signals: void vpTransformationStarted(OCCViewer_ViewWindow::OperationType type); @@ -255,6 +257,7 @@ signals: void Show( QShowEvent * ); void Hide( QHideEvent * ); void maximized( OCCViewer_ViewWindow*, bool ); + void returnedTo3d( ); protected slots: void synchronize( SUIT_ViewWindow* ); diff --git a/src/OCCViewer/resources/OCCViewer_images.ts b/src/OCCViewer/resources/OCCViewer_images.ts index 98804e2c7..94affa31e 100644 --- a/src/OCCViewer/resources/OCCViewer_images.ts +++ b/src/OCCViewer/resources/OCCViewer_images.ts @@ -123,6 +123,10 @@ ICON_OCCVIEWER_MINIMIZE occ_view_minimized.png + + ICON_OCCVIEWER_RETURN_3D_VIEW + occ_view_return_3d_view.png + ICON_OCCVIEWER_PRESELECTION occ_view_preselection.png diff --git a/src/OCCViewer/resources/OCCViewer_msg_en.ts b/src/OCCViewer/resources/OCCViewer_msg_en.ts index 705f737b3..89ff97be4 100644 --- a/src/OCCViewer/resources/OCCViewer_msg_en.ts +++ b/src/OCCViewer/resources/OCCViewer_msg_en.ts @@ -299,6 +299,10 @@ DSC_MINIMIZE_VIEW Minimize view + + DSC_RETURN_3D_VIEW + Return to 3D view + MNU_MAXIMIZE_VIEW Maximize @@ -307,6 +311,10 @@ MNU_MINIMIZE_VIEW Minimize + + MNU_RETURN_3D_VIEW + Return to 3D + OCCViewer_CreateRestoreViewDlg diff --git a/src/OCCViewer/resources/OCCViewer_msg_fr.ts b/src/OCCViewer/resources/OCCViewer_msg_fr.ts index 250fda174..743ecc417 100755 --- a/src/OCCViewer/resources/OCCViewer_msg_fr.ts +++ b/src/OCCViewer/resources/OCCViewer_msg_fr.ts @@ -299,6 +299,10 @@ DSC_MINIMIZE_VIEW Minimiser la vue + + DSC_RETURN_3D_VIEW + Return to 3D view + MNU_MAXIMIZE_VIEW Maximiser @@ -307,6 +311,10 @@ MNU_MINIMIZE_VIEW Minimiser + + MNU_RETURN_3D_VIEW + Return to 3D + OCCViewer_CreateRestoreViewDlg diff --git a/src/OCCViewer/resources/occ_view_return_3d_view.png b/src/OCCViewer/resources/occ_view_return_3d_view.png new file mode 100644 index 000000000..01de30bc6 Binary files /dev/null and b/src/OCCViewer/resources/occ_view_return_3d_view.png differ