From c479ee86c98acd567b30f0a85b50342c55665532 Mon Sep 17 00:00:00 2001 From: Clarisse Genrault Date: Fri, 17 Mar 2017 11:50:39 +0100 Subject: [PATCH] Fix bug for translation (id 2237 and id 2250). --- .../FeaturesAPI_MultiTranslation.cpp | 2 +- src/GeomAlgoAPI/GeomAlgoAPI_ShapeAPI.cpp | 30 +++++++++++++++---- 2 files changed, 25 insertions(+), 7 deletions(-) diff --git a/src/FeaturesAPI/FeaturesAPI_MultiTranslation.cpp b/src/FeaturesAPI/FeaturesAPI_MultiTranslation.cpp index 07732415b..64d434c7d 100644 --- a/src/FeaturesAPI/FeaturesAPI_MultiTranslation.cpp +++ b/src/FeaturesAPI/FeaturesAPI_MultiTranslation.cpp @@ -52,9 +52,9 @@ FeaturesAPI_MultiTranslation::FeaturesAPI_MultiTranslation( fillAttribute(theFirstAxisObject, firstAxisObject()); fillAttribute(theFirstStep, firstStep()); fillAttribute(theFirstNumber, firstNumber()); + fillAttribute(FeaturesPlugin_MultiTranslation::USE_SECOND_DIR_ID(),useSecondDir()); fillAttribute(theSecondAxisObject, secondAxisObject()); fillAttribute(theSecondStep, secondStep()); - fillAttribute("true",useSecondDir()); setSecondNumber(theSecondNumber); } } diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_ShapeAPI.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_ShapeAPI.cpp index c593215ec..d4b94f822 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_ShapeAPI.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_ShapeAPI.cpp @@ -412,8 +412,14 @@ namespace GeomAlgoAPI_ShapeAPI const int theNumber) throw (GeomAlgoAPI_Exception) { if (theNumber <=0) { - std::string aError = "Multitranslation builder "; - aError+=":: the number of copies for the first direction is null or negative."; + std::string aError = "Multitranslation builder "; + aError+=":: the number of copies for the first direction is null or negative."; + throw GeomAlgoAPI_Exception(aError); + } + + if (!theAxis) { + std::string aError = "Multitranslation builder "; + aError+=":: the first axis is not valid"; throw GeomAlgoAPI_Exception(aError); } @@ -436,14 +442,26 @@ namespace GeomAlgoAPI_ShapeAPI const int theSecondNumber) throw (GeomAlgoAPI_Exception) { if (theFirstNumber <=0) { - std::string aError = "Multitranslation builder "; - aError+=":: the number of copies for the first direction is null or negative."; + std::string aError = "Multitranslation builder "; + aError+=":: the number of copies for the first direction is null or negative."; throw GeomAlgoAPI_Exception(aError); } if (theSecondNumber <=0) { - std::string aError = "Multitranslation builder "; - aError+=":: the number of copies for the second direction is null or negative."; + std::string aError = "Multitranslation builder "; + aError+=":: the number of copies for the second direction is null or negative."; + throw GeomAlgoAPI_Exception(aError); + } + + if (!theFirstAxis) { + std::string aError = "Multitranslation builder "; + aError+=":: the first axis is not valid"; + throw GeomAlgoAPI_Exception(aError); + } + + if (!theSecondAxis) { + std::string aError = "Multitranslation builder "; + aError+=":: the second axis is not valid"; throw GeomAlgoAPI_Exception(aError); } -- 2.39.2