Salome HOME
Fix for import/export features
[modules/shaper.git] / src / NewGeom / NewGeom_SalomeViewer.cpp
index 4539bbdbc6aaed27943fd36be319c61570e099a4..a9b8065198911abc86788bec6f9c0842edaade92 100644 (file)
@@ -356,3 +356,39 @@ void NewGeom_SalomeViewer::onViewTransformed(OCCViewer_ViewWindow::OperationType
 {
   emit viewTransformed((int) theType);
 }
+
+//***************************************
+void NewGeom_SalomeViewer::activateViewer(bool toActivate)
+{
+  if (!mySelector || !mySelector->viewer())
+    return;
+  SUIT_ViewManager* aMgr = mySelector->viewer()->getViewManager();
+  QVector<SUIT_ViewWindow*> aViews = aMgr->getViews();
+  if (toActivate) {
+    foreach (SUIT_ViewWindow* aView, aViews) {
+      OCCViewer_ViewFrame* aOCCView = dynamic_cast<OCCViewer_ViewFrame*>(aView);
+      OCCViewer_ViewWindow* aWnd = aOCCView->getView(OCCViewer_ViewFrame::MAIN_VIEW);
+      connect(aWnd, SIGNAL(vpTransformationFinished(OCCViewer_ViewWindow::OperationType)),
+        this, SLOT(onViewTransformed(OCCViewer_ViewWindow::OperationType)));
+    }
+  } else {
+    foreach (SUIT_ViewWindow* aView, aViews) {
+      OCCViewer_ViewFrame* aOCCView = dynamic_cast<OCCViewer_ViewFrame*>(aView);
+      OCCViewer_ViewWindow* aWnd = aOCCView->getView(OCCViewer_ViewFrame::MAIN_VIEW);
+      disconnect((OCCViewer_ViewWindow*)aWnd, SIGNAL(vpTransformationFinished(OCCViewer_ViewWindow::OperationType)),
+        this, SLOT(onViewTransformed(OCCViewer_ViewWindow::OperationType)));
+    }
+  }
+}
+
+void NewGeom_SalomeViewer::Zfitall()
+{
+  if (!mySelector || !mySelector->viewer())
+    return;
+  SUIT_ViewManager* aMgr = mySelector->viewer()->getViewManager();
+  OCCViewer_ViewFrame* aView = dynamic_cast<OCCViewer_ViewFrame*>(aMgr->getActiveView());
+  if (aView) {
+    OCCViewer_ViewWindow* aWnd = aView->getView(OCCViewer_ViewFrame::MAIN_VIEW);
+    aWnd->getViewPort()->getView()->ZFitAll();
+  }
+}
\ No newline at end of file