]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Provide view transformation signal in Salome viewer
authorvsv <vitaly.smetannikov@opencascade.com>
Tue, 21 Apr 2015 14:31:36 +0000 (17:31 +0300)
committervsv <vitaly.smetannikov@opencascade.com>
Tue, 21 Apr 2015 14:31:36 +0000 (17:31 +0300)
src/NewGeom/NewGeom_SalomeViewer.cpp
src/NewGeom/NewGeom_SalomeViewer.h
src/XGUI/XGUI_ViewerProxy.cpp

index 86e2d8f1b2e5b61d42ce62c760279ed70a5676a8..8bc67c748f7dc50bb8ef68125108aeac44d0a8dc 100644 (file)
@@ -3,7 +3,6 @@
 #include "NewGeom_SalomeViewer.h"
 #include "NewGeom_OCCSelector.h"
 
-#include <OCCViewer_ViewWindow.h>
 #include <OCCViewer_ViewPort3d.h>
 #include <OCCViewer_ViewFrame.h>
 
@@ -231,12 +230,21 @@ void NewGeom_SalomeViewer::onDeleteView(SUIT_ViewWindow*)
 void NewGeom_SalomeViewer::onViewCreated(SUIT_ViewWindow* theView)
 {
   myView->setCurrentView(theView);
+
+  OCCViewer_ViewFrame* aView = dynamic_cast<OCCViewer_ViewFrame*>(theView);
+
+  OCCViewer_ViewWindow* aWnd = aView->getView(OCCViewer_ViewFrame::MAIN_VIEW);
+  if (aWnd)
+    connect(aWnd, SIGNAL(vpTransformationFinished(OCCViewer_ViewWindow::OperationType)),
+      this, SLOT(onViewTransformed(OCCViewer_ViewWindow::OperationType)));
+
   emit viewCreated(myView);
 }
 
 //**********************************************
-void NewGeom_SalomeViewer::onActivated(SUIT_ViewWindow*)
+void NewGeom_SalomeViewer::onActivated(SUIT_ViewWindow* theView)
 {
+  myView->setCurrentView(theView);
   emit activated(myView);
 }
 
@@ -338,3 +346,9 @@ void NewGeom_SalomeViewer::update()
     aContext->UpdateCurrentViewer();
   }
 }
+
+//***************************************
+void NewGeom_SalomeViewer::onViewTransformed(OCCViewer_ViewWindow::OperationType theType)
+{
+  emit viewTransformed((int) theType);
+}
index 6dbd6b6df9846cecda9d3c9fd5392706e7a87576..b02058daa824f627f902124eeb499148cd240597 100644 (file)
@@ -9,6 +9,8 @@
 #include <ModuleBase_IViewer.h>
 #include <ModuleBase_IViewWindow.h>
 
+#include <OCCViewer_ViewWindow.h>
+
 #include <V3d_View.hxx>
 
 class SUIT_ViewWindow;
@@ -138,6 +140,7 @@ Q_OBJECT
   void onActivated(SUIT_ViewWindow*);
 
   void onSelectionChanged();
+  void onViewTransformed(OCCViewer_ViewWindow::OperationType);
 
  private:
   NewGeom_OCCSelector* mySelector;
index c32ceab8a045bdd84474e6a1ee69623944c680eb..cf300615a91fcd56eec14c96019b28c163a98cdd 100644 (file)
@@ -105,10 +105,11 @@ void XGUI_ViewerProxy::connectToViewer()
       this, SIGNAL(keyRelease(ModuleBase_IViewWindow*, QKeyEvent*)));
 
     connect(aViewer, SIGNAL(selectionChanged()), this, SIGNAL(selectionChanged()));
+    
+    connect(aViewer, SIGNAL(viewTransformed(int)), this, SIGNAL(viewTransformed(int)));
+
     connect(aViewer, SIGNAL(contextMenuRequested(QContextMenuEvent*)), this,
             SIGNAL(contextMenuRequested(QContextMenuEvent*)));
-
-    // TODO: Connect to ViewTransformation signal
   } else {
     AppElements_Viewer* aViewer = myWorkshop->mainWindow()->viewer();
 
@@ -300,7 +301,9 @@ bool XGUI_ViewerProxy::canDragByMouse() const
   }
 }
 
+//***************************************
 void XGUI_ViewerProxy::onViewTransformed(AppElements_ViewWindow::OperationType theType)
 {
   emit viewTransformed((int) theType);
-}
\ No newline at end of file
+}
+