Salome HOME
Merge V8_4_BR branch.
[modules/geom.git] / src / GEOMImpl / GEOMImpl_PointDriver.cxx
index 03edfc4c1bef3c6f2a85dc1724d017b8cbc41a0e..908076627c757dc954917be4a6f07cef17c96d54 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2015  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2016  CEA/DEN, EDF R&D, OPEN CASCADE
 //
 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@@ -110,7 +110,7 @@ static Standard_Boolean getExtremaSolution
 //function : Execute
 //purpose  :
 //=======================================================================
-Standard_Integer GEOMImpl_PointDriver::Execute(TFunction_Logbook& log) const
+Standard_Integer GEOMImpl_PointDriver::Execute(Handle(TFunction_Logbook)& log) const
 {
   if (Label().IsNull())  return 0;
   Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label());
@@ -145,7 +145,14 @@ Standard_Integer GEOMImpl_PointDriver::Execute(TFunction_Logbook& log) const
     Standard_Real aFP, aLP, aP;
     Handle(Geom_Curve) aCurve = BRep_Tool::Curve(TopoDS::Edge(aRefShape), aFP, aLP);
     if ( !aCurve.IsNull() ) {
-      aP = aFP + (aLP - aFP) * aPI.GetParameter();
+      if (aPI.GetTakeOrientationIntoAccount() &&
+          aRefShape.Orientation() == TopAbs_REVERSED) {
+        aP = 1. - aPI.GetParameter();
+      } else {
+        aP = aPI.GetParameter();
+      }
+
+      aP = aFP + (aLP - aFP) * aP;
       aPnt = aCurve->Value(aP);
     }
     else {
@@ -355,7 +362,7 @@ Standard_Integer GEOMImpl_PointDriver::Execute(TFunction_Logbook& log) const
   //aShape.Infinite(Standard_True); // VSR: 05/04/2010: Fix 20668 (Fit All for points & lines)
   aFunction->SetValue(aShape);
 
-  log.SetTouched(Label());
+  log->SetTouched(Label());
 
   return 1;
 }
@@ -393,6 +400,7 @@ GetCreationInformation(std::string&             theOperationName,
   case POINT_CURVE_PAR:
     AddParam( theParams, "Edge", aCI.GetCurve() );
     AddParam( theParams, "Parameter", aCI.GetParameter() );
+    AddParam( theParams, "Use Orientation", aCI.GetTakeOrientationIntoAccount() );
     break;
   case POINT_CURVE_COORD:
     AddParam( theParams, "X", aCI.GetX() );
@@ -430,5 +438,4 @@ GetCreationInformation(std::string&             theOperationName,
   return true;
 }
 
-IMPLEMENT_STANDARD_HANDLE (GEOMImpl_PointDriver,GEOM_BaseDriver);
 IMPLEMENT_STANDARD_RTTIEXT (GEOMImpl_PointDriver,GEOM_BaseDriver);