Salome HOME
Issue #1079: Make Apply and Cancel buttons independent on enable/disable of complex...
[modules/shaper.git] / src / NewGeom / NewGeom_SalomeViewer.cpp
index 87a81a6255780fc97ec1548b806cd78a067b3bdf..ebdff924986ed86f28a14f6e8c75b0c6cd3f92a0 100644 (file)
@@ -257,6 +257,7 @@ bool NewGeom_SalomeViewer::isSelectionEnabled() const
 {
   if (mySelector)
     return mySelector->viewer()->isSelectionEnabled();
+  return false;
 }
 
 //**********************************************
@@ -274,6 +275,15 @@ bool NewGeom_SalomeViewer::isMultiSelectionEnabled() const
   return false;
 }
 
+//**********************************************
+bool NewGeom_SalomeViewer::enableDrawMode(bool isEnabled)
+{
+  // TODO: Has to be replaced when SALOME patch become available
+  if (mySelector)
+    return mySelector->viewer()->enableDrawMode(isEnabled);
+  return false;
+}
+
 //**********************************************
 void NewGeom_SalomeViewer::fitAll()
 {
@@ -301,7 +311,8 @@ void NewGeom_SalomeViewer::setViewProjection(double theX, double theY, double th
       aView3d->SetTwist( theTwist );
       aView3d->FitAll(0.01, true);
       aView3d->SetZSize(0.);
-      aView3d->DepthFitAll();
+      if (aView3d->Depth() < 0.1)
+        aView3d->DepthFitAll();
     }
   }
 }
@@ -395,6 +406,9 @@ void NewGeom_SalomeViewer::Zfitall()
   OCCViewer_ViewFrame* aView = dynamic_cast<OCCViewer_ViewFrame*>(aMgr->getActiveView());
   if (aView) {
     OCCViewer_ViewWindow* aWnd = aView->getView(OCCViewer_ViewFrame::MAIN_VIEW);
-    aWnd->getViewPort()->getView()->ZFitAll();
+    Handle(V3d_View) aView3d = aWnd->getViewPort()->getView();
+    aView3d->ZFitAll();
+    if (aView3d->Depth() < 0.1)
+      aView3d->DepthFitAll();
   }
 }
\ No newline at end of file