]> SALOME platform Git repositories - modules/geom.git/blobdiff - src/GEOMImpl/GEOMImpl_TranslateDriver.cxx
Salome HOME
Merge branch 'master' into V7_5_BR
[modules/geom.git] / src / GEOMImpl / GEOMImpl_TranslateDriver.cxx
index 69311116399b70c5e2682b16125c203c84eb368f..0fab3342e8b7ca3a9701bef35dec34349588f5b2 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2013  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2014  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
@@ -6,7 +6,7 @@
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
 // License as published by the Free Software Foundation; either
-// version 2.1 of the License.
+// version 2.1 of the License, or (at your option) any later version.
 //
 // This library is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -27,6 +27,7 @@
 #include <GEOMImpl_ITransformOperations.hxx>
 #include <GEOMImpl_Types.hxx>
 #include <GEOM_Function.hxx>
+#include <GEOMUtils.hxx>
 
 #include <ShapeFix_Shape.hxx>
 #include <ShapeFix_ShapeTolerance.hxx>
@@ -175,10 +176,7 @@ Standard_Integer GEOMImpl_TranslateDriver::Execute(TFunction_Logbook& log) const
     Handle(GEOM_Function) aVector = TI.GetVector();
     gp_Vec Vec = gp::DX();
     if (!aVector.IsNull()) {
-      TopoDS_Shape aV = aVector->GetValue();
-      if (aV.IsNull() || aV.ShapeType() != TopAbs_EDGE) return 0;
-      TopoDS_Edge anEdge = TopoDS::Edge(aV);
-      Vec = gp_Vec(BRep_Tool::Pnt(TopExp::FirstVertex(anEdge)), BRep_Tool::Pnt(TopExp::LastVertex(anEdge)));
+      Vec = GEOMUtils::GetVector( aVector->GetValue(), Standard_False );
       Vec.Normalize();
     }
 
@@ -211,18 +209,12 @@ Standard_Integer GEOMImpl_TranslateDriver::Execute(TFunction_Logbook& log) const
     gp_Vec Vec2 = gp::DY();
 
     if (!aVector.IsNull()) {
-      TopoDS_Shape aV = aVector->GetValue();
-      if (aV.IsNull() || aV.ShapeType() != TopAbs_EDGE) return 0;
-      TopoDS_Edge anEdge = TopoDS::Edge(aV);
-      Vec1 = gp_Vec(BRep_Tool::Pnt(TopExp::FirstVertex(anEdge)), BRep_Tool::Pnt(TopExp::LastVertex(anEdge)));
+      Vec1 = GEOMUtils::GetVector( aVector->GetValue(), Standard_False );
       Vec1.Normalize();
     }
 
     if (!aVector2.IsNull()) {
-      TopoDS_Shape aV = aVector2->GetValue();
-      if (aV.IsNull() || aV.ShapeType() != TopAbs_EDGE) return 0;
-      TopoDS_Edge anEdge = TopoDS::Edge(aV);
-      Vec2 = gp_Vec(BRep_Tool::Pnt(TopExp::FirstVertex(anEdge)), BRep_Tool::Pnt(TopExp::LastVertex(anEdge)));
+      Vec2 = GEOMUtils::GetVector( aVector2->GetValue(), Standard_False );
       Vec2.Normalize();
     }