Salome HOME
Show/Hide trihedron command
authorvsv <vsv@opencascade.com>
Fri, 17 Jun 2005 10:09:35 +0000 (10:09 +0000)
committervsv <vsv@opencascade.com>
Fri, 17 Jun 2005 10:09:35 +0000 (10:09 +0000)
src/OCCViewer/OCCViewer_ViewModel.cxx
src/OCCViewer/OCCViewer_ViewModel.h
src/OCCViewer/OCCViewer_ViewWindow.cxx
src/OCCViewer/OCCViewer_ViewWindow.h
src/OCCViewer/resources/OCCViewer_msg_en.po
src/SVTK/SVTK_ViewWindow.cxx
src/VTKViewer/VTKViewer_ViewWindow.cxx
src/VTKViewer/VTKViewer_ViewWindow.h
src/VTKViewer/resources/VTKViewer_msg_en.po

index 5de1e756ad55883c2865af098a47b955ca3bb876..c2dce07d2bcea2878c9ef0ebcefd2302c337fced 100755 (executable)
@@ -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);
+  }
+}
index f523cb43f5397904c607ba4d8825fc853b4357bb..537215f2f0041adb2ec7a6a4c6f33836affde3ef 100755 (executable)
@@ -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();
 
index eae8cda773fc5ec2554955644185a99a8c05d04c..0cb903a56372ea3ca754c49719b54fb6fbd8efb8 100755 (executable)
@@ -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();
+}
index 1b082aabfe2fab6a2617c7ee4eb520e952cf9422..efac118cfd1c74a160ff277ba543d55b004d61b3 100755 (executable)
@@ -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<int, QtxAction*> ActionsMap;
 
 
index e4da092e827f0521a3b6678bdab7218b6f6ecef5..474bffac558c7d11a007015d74e70d97fdf352f9 100755 (executable)
@@ -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"
index a840bb2f5ed06057231f954a5224242fbc64a3d6..dace6f30e893fc531d3506b8731c9b06d4e9e68e 100755 (executable)
@@ -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;
 }
index 124b95097ada791ff47072bfdebbe528c77e047d..0d7e7fc19aa00d28876fade5b7190c4adc99b1db 100755 (executable)
@@ -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();
+}
index 84ffa827454c9ce3c7ef3c5eaea28987ff3ba7fc..a998414d74df38debd4ddd03a79cd6751d10fd6c 100755 (executable)
@@ -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<int, QtxAction*> ActionsMap;
   
   void    createActions();
index 7cd15aa6e43b598c613b94dfc44a73e31f5a81b6..18fe26af36638542c20bd7f0e0003d98a767ff3d 100755 (executable)
@@ -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"