Salome HOME
0023505: Sigsegv with fuse on cylinder and cone
[modules/geom.git] / src / GEOMImpl / GEOMImpl_ProjectionDriver.cxx
index 57d8422425912ad1194b4a15c270a8fcf92bee0f..5195bb8c874facbf666c3d8e624c6f4a1bbef145 100644 (file)
@@ -93,7 +93,7 @@ GEOMImpl_ProjectionDriver::GEOMImpl_ProjectionDriver()
 //function : Execute
 //purpose  :
 //======================================================================= 
-Standard_Integer GEOMImpl_ProjectionDriver::Execute(LOGBOOK& log) const
+Standard_Integer GEOMImpl_ProjectionDriver::Execute(Handle(TFunction_Logbook)& log) const
 {
   if (Label().IsNull())  return 0;    
   Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label());
@@ -160,7 +160,7 @@ Standard_Integer GEOMImpl_ProjectionDriver::Execute(LOGBOOK& log) const
         Standard_ConstructionError::Raise("No solution found");
       }
 
-      Quantity_Parameter U, V;
+      Standard_Real U, V;
       proj.LowerDistanceParameters(U, V);
       gp_Pnt2d aProjPnt (U, V);
 
@@ -170,7 +170,7 @@ Standard_Integer GEOMImpl_ProjectionDriver::Execute(LOGBOOK& log) const
         bool isSol = false;
         double minDist = RealLast();
         for (int i = 1; i <= nbPoints; i++) {
-          Quantity_Parameter Ui, Vi;
+          Standard_Real Ui, Vi;
           proj.Parameters(i, Ui, Vi);
           aProjPnt = gp_Pnt2d(Ui, Vi);
           aClsf.Perform(aFace, aProjPnt, tol);
@@ -220,9 +220,8 @@ Standard_Integer GEOMImpl_ProjectionDriver::Execute(LOGBOOK& log) const
 
       try {
         OrtProj.Build();
-      } catch (Standard_Failure) {
-        Handle(Standard_Failure) aFail = Standard_Failure::Caught();
-        TCollection_AsciiString aMsg (aFail->GetMessageString());
+      } catch (Standard_Failure& aFail) {
+        TCollection_AsciiString aMsg (aFail.GetMessageString());
         if (!aMsg.Length())
           aMsg = "Projection aborted : possibly the source shape intersects the cylinder's axis";
         Standard_ConstructionError::Raise(aMsg.ToCString());
@@ -247,11 +246,7 @@ Standard_Integer GEOMImpl_ProjectionDriver::Execute(LOGBOOK& log) const
     if (aShape.IsNull()) return 0;
 
     aFunction->SetValue(aShape);
-#if OCC_VERSION_MAJOR < 7
-    log.SetTouched(Label());
-#else
     log->SetTouched(Label());
-#endif
   } else if (aType == PROJECTION_ON_WIRE) {
     // Perform projection of point on a wire or an edge.
     GEOMImpl_IProjection aProj (aFunction);
@@ -713,11 +708,7 @@ TopoDS_Shape GEOMImpl_ProjectionDriver::projectOnCylinder
       }
 
       // Transform the curve to cylinder's parametric space.
-#if OCC_VERSION_MAJOR < 7
-      GEOMUtils::Handle(HTrsfCurve2d) aTrsfCurve =
-#else
       Handle(GEOMUtils::HTrsfCurve2d) aTrsfCurve =
-#endif
         new GEOMUtils::HTrsfCurve2d(aCurve, aPar[0], aPar[1], aTrsf2d);
       Approx_Curve2d                  aConv (aTrsfCurve, aPar[0], aPar[1],
                                                          aUResol, aVResol, GeomAbs_C1,
@@ -807,4 +798,4 @@ TopoDS_Shape GEOMImpl_ProjectionDriver::projectOnCylinder
   return aResult;
 }
 
-OCCT_IMPLEMENT_STANDARD_RTTIEXT (GEOMImpl_ProjectionDriver,GEOM_BaseDriver);
+IMPLEMENT_STANDARD_RTTIEXT (GEOMImpl_ProjectionDriver,GEOM_BaseDriver);