]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Merge branch 'master' into cgt/devCEA
authorClarisse Genrault <clarisse.genrault@cea.fr>
Fri, 17 Mar 2017 09:57:38 +0000 (10:57 +0100)
committerClarisse Genrault <clarisse.genrault@cea.fr>
Fri, 17 Mar 2017 09:57:38 +0000 (10:57 +0100)
1  2 
src/GeomAlgoAPI/GeomAlgoAPI_ShapeAPI.cpp

index 55050b96ab1a6023669f03223a427a2333966f41,c593215ecb75d55db018f35fe60e5c23ee4e370b..160b22bebaebdf79bc0fc9ce88df9d3ff9b13bf9
@@@ -7,13 -7,12 +7,13 @@@
  #include "GeomAlgoAPI_ShapeAPI.h"
  
  #include <GeomAlgoAPI_Box.h>
 -#include <GeomAlgoAPI_Cylinder.h>
  #include <GeomAlgoAPI_CompoundBuilder.h>
  #include <GeomAlgoAPI_ConeSegment.h>
 +#include <GeomAlgoAPI_Cylinder.h>
  #include <GeomAlgoAPI_EdgeBuilder.h>
  #include <GeomAlgoAPI_Rotation.h>
  #include <GeomAlgoAPI_Scale.h>
 +#include <GeomAlgoAPI_Sphere.h>
  #include <GeomAlgoAPI_Symmetry.h>
  #include <GeomAlgoAPI_Translation.h>
  
@@@ -193,53 -192,6 +193,53 @@@ namespace GeomAlgoAPI_ShapeAP
      return aCylinderAlgo.shape();
    }
  
 +  //===============================================================================================
 +  std::shared_ptr<GeomAPI_Shape> GeomAlgoAPI_ShapeAPI::makeSphere(
 +      std::shared_ptr<GeomAPI_Pnt> theCenterPoint, double theRadius) throw (GeomAlgoAPI_Exception)
 +  {
 +    GeomAlgoAPI_Sphere aSphereAlgo(theCenterPoint, theRadius);
 +
 +    if (!aSphereAlgo.check()) {
 +      throw GeomAlgoAPI_Exception(aSphereAlgo.getError());
 +    }
 +
 +    aSphereAlgo.build();
 +
 +    if(!aSphereAlgo.isDone()) {
 +      throw GeomAlgoAPI_Exception(aSphereAlgo.getError());
 +    }
 +
 +    if (!aSphereAlgo.checkValid("Sphere builder")) {
 +      throw GeomAlgoAPI_Exception(aSphereAlgo.getError());
 +    }
 +    return aSphereAlgo.shape();
 +  }
 +
 +  //===============================================================================================
 +  std::shared_ptr<GeomAPI_Shape> GeomAlgoAPI_ShapeAPI::makeSphere(double theRadius)
 +      throw (GeomAlgoAPI_Exception)
 +  {
 +    std::shared_ptr<GeomAPI_Pnt> aCenterPoint =
 +      std::shared_ptr<GeomAPI_Pnt>(new GeomAPI_Pnt(0.,0.,0.));
 +
 +    GeomAlgoAPI_Sphere aSphereAlgo(aCenterPoint, theRadius);
 +
 +    if (!aSphereAlgo.check()) {
 +      throw GeomAlgoAPI_Exception(aSphereAlgo.getError());
 +    }
 +
 +    aSphereAlgo.build();
 +
 +    if(!aSphereAlgo.isDone()) {
 +      throw GeomAlgoAPI_Exception(aSphereAlgo.getError());
 +    }
 +
 +    if (!aSphereAlgo.checkValid("Sphere builder")) {
 +      throw GeomAlgoAPI_Exception(aSphereAlgo.getError());
 +    }
 +    return aSphereAlgo.shape();
 +  }
 +
    //===============================================================================================
    std::shared_ptr<GeomAPI_Shape> GeomAlgoAPI_ShapeAPI::makeTranslation(
      std::shared_ptr<GeomAPI_Shape> theSourceShape,
      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);
+     }
      ListOfShape aListOfShape;
      for (int i=0; i<theNumber; i++) {
        aListOfShape.
      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);
+     }
      // Coord theFirstAxis
      double x1 = theFirstAxis->dir()->x();
      double y1 = theFirstAxis->dir()->y();