#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>
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 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);
}
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);
}