Salome HOME
Fix bug for translation (id 2237 and id 2250).
authorClarisse Genrault <clarisse.genrault@cea.fr>
Fri, 17 Mar 2017 10:50:39 +0000 (11:50 +0100)
committerClarisse Genrault <clarisse.genrault@cea.fr>
Fri, 17 Mar 2017 10:50:39 +0000 (11:50 +0100)
src/FeaturesAPI/FeaturesAPI_MultiTranslation.cpp
src/GeomAlgoAPI/GeomAlgoAPI_ShapeAPI.cpp

index 07732415b27fc3958d7a5d71f9d978b0ac6ad6ef..64d434c7d88b6d6f2b0b73d7591aeb7698aeea91 100644 (file)
@@ -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);
   }
 }
index c593215ecb75d55db018f35fe60e5c23ee4e370b..d4b94f822ad29034b8cde240f2604429471e7d32 100644 (file)
@@ -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);
     }