]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
Show/Hide center axes
authorAnthony Geay <anthony.geay@edf.fr>
Tue, 11 Apr 2023 14:20:18 +0000 (16:20 +0200)
committerAnthony Geay <anthony.geay@edf.fr>
Tue, 11 Apr 2023 14:20:18 +0000 (16:20 +0200)
src/SPV3D/SPV3D_ViewWindow.cxx
src/SPV3D/SPV3D_ViewWindow.h

index c23fe69cd85c0d226c4ca52ebc6ce1166fe5bcea..78deddd8e6fb66cb0aaf39a706fc36e2ebcad209 100644 (file)
@@ -52,6 +52,7 @@
 
 #include <pqCameraReaction.h>
 #include <pqParaViewBehaviors.h>
+#include <pqRenderView.h>
 
 #include "SALOME_ListIO.hxx"
 #include "SPV3D_Prs.h"
@@ -89,7 +90,22 @@ void SPV3D_ViewWindow::init()
                                         false );
   QAction* resetCenterAction =
     toolMgr()->toolBar(myToolBar)->addAction(QIcon(":/pqWidgets/Icons/pqResetCamera.svg"), tr( "MNU_FITALL" ) );
-  new pqCameraReaction(resetCenterAction, pqCameraReaction::RESET_CAMERA);  
+  new pqCameraReaction(resetCenterAction, pqCameraReaction::RESET_CAMERA);
+  QAction *showCenterAction =
+    toolMgr()->toolBar(myToolBar)->addAction(QIcon(":/pqWidgets/Icons/pqShowCenterAxes.svg"), tr( "DSC_SHOW_TRIHEDRON" ) );
+  showCenterAction->setCheckable(true);
+  QObject::connect(showCenterAction, &QAction::toggled, this, &SPV3D_ViewWindow::showCenterAxes);
+}
+
+void SPV3D_ViewWindow::showCenterAxes(bool show_axes)
+{
+  if(!myModel)
+    return;
+  pqRenderView* renderView = qobject_cast<pqRenderView*>(myModel->getView());
+  if (!renderView)
+    return;
+  renderView->setCenterAxesVisibility(show_axes);
+  renderView->render();
 }
 
 SPV3D_Prs *SPV3D_ViewWindow::findOrCreatePrs( const char* entry )
index aa03d100be28596e4e6d9466e03eb5fe5462e0f6..706e666c0a93e7a6bba1c6f3e0fbf446ea78f449 100644 (file)
@@ -131,6 +131,7 @@ class SPV3D_EXPORT SPV3D_ViewWindow : public PV3DViewer_ViewWindow //SUIT_ViewWi
 public slots:
   virtual void showEvent( QShowEvent * );
   virtual void hideEvent( QHideEvent * );
+  void showCenterAxes(bool);
 
 protected slots:
   void onKeyPressed(QKeyEvent* event);