Salome HOME
cleaning some comments
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_MeasurementToolOp.cxx
index e03abebf5accf5cbf005da1a71064d96bc5d2bb7..763c79cfbec3c2a1b51c2b6c766ddfab872220e2 100644 (file)
@@ -82,7 +82,7 @@ void HYDROGUI_MeasurementToolOp::startOperation()
   myMeasDlg = new HYDROGUI_MeasurementToolDlg( module()->getApp()->desktop() );
   myMeasDlg->setModal( false );
   myMeasDlg->setWindowTitle(getName());
-  myMeasDlg->show(); 
+  myMeasDlg->show();
 
   //Tool: draw a distance line
   LightApp_Application* anApp = module()->getApp();
@@ -97,9 +97,9 @@ void HYDROGUI_MeasurementToolOp::startOperation()
 
   OCCViewer_Viewer* aViewer = aViewManager->getOCCViewer();
 
-  disconnect(aViewManager, SIGNAL(mousePress(SUIT_ViewWindow*, QMouseEvent*)), 
+  disconnect(aViewManager, SIGNAL(mousePress(SUIT_ViewWindow*, QMouseEvent*)),
     aViewer, SLOT(onMousePress(SUIT_ViewWindow*, QMouseEvent*)));
-  connect(aViewManager, SIGNAL(mousePress(SUIT_ViewWindow*, QMouseEvent*)), 
+  connect(aViewManager, SIGNAL(mousePress(SUIT_ViewWindow*, QMouseEvent*)),
     this, SLOT(onMousePress(SUIT_ViewWindow*, QMouseEvent*)));
 
   //polyline names
@@ -150,7 +150,7 @@ void HYDROGUI_MeasurementToolOp::onMousePress(SUIT_ViewWindow* theWindow, QMouse
 
   Handle(AIS_InteractiveContext) aCtx = aViewer->getAISContext();
   if ( aCtx.IsNull() )
-    return;  
+    return;
 
   gp_Pnt aPnt = CurveCreator_Utils::ConvertClickToPoint( theEvent->x(), theEvent->y(), aView );
 
@@ -162,10 +162,10 @@ void HYDROGUI_MeasurementToolOp::onMousePress(SUIT_ViewWindow* theWindow, QMouse
     {
       myLineMaker = new BRepLib_MakePolygon();
       myLineMaker->Add(aPnt);
-      aRes = myLineMaker->FirstVertex(); 
+      aRes = myLineMaker->FirstVertex();
     }
     else
-    {   
+    {
       myLineMaker->Add(aPnt);
       aRes = myLineMaker->Shape();
       const TopoDS_Edge& aLE = myLineMaker->Edge();
@@ -178,8 +178,6 @@ void HYDROGUI_MeasurementToolOp::onMousePress(SUIT_ViewWindow* theWindow, QMouse
 
     if ( !myAISLineM.IsNull() )
     {
-      if ( aCtx->HasOpenedContext() )
-        aCtx->CloseLocalContext();
       aCtx->Erase( myAISLineM, Standard_False );
     }
   }
@@ -203,7 +201,7 @@ void HYDROGUI_MeasurementToolOp::onMousePress(SUIT_ViewWindow* theWindow, QMouse
         continue;
       TopExp_Explorer expW(W, TopAbs_EDGE);
       if (!expW.More())
-        continue;      
+        continue;
       TopoDS_Edge E = TopoDS::Edge(expW.Current());
       expW.Next();
       if (expW.More())
@@ -224,7 +222,7 @@ void HYDROGUI_MeasurementToolOp::onMousePress(SUIT_ViewWindow* theWindow, QMouse
             params.push_back(aKnots(i));
         }
       }
-      //in some cases, extrema gives inaccurate result -> 
+      //in some cases, extrema gives inaccurate result ->
       //split bspline by knot params and try to find minimum distance
       //on each interval
       std::sort(params.begin(), params.end());
@@ -248,9 +246,9 @@ void HYDROGUI_MeasurementToolOp::onMousePress(SUIT_ViewWindow* theWindow, QMouse
           double WinDiagDist = sqrt ((double)aWinSX*(double)aWinSX + (double)aWinSY*(double)aWinSY);
           if (fdist <= prec || pd / WinDiagDist < 0.08)
           {
-            if (fdist < fdist_min) 
+            if (fdist < fdist_min)
             {
-              fdist_min = fdist;           
+              fdist_min = fdist;
               minWire = W;
               minU = aProj.LowerDistanceParameter();
               minC.Initialize(E);
@@ -272,8 +270,8 @@ void HYDROGUI_MeasurementToolOp::onMousePress(SUIT_ViewWindow* theWindow, QMouse
       {
         if (myFW.IsSame(minWire))
         {
-          //calc distance on current curve 
-          double LenAlongCurv = GCPnts_AbscissaPoint::Length(minC, myFu, minU);          
+          //calc distance on current curve
+          double LenAlongCurv = GCPnts_AbscissaPoint::Length(minC, myFu, minU);
           myFW = TopoDS_Wire();
           if (!BRep_Tool::IsClosed(minWire))
           {
@@ -317,12 +315,10 @@ void HYDROGUI_MeasurementToolOp::onMousePress(SUIT_ViewWindow* theWindow, QMouse
   //anAspect->SetTypeOfMarker(Aspect_TOM_RING1);
   //anAspect->SetColor(Quantity_NOC_BLACK);
   //mySplitPointPreview->Attributes()->SetPointAspect( anAspect );
-  
+
   aCtx->SetZLayer(myAISLineM, Graphic3d_ZLayerId_Topmost);
 
-  if ( aCtx->HasOpenedContext() )
-    aCtx->CloseLocalContext();
-  aCtx->Display( myAISLineM, Standard_False );  
+  aCtx->Display( myAISLineM, Standard_False );
   aCtx->UpdateCurrentViewer();
 }
 
@@ -338,13 +334,11 @@ void HYDROGUI_MeasurementToolOp::eraseLine()
         Handle(AIS_InteractiveContext) aCtx = aViewer->getAISContext();
         if ( !aCtx.IsNull() )
         {
-          if ( aCtx->HasOpenedContext() )
-            aCtx->CloseLocalContext();
           aCtx->Erase( myAISLineM, Standard_False );
         }
         myAISLineM.Nullify();
         aCtx->UpdateCurrentViewer();
-      }      
+      }
     }
   }
 }
@@ -363,10 +357,10 @@ void HYDROGUI_MeasurementToolOp::onExit()
 
   if (aViewManager && aViewer)
   {
-    disconnect(aViewManager, SIGNAL(mousePress(SUIT_ViewWindow*, QMouseEvent*)), 
+    disconnect(aViewManager, SIGNAL(mousePress(SUIT_ViewWindow*, QMouseEvent*)),
       this, SLOT(onMousePress(SUIT_ViewWindow*, QMouseEvent*)));
 
-    connect(aViewManager, SIGNAL(mousePress(SUIT_ViewWindow*, QMouseEvent*)), 
+    connect(aViewManager, SIGNAL(mousePress(SUIT_ViewWindow*, QMouseEvent*)),
       aViewManager->getOCCViewer(), SLOT(onMousePress(SUIT_ViewWindow*, QMouseEvent*)));
   }