Salome HOME
Revert "Revert "Add a new method for translation : translation by two points.""
[modules/shaper.git] / src / GeomAlgoAPI / GeomAlgoAPI_ShapeAPI.cpp
index bd5f6015b6eac47d0b5e6adfc9a189eca27978eb..37ecc1296c4bebf7dcaafa8a500ec9eb11a6ac7e 100644 (file)
@@ -106,4 +106,27 @@ namespace GeomAlgoAPI_ShapeAPI
     }
     return aTranslationAlgo.shape();
   }
+
+  //=========================================================================================================
+  std::shared_ptr<GeomAPI_Shape> GeomAlgoAPI_ShapeAPI::makeTranslation(
+    std::shared_ptr<GeomAPI_Shape> theSourceShape,
+    std::shared_ptr<GeomAPI_Pnt>   theStartPoint,
+    std::shared_ptr<GeomAPI_Pnt>   theEndPoint) throw (GeomAlgoAPI_Exception)
+  {
+    GeomAlgoAPI_Translation aTranslationAlgo(theSourceShape, theStartPoint, theEndPoint);
+
+    if (!aTranslationAlgo.check()) {
+      throw GeomAlgoAPI_Exception(aTranslationAlgo.getError());
+    }
+
+    aTranslationAlgo.build();
+
+    if(!aTranslationAlgo.isDone()) {
+      throw GeomAlgoAPI_Exception(aTranslationAlgo.getError());
+    }
+    if (!aTranslationAlgo.checkValid("Translation builder with two points")) {
+      throw GeomAlgoAPI_Exception(aTranslationAlgo.getError());
+    }
+    return aTranslationAlgo.shape();
+  }
 }