Salome HOME
Merge branch 'master' into cgt/devCEA
[modules/shaper.git] / src / GeomAlgoAPI / GeomAlgoAPI_ShapeAPI.cpp
index 55050b96ab1a6023669f03223a427a2333966f41..e02a28cc5449449847a653e4d248a1823fbb0c1b 100644 (file)
@@ -459,6 +459,18 @@ namespace GeomAlgoAPI_ShapeAPI
     const double theStep,
     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.";
+      throw GeomAlgoAPI_Exception(aError);
+    }
+
+    if (!theAxis) {
+      std::string aError = "Multitranslation builder ";
+      aError+=":: the first axis is not valid";
+      throw GeomAlgoAPI_Exception(aError);
+    }
+
     ListOfShape aListOfShape;
     for (int i=0; i<theNumber; i++) {
       aListOfShape.
@@ -477,6 +489,30 @@ namespace GeomAlgoAPI_ShapeAPI
     const double theSecondStep,
     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.";
+      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.";
+      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);
+    }
+
     // Coord theFirstAxis
     double x1 = theFirstAxis->dir()->x();
     double y1 = theFirstAxis->dir()->y();