X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FGeomAlgoAPI%2FGeomAlgoAPI_ShapeAPI.cpp;h=bd5f6015b6eac47d0b5e6adfc9a189eca27978eb;hb=7aed285f4f887151149a909fbb3ec51251826f35;hp=f6126bddc624a5b5da408939bf354ce669b48c22;hpb=423c10234142d14d0d5de89383f2f96a4ec5930f;p=modules%2Fshaper.git diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_ShapeAPI.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_ShapeAPI.cpp index f6126bddc..bd5f6015b 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_ShapeAPI.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_ShapeAPI.cpp @@ -6,7 +6,7 @@ #include "GeomAlgoAPI_ShapeAPI.h" #include -#include +#include #include #include @@ -43,7 +43,7 @@ namespace GeomAlgoAPI_ShapeAPI std::shared_ptr theFirstPoint, std::shared_ptr theSecondPoint) throw (GeomAlgoAPI_Exception) { - GeomAlgoAPI_BoxPoints aBoxAlgo(theFirstPoint, theSecondPoint); + GeomAlgoAPI_Box aBoxAlgo(theFirstPoint, theSecondPoint); if (!aBoxAlgo.check()) { throw GeomAlgoAPI_Exception(aBoxAlgo.getError()); @@ -59,4 +59,51 @@ namespace GeomAlgoAPI_ShapeAPI } return aBoxAlgo.shape(); } + + //========================================================================================================= + std::shared_ptr GeomAlgoAPI_ShapeAPI::makeTranslation( + std::shared_ptr theSourceShape, + std::shared_ptr theAxis, + const double theDistance) throw (GeomAlgoAPI_Exception) + { + GeomAlgoAPI_Translation aTranslationAlgo(theSourceShape, theAxis, theDistance); + + if (!aTranslationAlgo.check()) { + throw GeomAlgoAPI_Exception(aTranslationAlgo.getError()); + } + + aTranslationAlgo.build(); + + if(!aTranslationAlgo.isDone()) { + throw GeomAlgoAPI_Exception(aTranslationAlgo.getError()); + } + if (!aTranslationAlgo.checkValid("Translation builder with axis and distance")) { + throw GeomAlgoAPI_Exception(aTranslationAlgo.getError()); + } + return aTranslationAlgo.shape(); + } + + //========================================================================================================= + std::shared_ptr GeomAlgoAPI_ShapeAPI::makeTranslation( + std::shared_ptr theSourceShape, + const double theDx, + const double theDy, + const double theDz) throw (GeomAlgoAPI_Exception) + { + GeomAlgoAPI_Translation aTranslationAlgo(theSourceShape, theDx, theDy, theDz); + + if (!aTranslationAlgo.check()) { + throw GeomAlgoAPI_Exception(aTranslationAlgo.getError()); + } + + aTranslationAlgo.build(); + + if(!aTranslationAlgo.isDone()) { + throw GeomAlgoAPI_Exception(aTranslationAlgo.getError()); + } + if (!aTranslationAlgo.checkValid("Translation builder with dimensions")) { + throw GeomAlgoAPI_Exception(aTranslationAlgo.getError()); + } + return aTranslationAlgo.shape(); + } }