From df4cc679cdd7e50c0348f712125c27b2bb8e5d59 Mon Sep 17 00:00:00 2001 From: vsr Date: Wed, 16 Mar 2011 11:48:53 +0000 Subject: [PATCH] 0021043: EDF 1601 GUI: Angle of view --- src/LightApp/LightApp_Application.cxx | 26 ++++++- src/LightApp/resources/LightApp.xml | 4 + src/LightApp/resources/LightApp_msg_en.ts | 8 ++ src/OCCViewer/Makefile.am | 2 + src/OCCViewer/OCCViewer_ViewFrame.cxx | 9 +++ src/OCCViewer/OCCViewer_ViewFrame.h | 5 +- src/OCCViewer/OCCViewer_ViewPort3d.cxx | 14 ++++ src/OCCViewer/OCCViewer_ViewPort3d.h | 1 + src/OCCViewer/OCCViewer_ViewWindow.cxx | 42 +++++++++- src/OCCViewer/OCCViewer_ViewWindow.h | 8 +- src/OCCViewer/resources/OCCViewer_images.ts | 8 ++ src/OCCViewer/resources/OCCViewer_msg_en.ts | 16 ++++ .../resources/occ_view_anticlockwise.png | Bin 0 -> 936 bytes .../resources/occ_view_clockwise.png | Bin 0 -> 869 bytes src/Qtx/QtxActionToolMgr.cxx | 30 ++++++++ src/Qtx/QtxActionToolMgr.h | 2 + src/SUIT/SUIT_ViewWindow.cxx | 72 ++++++++++++++---- src/SUIT/SUIT_ViewWindow.h | 17 +++-- src/SVTK/SVTK_Renderer.cxx | 25 ++++++ src/SVTK/SVTK_Renderer.h | 8 +- src/SVTK/SVTK_ViewWindow.cxx | 39 ++++++++++ src/SVTK/SVTK_ViewWindow.h | 10 ++- src/SVTK/resources/SVTK_msg_en.ts | 20 ++++- src/SalomeApp/resources/SalomeApp.xml | 4 + src/VTKViewer/Makefile.am | 2 + src/VTKViewer/VTKViewer_ViewWindow.cxx | 39 ++++++++++ src/VTKViewer/VTKViewer_ViewWindow.h | 5 +- src/VTKViewer/resources/VTKViewer_images.ts | 8 ++ src/VTKViewer/resources/VTKViewer_msg_en.ts | 16 ++++ .../resources/vtk_view_anticlockwise.png | Bin 0 -> 936 bytes .../resources/vtk_view_clockwise.png | Bin 0 -> 869 bytes 31 files changed, 406 insertions(+), 34 deletions(-) create mode 100644 src/OCCViewer/resources/occ_view_anticlockwise.png create mode 100644 src/OCCViewer/resources/occ_view_clockwise.png create mode 100644 src/VTKViewer/resources/vtk_view_anticlockwise.png create mode 100644 src/VTKViewer/resources/vtk_view_clockwise.png diff --git a/src/LightApp/LightApp_Application.cxx b/src/LightApp/LightApp_Application.cxx index 56f2f9a51..d261d6ef3 100644 --- a/src/LightApp/LightApp_Application.cxx +++ b/src/LightApp/LightApp_Application.cxx @@ -1432,14 +1432,18 @@ SUIT_ViewManager* LightApp_Application::createViewManager( const QString& vmType addViewManager( viewMgr ); SUIT_ViewWindow* viewWin = viewMgr->createViewWindow(); - if ( viewWin && desktop() ) + if ( viewWin && desktop() ) { viewWin->resize( (int)( desktop()->width() * 0.6 ), (int)( desktop()->height() * 0.6 ) ); + viewWin->setDropDownButtons( resMgr->booleanValue( "viewers", "drop_down_buttons", true ) ); + } return viewMgr; } SUIT_ViewManager* LightApp_Application::createViewManager( const QString& vmType, QWidget* w ) { + SUIT_ResourceMgr* resMgr = resourceMgr(); + SUIT_ViewManager* vm = new SUIT_ViewManager( activeStudy(), desktop(), new LightApp_WgViewModel( vmType, w ) ); @@ -1447,8 +1451,10 @@ SUIT_ViewManager* LightApp_Application::createViewManager( const QString& vmType addViewManager( vm ); SUIT_ViewWindow* vw = vm->createViewWindow(); - if ( vw && desktop() ) + if ( vw && desktop() ) { vw->resize( (int)( desktop()->width() * 0.6 ), (int)( desktop()->height() * 0.6 ) ); + vw->setDropDownButtons( resMgr->booleanValue( "viewers", "drop_down_buttons", true ) ); + } if ( !vmType.isEmpty() && !myUserWmTypes.contains( vmType ) ) myUserWmTypes << vmType; @@ -1962,6 +1968,11 @@ void LightApp_Application::createPreferences( LightApp_Preferences* pref ) int viewTab = pref->addPreference( tr( "PREF_TAB_VIEWERS" ), salomeCat ); + int genGroup = pref->addPreference( tr( "PREF_GROUP_COMMON" ), viewTab ); + + pref->addPreference( tr( "PREF_DROP_DOWN_BUTTONS" ), genGroup, + LightApp_Preferences::Bool, "viewers", "drop_down_buttons" ); + int occGroup = pref->addPreference( tr( "PREF_GROUP_OCCVIEWER" ), viewTab ); int vtkGroup = pref->addPreference( tr( "PREF_GROUP_VTKVIEWER" ), viewTab ); @@ -2285,6 +2296,17 @@ void LightApp_Application::preferencesChanged( const QString& sec, const QString if ( !resMgr ) return; + if ( sec == "viewers" && param == "drop_down_buttons" ) + { + ViewManagerList vmlist = viewManagers(); + foreach( SUIT_ViewManager* vm, vmlist ) + { + QVector vwlist = vm->getViews(); + foreach( SUIT_ViewWindow* vw, vwlist ) + if ( vw ) vw->setDropDownButtons( resMgr->booleanValue( "viewers", "drop_down_buttons", true ) ); + } + } + #ifndef DISABLE_OCCVIEWER if ( sec == QString( "OCCViewer" ) && param == QString( "trihedron_size" ) ) { diff --git a/src/LightApp/resources/LightApp.xml b/src/LightApp/resources/LightApp.xml index de746b8c2..1cd483c3e 100644 --- a/src/LightApp/resources/LightApp.xml +++ b/src/LightApp/resources/LightApp.xml @@ -117,6 +117,10 @@ +
+ + +
diff --git a/src/LightApp/resources/LightApp_msg_en.ts b/src/LightApp/resources/LightApp_msg_en.ts index 804b47529..97fe58f52 100644 --- a/src/LightApp/resources/LightApp_msg_en.ts +++ b/src/LightApp/resources/LightApp_msg_en.ts @@ -494,6 +494,14 @@ The changes will be applied on the next application session. PREF_CATEGORY_SALOME SALOME + + PREF_DROP_DOWN_BUTTONS + Drop-down buttons in toolbars for action groups + + + PREF_GROUP_COMMON + Common + PREF_GROUP_OCCVIEWER OCC Viewer 3d diff --git a/src/OCCViewer/Makefile.am b/src/OCCViewer/Makefile.am index 73f3e5fa8..093c52765 100755 --- a/src/OCCViewer/Makefile.am +++ b/src/OCCViewer/Makefile.am @@ -88,6 +88,8 @@ MOC_FILES = \ nodist_libOCCViewer_la_SOURCES = $(MOC_FILES) dist_salomeres_DATA = \ + resources/occ_view_anticlockwise.png \ + resources/occ_view_clockwise.png \ resources/occ_view_back.png \ resources/occ_view_bottom.png \ resources/occ_view_camera_dump.png \ diff --git a/src/OCCViewer/OCCViewer_ViewFrame.cxx b/src/OCCViewer/OCCViewer_ViewFrame.cxx index 57d135544..2763a5516 100644 --- a/src/OCCViewer/OCCViewer_ViewFrame.cxx +++ b/src/OCCViewer/OCCViewer_ViewFrame.cxx @@ -104,6 +104,7 @@ void OCCViewer_ViewFrame::onMaximizedView( OCCViewer_ViewWindow* theView, bool i myViews.append( view ); aModel->initView(view); view->setMaximized(false, false); + view->setDropDownButtons( dropDownButtons() ); connectViewSignals(view); view->setBackgroundColor(aModel->backgroundColor(i)); } @@ -253,3 +254,11 @@ void OCCViewer_ViewFrame::onDumpView() getView(MAIN_VIEW)->onDumpView(); } } + +void OCCViewer_ViewFrame::setDropDownButtons( bool on ) +{ + foreach( OCCViewer_ViewWindow* aView, myViews ) { + aView->setDropDownButtons( on ); + } + OCCViewer_ViewWindow::setDropDownButtons( on ); +} diff --git a/src/OCCViewer/OCCViewer_ViewFrame.h b/src/OCCViewer/OCCViewer_ViewFrame.h index 16db75607..21d287779 100644 --- a/src/OCCViewer/OCCViewer_ViewFrame.h +++ b/src/OCCViewer/OCCViewer_ViewFrame.h @@ -75,8 +75,9 @@ public: virtual bool eventFilter(QObject* watched, QEvent* e) { return SUIT_ViewWindow::eventFilter(watched, e); } virtual QColor backgroundColor() const; - virtual void setBackgroundColor( const QColor& ); + virtual void setBackgroundColor( const QColor& ); + virtual void setDropDownButtons( bool ); public slots: virtual void onFrontView() { getView(MAIN_VIEW)->onFrontView(); } @@ -86,6 +87,8 @@ public slots: virtual void onBottomView() { getView(MAIN_VIEW)->onBottomView(); } virtual void onLeftView() { getView(MAIN_VIEW)->onLeftView(); } virtual void onRightView() { getView(MAIN_VIEW)->onRightView(); } + virtual void onClockWiseView() { getView(MAIN_VIEW)->onClockWiseView(); } + virtual void onAntiClockWiseView() { getView(MAIN_VIEW)->onAntiClockWiseView(); } virtual void onResetView() { getView(MAIN_VIEW)->onResetView(); } virtual void onFitAll(); virtual void activateZoom() {} diff --git a/src/OCCViewer/OCCViewer_ViewPort3d.cxx b/src/OCCViewer/OCCViewer_ViewPort3d.cxx index f6ea5109f..7f252eb9a 100755 --- a/src/OCCViewer/OCCViewer_ViewPort3d.cxx +++ b/src/OCCViewer/OCCViewer_ViewPort3d.cxx @@ -527,6 +527,20 @@ void OCCViewer_ViewPort3d::reset() // setZSize( zsize ); } +/*! + Rotate the view in the view plane (orthogonal to the view vector) +*/ +void OCCViewer_ViewPort3d::rotateXY( double degrees ) +{ + if ( activeView().IsNull() ) + return; + + int x = width()/2, y = height()/2; + double X, Y, Z; + activeView()->Convert( x, y, X, Y, Z ); + activeView()->Rotate( 0, 0, degrees * Standard_PI180, X, Y, Z ); +} + /*! Passed the handle of native window of the component to CASCADE view. [ private ] */ diff --git a/src/OCCViewer/OCCViewer_ViewPort3d.h b/src/OCCViewer/OCCViewer_ViewPort3d.h index 125fcfa93..1a2bd3d26 100755 --- a/src/OCCViewer/OCCViewer_ViewPort3d.h +++ b/src/OCCViewer/OCCViewer_ViewPort3d.h @@ -72,6 +72,7 @@ public: virtual void startZoomAtPoint( int, int ); virtual void zoom( int, int, int, int ); virtual void fitAll( bool keepScale = false, bool withZ = true, bool upd = true ); + virtual void rotateXY( double ); virtual void startRotation( int, int, int, const gp_Pnt& ); virtual void rotate( int, int, int, const gp_Pnt& ); diff --git a/src/OCCViewer/OCCViewer_ViewWindow.cxx b/src/OCCViewer/OCCViewer_ViewWindow.cxx index dd2952d1c..de4bef638 100755 --- a/src/OCCViewer/OCCViewer_ViewWindow.cxx +++ b/src/OCCViewer/OCCViewer_ViewWindow.cxx @@ -1103,7 +1103,6 @@ void OCCViewer_ViewWindow::createActions() aAction->setStatusTip(tr("DSC_BOTTOM_VIEW")); connect(aAction, SIGNAL(triggered()), this, SLOT(onBottomView())); this->addAction(aAction); - this->addAction(aAction); toolMgr()->registerAction( aAction, BottomId ); aAction = new QtxAction(tr("MNU_LEFT_VIEW"), aResMgr->loadPixmap( "OCCViewer", tr( "ICON_OCCVIEWER_VIEW_LEFT" ) ), @@ -1120,6 +1119,22 @@ void OCCViewer_ViewWindow::createActions() this->addAction(aAction); toolMgr()->registerAction( aAction, RightId ); + // rotate anticlockwise + aAction = new QtxAction(tr("MNU_ANTICLOCKWISE_VIEW"), aResMgr->loadPixmap( "OCCViewer", tr( "ICON_OCCVIEWER_VIEW_ANTICLOCKWISE" ) ), + tr( "MNU_ANTICLOCKWISE_VIEW" ), 0, this, false, "Viewers:Rotate anticlockwise"); + aAction->setStatusTip(tr("DSC_ANTICLOCKWISE_VIEW")); + connect(aAction, SIGNAL(triggered()), this, SLOT(onAntiClockWiseView())); + this->addAction(aAction); + toolMgr()->registerAction( aAction, AntiClockWiseId ); + + // rotate clockwise + aAction = new QtxAction(tr("MNU_CLOCKWISE_VIEW"), aResMgr->loadPixmap( "OCCViewer", tr( "ICON_OCCVIEWER_VIEW_CLOCKWISE" ) ), + tr( "MNU_CLOCKWISE_VIEW" ), 0, this, false, "Viewers:Rotate clockwise"); + aAction->setStatusTip(tr("DSC_CLOCKWISE_VIEW")); + connect(aAction, SIGNAL(triggered()), this, SLOT(onClockWiseView())); + this->addAction(aAction); + toolMgr()->registerAction( aAction, ClockWiseId ); + // 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"); @@ -1261,7 +1276,10 @@ void OCCViewer_ViewWindow::createToolBar() aViewsAction->insertAction( toolMgr()->action( LeftId ) ); aViewsAction->insertAction( toolMgr()->action( RightId ) ); toolMgr()->append( aViewsAction, tid ); - + + toolMgr()->append( AntiClockWiseId, tid ); + toolMgr()->append( ClockWiseId, tid ); + toolMgr()->append( ResetId, tid ); QtxMultiAction* aMemAction = new QtxMultiAction( this ); @@ -1365,6 +1383,26 @@ void OCCViewer_ViewWindow::onRightView() emit vpTransformationFinished ( RIGHTVIEW ); } +/*! + \brief Rotate view 90 degrees clockwise +*/ +void OCCViewer_ViewWindow::onClockWiseView() +{ + emit vpTransformationStarted ( CLOCKWISEVIEW ); + myViewPort->rotateXY( 90. ); + emit vpTransformationFinished ( CLOCKWISEVIEW ); +} + +/*! + \brief Rotate view 90 degrees conterclockwise +*/ +void OCCViewer_ViewWindow::onAntiClockWiseView() +{ + emit vpTransformationStarted ( ANTICLOCKWISEVIEW ); + myViewPort->rotateXY( -90. ); + emit vpTransformationFinished ( ANTICLOCKWISEVIEW ); +} + /*! \brief Perform "reset view" transformation. diff --git a/src/OCCViewer/OCCViewer_ViewWindow.h b/src/OCCViewer/OCCViewer_ViewWindow.h index 6dbbd582b..5dbbf3d1c 100755 --- a/src/OCCViewer/OCCViewer_ViewWindow.h +++ b/src/OCCViewer/OCCViewer_ViewWindow.h @@ -51,13 +51,15 @@ class OCCVIEWER_EXPORT OCCViewer_ViewWindow : public SUIT_ViewWindow public: enum { DumpId, FitAllId, FitRectId, ZoomId, PanId, GlobalPanId, ChangeRotationPointId, RotationId, - FrontId, BackId, TopId, BottomId, LeftId, RightId, ResetId, CloneId, ClippingId, MemId, RestoreId, + FrontId, BackId, TopId, BottomId, LeftId, RightId, ClockWiseId, AntiClockWiseId, + ResetId, CloneId, ClippingId, MemId, RestoreId, TrihedronShowId, AxialScaleId, GraduatedAxesId, AmbientId, SwitchInteractionStyleId, SwitchZoomingStyleId, MaximizedId, UserId }; enum OperationType{ NOTHING, PANVIEW, ZOOMVIEW, ROTATE, PANGLOBAL, WINDOWFIT, FITALLVIEW, RESETVIEW, - FRONTVIEW, BACKVIEW, TOPVIEW, BOTTOMVIEW, LEFTVIEW, RIGHTVIEW }; + FRONTVIEW, BACKVIEW, TOPVIEW, BOTTOMVIEW, LEFTVIEW, RIGHTVIEW, + CLOCKWISEVIEW, ANTICLOCKWISEVIEW }; enum RotationPointType{ GRAVITY, SELECTED }; @@ -122,6 +124,8 @@ public slots: virtual void onBottomView(); virtual void onLeftView(); virtual void onRightView(); + virtual void onClockWiseView(); + virtual void onAntiClockWiseView(); virtual void onResetView(); virtual void onFitAll(); virtual void activateZoom(); diff --git a/src/OCCViewer/resources/OCCViewer_images.ts b/src/OCCViewer/resources/OCCViewer_images.ts index d6f77585e..a183cb257 100644 --- a/src/OCCViewer/resources/OCCViewer_images.ts +++ b/src/OCCViewer/resources/OCCViewer_images.ts @@ -100,6 +100,14 @@ ICON_OCCVIEWER_VIEW_RIGHT occ_view_right.png + + ICON_OCCVIEWER_VIEW_CLOCKWISE + occ_view_clockwise.png + + + ICON_OCCVIEWER_VIEW_ANTICLOCKWISE + occ_view_anticlockwise.png + ICON_OCCVIEWER_CLIPPING occ_view_clipping.png diff --git a/src/OCCViewer/resources/OCCViewer_msg_en.ts b/src/OCCViewer/resources/OCCViewer_msg_en.ts index 9f144b5f9..662a5d640 100644 --- a/src/OCCViewer/resources/OCCViewer_msg_en.ts +++ b/src/OCCViewer/resources/OCCViewer_msg_en.ts @@ -135,6 +135,14 @@ DSC_RIGHT_VIEW Right View + + DSC_ANTICLOCKWISE_VIEW + Rotate view counterclockwise + + + DSC_CLOCKWISE_VIEW + Rotate View Clockwise + MNU_CHANGINGROTATIONPOINT_VIEW Change Rotation Point @@ -183,6 +191,14 @@ MNU_PRESETS_VIEW Restore View + + MNU_ANTICLOCKWISE_VIEW + Rotate counterclockwise + + + MNU_CLOCKWISE_VIEW + Rotate clockwise + MNU_RIGHT_VIEW Right diff --git a/src/OCCViewer/resources/occ_view_anticlockwise.png b/src/OCCViewer/resources/occ_view_anticlockwise.png new file mode 100644 index 0000000000000000000000000000000000000000..991586fe6d877a528f2afa6647ccfcc5d92bd742 GIT binary patch literal 936 zcmV;Z16TZsP)Px#24YJ`L;wH)!2rW+L(~EQ000SaNLh0L01FcU01FcV0GgZ_00007bV*G`2ipS= z4lN>7IvUFW000?uMObu0Z*6U5Zgc=ca%Ew3Wn>_CX>@2HM@d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pb3czC`2pw;43ZM@;;R=;gj%j% z>#9F>`sMI>$>a<t}%KOVZUH#xQ;l{1m5^OP5!$z%_5|)r-V~^7;)gO-&uc=FzIH zad7m+GTb%u1;Dtw98H8;e4m5$5AXNk@r3bof2FL #include @@ -46,7 +47,7 @@ const int DUMP_EVENT = QEvent::User + 123; /*! Constructor.*/ SUIT_ViewWindow::SUIT_ViewWindow( SUIT_Desktop* theDesktop ) -: QMainWindow( theDesktop ) + : QMainWindow( theDesktop ), myIsDropDown( true ) { myDesktop = theDesktop; @@ -56,7 +57,7 @@ SUIT_ViewWindow::SUIT_ViewWindow( SUIT_Desktop* theDesktop ) myToolMgr = new QtxActionToolMgr( this ); - setCustomData(QString("VectorsMode"), QVariant(false)); + setProperty( "VectorsMode", false ); } /*! Destructor.*/ @@ -258,29 +259,70 @@ QtxActionToolMgr* SUIT_ViewWindow::toolMgr() const } /*! - \return window unique identifier + \brief Set buttons mode to drop-down (\a on = \c true) or ligned (\a on = \c false) + \param on new buttons mode + \sa dropDownButtons() */ -int SUIT_ViewWindow::getId() const +void SUIT_ViewWindow::setDropDownButtons( bool on ) { - return int(long(this)); + if ( myIsDropDown != on ) { + myIsDropDown = on; + if ( myIsDropDown ) { + ActionsMap::const_iterator it; + for( it = myMultiActions.constBegin(); it != myMultiActions.constEnd(); ++it ) + { + int tid = it.key(); + const QList& mlist = it.value(); + QList::const_iterator mit; + for ( mit = mlist.constBegin(); mit != mlist.constEnd(); ++mit ) + { + QtxMultiAction* ma = *mit; + const QList alist = ma->actions(); + if ( alist.isEmpty() ) continue; + int idx = toolMgr()->index( toolMgr()->actionId( alist[0] ), tid ); + if ( idx == -1 ) continue; + foreach ( QAction* a, alist ) toolMgr()->remove( toolMgr()->actionId( a ), tid ); + toolMgr()->insert( ma, tid, idx ); + } + } + myMultiActions.clear(); + } + else { + QIntList tblist = toolMgr()->toolBarsIds(); + QIntList alist = toolMgr()->idList(); + foreach( int aid, alist ) + { + QtxMultiAction* ma = qobject_cast( toolMgr()->action( aid ) ); + if ( !ma ) continue; + foreach( int tid, tblist ) + { + int idx = toolMgr()->index( aid, tid ); + if ( idx >= 0 ) + { + myMultiActions[ tid ].append( ma ); + toolMgr()->remove( aid, tid ); + foreach( QAction* a, ma->actions() ) toolMgr()->insert( a, tid, idx++ ); + } + } + } + } + } } /*! - Assign custom data to the view window. - \param name castom data name - \param value custom data value + \brief Get current buttons mode + \return current buttons mode + \sa setDropDownButtons() */ -void SUIT_ViewWindow::setCustomData(const QString& name, const QVariant& value) +bool SUIT_ViewWindow::dropDownButtons() const { - myCustomData[name] = value; + return myIsDropDown; } /*! - Get custom data assigned to the view window. - \param name castom data name - \return custom data assigned to the window + \return window unique identifier */ -QVariant SUIT_ViewWindow::getCustomData(const QString& name) const +int SUIT_ViewWindow::getId() const { - return myCustomData.contains( name ) ? myCustomData[name] : QVariant(); + return int(long(this)); } diff --git a/src/SUIT/SUIT_ViewWindow.h b/src/SUIT/SUIT_ViewWindow.h index 7b044053f..dba81a0c5 100755 --- a/src/SUIT/SUIT_ViewWindow.h +++ b/src/SUIT/SUIT_ViewWindow.h @@ -28,18 +28,21 @@ #include "SUIT.h" #include +#include #include -#include class SUIT_Desktop; class SUIT_ViewManager; class QtxActionToolMgr; +class QtxMultiAction; class QImage; class SUIT_EXPORT SUIT_ViewWindow: public QMainWindow { Q_OBJECT + public: + SUIT_ViewWindow( SUIT_Desktop* ); virtual ~SUIT_ViewWindow(); @@ -62,13 +65,12 @@ public: void setDestructiveClose( const bool ); int getId() const; - - void setCustomData (const QString& name, const QVariant& data); - - QVariant getCustomData (const QString & name) const; QtxActionToolMgr* toolMgr() const; + virtual void setDropDownButtons( bool ); + bool dropDownButtons() const; + public slots: virtual void onDumpView(); @@ -95,8 +97,11 @@ protected: SUIT_ViewManager* myManager; private: + typedef QMap< int, QList > ActionsMap; + QtxActionToolMgr* myToolMgr; - QMap myCustomData; + bool myIsDropDown; + ActionsMap myMultiActions; }; #endif // SUIT_VIEWWINDOW_H diff --git a/src/SVTK/SVTK_Renderer.cxx b/src/SVTK/SVTK_Renderer.cxx index 6fd71280b..a5cd77d02 100644 --- a/src/SVTK/SVTK_Renderer.cxx +++ b/src/SVTK/SVTK_Renderer.cxx @@ -757,6 +757,31 @@ SVTK_Renderer this->OnFitAll(); } + +/*! + To rotate view 90 degrees clockwise +*/ +void +SVTK_Renderer +::onClockWiseView() +{ + vtkCamera* aCamera = GetDevice()->GetActiveCamera(); + aCamera->Roll(-90); + aCamera->OrthogonalizeViewUp(); +} + +/*! + To rotate view 90 degrees counterclockwise +*/ +void +SVTK_Renderer +::onAntiClockWiseView() +{ + vtkCamera* aCamera = GetDevice()->GetActiveCamera(); + aCamera->Roll(90); + aCamera->OrthogonalizeViewUp(); +} + /*! To reset direction of the camera to right view */ diff --git a/src/SVTK/SVTK_Renderer.h b/src/SVTK/SVTK_Renderer.h index 6989bcd39..b833830a1 100644 --- a/src/SVTK/SVTK_Renderer.h +++ b/src/SVTK/SVTK_Renderer.h @@ -204,7 +204,13 @@ class SVTK_EXPORT SVTK_Renderer : public vtkObject //! To reset direction of the camera to left view void OnLeftView(); - protected: + //! To rotate view 90 degrees clockwise + void onClockWiseView(); + + //! To rotate view 90 degrees counterclockwise + void onAntiClockWiseView(); + +protected: SVTK_Renderer(); ~SVTK_Renderer(); diff --git a/src/SVTK/SVTK_ViewWindow.cxx b/src/SVTK/SVTK_ViewWindow.cxx index d63b5d7e5..4a86578d7 100755 --- a/src/SVTK/SVTK_ViewWindow.cxx +++ b/src/SVTK/SVTK_ViewWindow.cxx @@ -353,6 +353,24 @@ void SVTK_ViewWindow::onRightView() Repaint(); } +/*! + \brief Rotate view 90 degrees clockwise +*/ +void SVTK_ViewWindow::onClockWiseView() +{ + GetRenderer()->onClockWiseView(); + Repaint(); +} + +/*! + \brief Rotate view 90 degrees conterclockwise +*/ +void SVTK_ViewWindow::onAntiClockWiseView() +{ + GetRenderer()->onAntiClockWiseView(); + Repaint(); +} + /*! Processes transformation "reset view": sets default orientation of viewport camera */ @@ -1714,6 +1732,24 @@ void SVTK_ViewWindow::createActions(SUIT_ResourceMgr* theResourceMgr) this->addAction(anAction); mgr->registerAction( anAction, RightId ); + // rotate anticlockwise + anAction = new QtxAction(tr("MNU_ANTICLOCKWISE_VIEW"), + theResourceMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_ANTICLOCKWISE" ) ), + tr( "MNU_ANTICLOCKWISE_VIEW" ), 0, this, false, "Viewers:Rotate anticlockwise"); + anAction->setStatusTip(tr("DSC_ANTICLOCKWISE_VIEW")); + connect(anAction, SIGNAL(triggered()), this, SLOT(onAntiClockWiseView())); + this->addAction(anAction); + mgr->registerAction( anAction, AntiClockWiseId ); + + // rotate clockwise + anAction = new QtxAction(tr("MNU_CLOCKWISE_VIEW"), + theResourceMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_CLOCKWISE" ) ), + tr( "MNU_CLOCKWISE_VIEW" ), 0, this, false, "Viewers:Rotate clockwise"); + anAction->setStatusTip(tr("DSC_CLOCKWISE_VIEW")); + connect(anAction, SIGNAL(triggered()), this, SLOT(onClockWiseView())); + this->addAction(anAction); + mgr->registerAction( anAction, ClockWiseId ); + // Reset anAction = new QtxAction(tr("MNU_RESET_VIEW"), theResourceMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_RESET" ) ), @@ -1878,6 +1914,9 @@ void SVTK_ViewWindow::createToolBar() aViewsAction->insertAction( getAction( RightId ) ); mgr->append( aViewsAction, myToolBar ); + mgr->append( AntiClockWiseId, myToolBar ); + mgr->append( ClockWiseId, myToolBar ); + mgr->append( ResetId, myToolBar ); mgr->append( UpdateRate, myToolBar ); diff --git a/src/SVTK/SVTK_ViewWindow.h b/src/SVTK/SVTK_ViewWindow.h index 6b939f0fc..cfe514f37 100755 --- a/src/SVTK/SVTK_ViewWindow.h +++ b/src/SVTK/SVTK_ViewWindow.h @@ -331,6 +331,12 @@ public slots: //! Redirect the request to #SVTK_Renderer::OnLeftView virtual void onLeftView(); + //! Redirect the request to #SVTK_Renderer::onClockWiseView + virtual void onClockWiseView(); + + //! Redirect the request to #SVTK_Renderer::onAntiClockWiseView + virtual void onAntiClockWiseView(); + //! Redirect the request to #SVTK_Renderer::OnResetView virtual void onResetView(); @@ -377,8 +383,8 @@ protected: enum { DumpId, FitAllId, FitRectId, ZoomId, PanId, GlobalPanId, ChangeRotationPointId, RotationId, - FrontId, BackId, TopId, BottomId, LeftId, RightId, ResetId, - ViewTrihedronId, NonIsometric, GraduatedAxes, UpdateRate, + FrontId, BackId, TopId, BottomId, LeftId, RightId, ClockWiseId, AntiClockWiseId, ResetId, + ViewTrihedronId, NonIsometric, GraduatedAxes, UpdateRate, ParallelModeId, ProjectionModeId, ViewParametersId, SwitchInteractionStyleId, SwitchZoomingStyleId, StartRecordingId, PlayRecordingId, PauseRecordingId, StopRecordingId }; diff --git a/src/SVTK/resources/SVTK_msg_en.ts b/src/SVTK/resources/SVTK_msg_en.ts index b717790b9..d76686531 100644 --- a/src/SVTK/resources/SVTK_msg_en.ts +++ b/src/SVTK/resources/SVTK_msg_en.ts @@ -3,6 +3,22 @@ @default + + DSC_ANTICLOCKWISE_VIEW + Rotate view counterclockwise + + + DSC_CLOCKWISE_VIEW + Rotate View Clockwise + + + MNU_ANTICLOCKWISE_VIEW + Rotate counterclockwise + + + MNU_CLOCKWISE_VIEW + Rotate clockwise + MNU_FRONT_VIEW Front @@ -247,11 +263,11 @@ DSC_SVTK_RECORDING_PLAY - Play recording + Continue recording MNU_SVTK_RECORDING_PLAY - Play recording + Continue recording DSC_SVTK_RECORDING_PAUSE diff --git a/src/SalomeApp/resources/SalomeApp.xml b/src/SalomeApp/resources/SalomeApp.xml index b8053da90..ae619b923 100644 --- a/src/SalomeApp/resources/SalomeApp.xml +++ b/src/SalomeApp/resources/SalomeApp.xml @@ -124,6 +124,10 @@
+
+ + +
diff --git a/src/VTKViewer/Makefile.am b/src/VTKViewer/Makefile.am index 56da23db4..e68ea50bb 100755 --- a/src/VTKViewer/Makefile.am +++ b/src/VTKViewer/Makefile.am @@ -106,6 +106,8 @@ QRC_FILES = \ nodist_libVTKViewer_la_SOURCES = $(MOC_FILES) $(QRC_FILES) dist_salomeres_DATA = \ + resources/vtk_view_anticlockwise.png \ + resources/vtk_view_clockwise.png \ resources/vtk_view_back.png \ resources/vtk_view_bottom.png \ resources/vtk_view_camera_dump.png \ diff --git a/src/VTKViewer/VTKViewer_ViewWindow.cxx b/src/VTKViewer/VTKViewer_ViewWindow.cxx index 436ac7a98..57214fe37 100755 --- a/src/VTKViewer/VTKViewer_ViewWindow.cxx +++ b/src/VTKViewer/VTKViewer_ViewWindow.cxx @@ -275,6 +275,20 @@ void VTKViewer_ViewWindow::createActions() connect(aAction, SIGNAL(activated()), this, SLOT(onRightView())); myActionsMap[ RightId ] = aAction; + // \li Rotate anticlockwise + aAction = new QtxAction(tr("MNU_ANTICLOCKWISE_VIEW"), aResMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_ANTICLOCKWISE" ) ), + tr( "MNU_ANTICLOCKWISE_VIEW" ), 0, this); + aAction->setStatusTip(tr("DSC_ANTICLOCKWISE_VIEW")); + connect(aAction, SIGNAL(triggered()), this, SLOT(onAntiClockWiseView())); + myActionsMap[ AntiClockWiseId ] = aAction; + + // \li Rotate clockwise + aAction = new QtxAction(tr("MNU_CLOCKWISE_VIEW"), aResMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_CLOCKWISE" ) ), + tr( "MNU_CLOCKWISE_VIEW" ), 0, this); + aAction->setStatusTip(tr("DSC_CLOCKWISE_VIEW")); + connect(aAction, SIGNAL(triggered()), this, SLOT(onClockWiseView())); + myActionsMap[ ClockWiseId ] = aAction; + //! \li Reset aAction = new QtxAction(tr("MNU_RESET_VIEW"), aResMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_RESET" ) ), tr( "MNU_RESET_VIEW" ), 0, this); @@ -318,6 +332,9 @@ void VTKViewer_ViewWindow::createToolBar() aViewsAction->insertAction( myActionsMap[RightId] ); myToolBar->addAction( aViewsAction ); + myToolBar->addAction( myActionsMap[AntiClockWiseId] ); + myToolBar->addAction( myActionsMap[ClockWiseId] ); + myToolBar->addAction( myActionsMap[ResetId] ); } @@ -381,6 +398,28 @@ void VTKViewer_ViewWindow::onRightView() onFitAll(); } +/*! + \brief Rotate view 90 degrees clockwise +*/ +void VTKViewer_ViewWindow::onClockWiseView() +{ + vtkCamera* aCamera = myRenderer->GetActiveCamera(); + aCamera->Roll(-90); + aCamera->OrthogonalizeViewUp(); + Repaint(); +} + +/*! + \brief Rotate view 90 degrees conterclockwise +*/ +void VTKViewer_ViewWindow::onAntiClockWiseView() +{ + vtkCamera* aCamera = myRenderer->GetActiveCamera(); + aCamera->Roll(90); + aCamera->OrthogonalizeViewUp(); + Repaint(); +} + /*!On reset view slot.*/ void VTKViewer_ViewWindow::onResetView() { diff --git a/src/VTKViewer/VTKViewer_ViewWindow.h b/src/VTKViewer/VTKViewer_ViewWindow.h index 411d8d74c..28fe14886 100755 --- a/src/VTKViewer/VTKViewer_ViewWindow.h +++ b/src/VTKViewer/VTKViewer_ViewWindow.h @@ -84,6 +84,8 @@ public slots: void onBottomView(); void onLeftView(); void onRightView(); + void onClockWiseView(); + void onAntiClockWiseView(); void onResetView(); void onFitAll(); void activateZoom(); @@ -111,7 +113,8 @@ private: private: enum { DumpId, FitAllId, FitRectId, ZoomId, PanId, GlobalPanId, RotationId, - FrontId, BackId, TopId, BottomId, LeftId, RightId, ResetId, TrihedronShowId }; + FrontId, BackId, TopId, BottomId, LeftId, RightId, ClockWiseId, AntiClockWiseId, + ResetId, TrihedronShowId }; typedef QMap ActionsMap; void createActions(); diff --git a/src/VTKViewer/resources/VTKViewer_images.ts b/src/VTKViewer/resources/VTKViewer_images.ts index 4bc6602a1..715512e62 100644 --- a/src/VTKViewer/resources/VTKViewer_images.ts +++ b/src/VTKViewer/resources/VTKViewer_images.ts @@ -119,5 +119,13 @@ ICON_VTKVIEWER_VIEW_TRIHEDRON vtk_view_triedre.png + + ICON_VTKVIEWER_VIEW_CLOCKWISE + occ_view_clockwise.png + + + ICON_VTKVIEWER_VIEW_ANTICLOCKWISE + occ_view_anticlockwise.png + diff --git a/src/VTKViewer/resources/VTKViewer_msg_en.ts b/src/VTKViewer/resources/VTKViewer_msg_en.ts index c737763d7..8e3fa136e 100644 --- a/src/VTKViewer/resources/VTKViewer_msg_en.ts +++ b/src/VTKViewer/resources/VTKViewer_msg_en.ts @@ -3,6 +3,22 @@ @default + + DSC_ANTICLOCKWISE_VIEW + Rotate view counterclockwise + + + DSC_CLOCKWISE_VIEW + Rotate View Clockwise + + + MNU_ANTICLOCKWISE_VIEW + Rotate counterclockwise + + + MNU_CLOCKWISE_VIEW + Rotate clockwise + MNU_FRONT_VIEW Front diff --git a/src/VTKViewer/resources/vtk_view_anticlockwise.png b/src/VTKViewer/resources/vtk_view_anticlockwise.png new file mode 100644 index 0000000000000000000000000000000000000000..991586fe6d877a528f2afa6647ccfcc5d92bd742 GIT binary patch literal 936 zcmV;Z16TZsP)Px#24YJ`L;wH)!2rW+L(~EQ000SaNLh0L01FcU01FcV0GgZ_00007bV*G`2ipS= z4lN>7IvUFW000?uMObu0Z*6U5Zgc=ca%Ew3Wn>_CX>@2HM@dakSAh-}00096NklPd;6H+|O^Vu6z7 z4s~3M?o?9V`F1TwzxVk2QBwFH=!LAk#r?^to6_D_$p@Epa+brIP|3pWpF(gxtE}55(Lu()1*vndf(OPJ{e(Oq7+P%smWR1JeOtY;gI+Wq83ZiSkTTx;q4w_|xg4Wswb?UG|+nzEs(_m~Y%XimZ{!(Nu53xqCWbsuBtg+tPK*Jon!d- zNdkJX*fuM%G5VxM6hZRnmW4P9<>$i%ri?L}$Yc=@nrk*IfAg;5_RT-gZJYSIGF&h3 z|MXIsA^G&PJM2GrosU0BlAOLFeg|Ie$}llHh3;6q)EXtENBlE%WR}s9M;O^Tx_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