From: vsv Date: Fri, 17 Jun 2005 10:09:35 +0000 (+0000) Subject: Show/Hide trihedron command X-Git-Tag: T3_0_0_a4~86 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=dcc5c1484f2eaad2eca2e9b4f86ad3fa6de7c370;p=modules%2Fgui.git Show/Hide trihedron command --- diff --git a/src/OCCViewer/OCCViewer_ViewModel.cxx b/src/OCCViewer/OCCViewer_ViewModel.cxx index 5de1e756a..c2dce07d2 100755 --- a/src/OCCViewer/OCCViewer_ViewModel.cxx +++ b/src/OCCViewer/OCCViewer_ViewModel.cxx @@ -373,3 +373,14 @@ void OCCViewer_Viewer::setTransparency( const Handle(AIS_InteractiveObject)& obj if( update ) myV3dViewer->Update(); } + +//**************************************************************** +void OCCViewer_Viewer::toggleTrihedron() +{ + if (myTrihedron.IsNull()) return; + if (myAISContext->IsDisplayed(myTrihedron)) { + myAISContext->Erase(myTrihedron); + } else { + myAISContext->Display(myTrihedron); + } +} diff --git a/src/OCCViewer/OCCViewer_ViewModel.h b/src/OCCViewer/OCCViewer_ViewModel.h index f523cb43f..537215f2f 100755 --- a/src/OCCViewer/OCCViewer_ViewModel.h +++ b/src/OCCViewer/OCCViewer_ViewModel.h @@ -72,6 +72,10 @@ public: virtual void updateViewAspects( const viewAspectList& ); virtual void clearViewAspects(); + //! returns true if 3d Trihedron in viewer was created + bool trihedronActivated() const { return !myTrihedron.IsNull(); } + virtual void toggleTrihedron(); + public slots: void onClearViewAspects(); diff --git a/src/OCCViewer/OCCViewer_ViewWindow.cxx b/src/OCCViewer/OCCViewer_ViewWindow.cxx index eae8cda77..0cb903a56 100755 --- a/src/OCCViewer/OCCViewer_ViewWindow.cxx +++ b/src/OCCViewer/OCCViewer_ViewWindow.cxx @@ -655,12 +655,21 @@ void OCCViewer_ViewWindow::createActions() aAction->setStatusTip(tr("DSC_PRESETS_VIEW")); connect(aAction, SIGNAL(activated()), this, SLOT(onRestoreView())); myActionsMap[ RestoreId ] = aAction; + + if (myModel->trihedronActivated()) { + aAction = new QtxAction(tr("MNU_SHOW_TRIHEDRE"), aResMgr->loadPixmap( "OCCViewer", tr( "ICON_OCCVIEWER_VIEW_TRIHEDRON" ) ), + tr( "MNU_SHOW_TRIHEDRE" ), 0, this); + aAction->setStatusTip(tr("DSC_SHOW_TRIHEDRE")); + connect(aAction, SIGNAL(activated()), this, SLOT(onTrihedronShow())); + myActionsMap[ TrihedronShowId ] = aAction; + } } //**************************************************************** void OCCViewer_ViewWindow::createToolBar() { myActionsMap[DumpId]->addTo(myToolBar); + myActionsMap[TrihedronShowId]->addTo(myToolBar); SUIT_ToolButton* aScaleBtn = new SUIT_ToolButton(myToolBar, "scale"); aScaleBtn->AddAction(myActionsMap[FitAllId]); @@ -872,3 +881,8 @@ void OCCViewer_ViewWindow::setRestoreFlag() myRestoreFlag = 1; } +//**************************************************************** +void OCCViewer_ViewWindow::onTrihedronShow() +{ + myModel->toggleTrihedron(); +} diff --git a/src/OCCViewer/OCCViewer_ViewWindow.h b/src/OCCViewer/OCCViewer_ViewWindow.h index 1b082aabf..efac118cf 100755 --- a/src/OCCViewer/OCCViewer_ViewWindow.h +++ b/src/OCCViewer/OCCViewer_ViewWindow.h @@ -57,6 +57,7 @@ public slots: void onCloneView(); void onMemorizeView(); void onRestoreView(); + void onTrihedronShow(); void setRestoreFlag(); signals: @@ -66,7 +67,9 @@ signals: protected: enum { DumpId, FitAllId, FitRectId, ZoomId, PanId, GlobalPanId, RotationId, - FrontId, BackId, TopId, BottomId, LeftId, RightId, ResetId, CloneId, MemId, RestoreId }; + FrontId, BackId, TopId, BottomId, LeftId, RightId, ResetId, CloneId, MemId, RestoreId, + TrihedronShowId }; + typedef QMap ActionsMap; diff --git a/src/OCCViewer/resources/OCCViewer_msg_en.po b/src/OCCViewer/resources/OCCViewer_msg_en.po index e4da092e8..474bffac5 100755 --- a/src/OCCViewer/resources/OCCViewer_msg_en.po +++ b/src/OCCViewer/resources/OCCViewer_msg_en.po @@ -171,3 +171,9 @@ msgstr "OCC scene:%1 - viewer:%2" msgid "OCCViewer_CreateRestoreViewDlg::CAPTION" msgstr "Restore view" + +msgid "MNU_SHOW_TRIHEDRE" +msgstr "Show/Hide trihedron" + +msgid "DSC_SHOW_TRIHEDRE" +msgstr "Show/Hide trihedron in the current view" diff --git a/src/SVTK/SVTK_ViewWindow.cxx b/src/SVTK/SVTK_ViewWindow.cxx index a840bb2f5..dace6f30e 100755 --- a/src/SVTK/SVTK_ViewWindow.cxx +++ b/src/SVTK/SVTK_ViewWindow.cxx @@ -280,9 +280,9 @@ SVTK_ViewWindow myActionsMap[ ResetId ] = aAction; // onViewTrihedron: Shows - Hides Trihedron - aAction = new QtxAction(tr("MNU_VIEW_TRIHEDRON"), aResMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_TRIHEDRON" ) ), - tr( "MNU_VIEW_TRIHEDRON" ), 0, this); - aAction->setStatusTip(tr("DSC_VIEW_TRIHEDRON")); + aAction = new QtxAction(tr("MNU_SHOW_TRIHEDRON"), aResMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_TRIHEDRON" ) ), + tr( "MNU_SHOW_TRIHEDRON" ), 0, this); + aAction->setStatusTip(tr("DSC_SHOW_TRIHEDRON")); connect(aAction, SIGNAL(activated()), this, SLOT(onViewTrihedron())); myActionsMap[ ViewTrihedronId ] = aAction; } diff --git a/src/VTKViewer/VTKViewer_ViewWindow.cxx b/src/VTKViewer/VTKViewer_ViewWindow.cxx index 124b95097..0d7e7fc19 100755 --- a/src/VTKViewer/VTKViewer_ViewWindow.cxx +++ b/src/VTKViewer/VTKViewer_ViewWindow.cxx @@ -269,12 +269,19 @@ void VTKViewer_ViewWindow::createActions() aAction->setStatusTip(tr("DSC_RESET_VIEW")); connect(aAction, SIGNAL(activated()), this, SLOT(onResetView())); myActionsMap[ ResetId ] = aAction; + + aAction = new QtxAction(tr("MNU_SHOW_TRIHEDRON"), aResMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_TRIHEDRON" ) ), + tr( "MNU_SHOW_TRIHEDRON" ), 0, this); + aAction->setStatusTip(tr("DSC_SHOW_TRIHEDRON")); + connect(aAction, SIGNAL(activated()), this, SLOT(onTrihedronShow())); + myActionsMap[ TrihedronShowId ] = aAction; } //**************************************************************** void VTKViewer_ViewWindow::createToolBar() { myActionsMap[DumpId]->addTo(myToolBar); + myActionsMap[TrihedronShowId]->addTo(myToolBar); SUIT_ToolButton* aScaleBtn = new SUIT_ToolButton(myToolBar); aScaleBtn->AddAction(myActionsMap[FitAllId]); @@ -553,3 +560,13 @@ void VTKViewer_ViewWindow::MoveActor( VTKViewer_Actor* theActor) RemoveActor(theActor); InsertActor(theActor,true); } + +//**************************************************************** +void VTKViewer_ViewWindow::onTrihedronShow() +{ + if (isTrihedronDisplayed()) + myTrihedron->VisibilityOff(); + else + myTrihedron->VisibilityOn(); + myRenderWindow->update(); +} diff --git a/src/VTKViewer/VTKViewer_ViewWindow.h b/src/VTKViewer/VTKViewer_ViewWindow.h index 84ffa8274..a998414d7 100755 --- a/src/VTKViewer/VTKViewer_ViewWindow.h +++ b/src/VTKViewer/VTKViewer_ViewWindow.h @@ -63,6 +63,7 @@ public slots: void activateRotation(); void activatePanning(); void activateGlobalPanning(); + void onTrihedronShow(); protected slots: void onKeyPressed(QKeyEvent* event); @@ -79,7 +80,7 @@ private: private: enum { DumpId, FitAllId, FitRectId, ZoomId, PanId, GlobalPanId, RotationId, - FrontId, BackId, TopId, BottomId, LeftId, RightId, ResetId }; + FrontId, BackId, TopId, BottomId, LeftId, RightId, ResetId, TrihedronShowId }; typedef QMap ActionsMap; void createActions(); diff --git a/src/VTKViewer/resources/VTKViewer_msg_en.po b/src/VTKViewer/resources/VTKViewer_msg_en.po index 7cd15aa6e..18fe26af3 100755 --- a/src/VTKViewer/resources/VTKViewer_msg_en.po +++ b/src/VTKViewer/resources/VTKViewer_msg_en.po @@ -77,12 +77,6 @@ msgstr "Reset View Point" msgid "MNU_RESET_VIEW" msgstr "Reset" -msgid "DSC_VIEW_TRIHEDRON" -msgstr "Shows - Hides Trihedron" - -msgid "MNU_VIEW_TRIHEDRON" -msgstr "Shows - Hides Trihedron" - msgid "DSC_FITALL" msgstr "Fit all objects inside the view frame" @@ -151,3 +145,9 @@ msgstr "Change background..." msgid "VTKViewer_ViewManager::VTK_VIEW_TITLE" msgstr "VTK scene:%1 - viewer:%2" + +msgid "MNU_SHOW_TRIHEDRON" +msgstr "Show/Hide trihedron" + +msgid "DSC_SHOW_TRIHEDRON" +msgstr "Show/Hide trihedron in the current view"