Salome HOME
Bug #490: batch mode error.
[modules/hydro.git] / src / HYDROData / HYDROData_ShapesTool.cxx
index d591c3a6a610d1f8702b20551dcb139ab940bd0c..d11b369168ddfac2bb90a472f71886eef06a5c13 100644 (file)
@@ -81,6 +81,29 @@ bool HYDROData_ShapesTool::IsVerticesEquals( const TopoDS_Vertex& theFirstVert,
   return aFirstPoint.IsEqual( aSecondPoint, Precision::Confusion() );
 }
 
+TopoDS_Shape HYDROData_ShapesTool::Translated( const TopoDS_Shape& theShape,
+                                               const double        theDx,
+                                               const double        theDy,
+                                               const double        theDz )
+{
+  TopoDS_Shape aTranslatedShape;
+  if ( theShape.IsNull() )
+    return aTranslatedShape;
+
+  gp_Vec aVec( theDx, theDy, theDz );
+
+  gp_Trsf aTrsf;
+  aTrsf.SetTranslation( aVec );
+
+  TopLoc_Location aLocOrig = theShape.Location();
+  gp_Trsf aTrsfOrig = aLocOrig.Transformation();
+
+  TopLoc_Location aLocRes( aTrsf * aTrsfOrig );
+  aTranslatedShape = theShape.Located( aLocRes );
+
+  return aTranslatedShape;
+}
+
 bool HYDROData_ShapesTool::IsEdgesEquals( const TopoDS_Edge& theFirstEdge,
                                           const TopoDS_Edge& theSecondEdge,
                                           const bool         theIs2D )