Salome HOME
Remove trailing whitespaces
[modules/shaper.git] / src / GeomAlgoAPI / GeomAlgoAPI_ShapeAPI.cpp
index bd5f6015b6eac47d0b5e6adfc9a189eca27978eb..f738e5c41b59bcce2c192b26806b6d28816cdf6c 100644 (file)
@@ -5,14 +5,12 @@
 // Author:      Clarisse Genrault (CEA)
 
 #include "GeomAlgoAPI_ShapeAPI.h"
-#include <GeomAlgoAPI_Box.h>
-#include <GeomAlgoAPI_Translation.h>
 
-#include <GeomAPI_Pnt.h>
-#include <GeomAPI_Edge.h>
+#include <GeomAlgoAPI_Box.h>
+#include <GeomAlgoAPI_ConeSegment.h>
 #include <GeomAlgoAPI_EdgeBuilder.h>
-
-#include <iostream>
+#include <GeomAlgoAPI_Symmetry.h>
+#include <GeomAlgoAPI_Translation.h>
 
 namespace GeomAlgoAPI_ShapeAPI
 {
@@ -106,4 +104,118 @@ namespace GeomAlgoAPI_ShapeAPI
     }
     return aTranslationAlgo.shape();
   }
+
+  //=========================================================================================================
+  std::shared_ptr<GeomAPI_Shape> GeomAlgoAPI_ShapeAPI::makeTranslation(
+    std::shared_ptr<GeomAPI_Shape> theSourceShape,
+    std::shared_ptr<GeomAPI_Pnt>   theStartPoint,
+    std::shared_ptr<GeomAPI_Pnt>   theEndPoint) throw (GeomAlgoAPI_Exception)
+  {
+    GeomAlgoAPI_Translation aTranslationAlgo(theSourceShape, theStartPoint, theEndPoint);
+
+    if (!aTranslationAlgo.check()) {
+      throw GeomAlgoAPI_Exception(aTranslationAlgo.getError());
+    }
+
+    aTranslationAlgo.build();
+
+    if(!aTranslationAlgo.isDone()) {
+      throw GeomAlgoAPI_Exception(aTranslationAlgo.getError());
+    }
+    if (!aTranslationAlgo.checkValid("Translation builder with two points")) {
+      throw GeomAlgoAPI_Exception(aTranslationAlgo.getError());
+    }
+    return aTranslationAlgo.shape();
+  }
+
+  //=========================================================================================================
+  std::shared_ptr<GeomAPI_Shape> GeomAlgoAPI_ShapeAPI::makeSymmetry(
+    std::shared_ptr<GeomAPI_Shape> theSourceShape,
+    std::shared_ptr<GeomAPI_Pnt>   thePoint) throw (GeomAlgoAPI_Exception)
+  {
+    GeomAlgoAPI_Symmetry aSymmetryAlgo(theSourceShape, thePoint);
+
+    if (!aSymmetryAlgo.check()) {
+      throw GeomAlgoAPI_Exception(aSymmetryAlgo.getError());
+    }
+
+    aSymmetryAlgo.build();
+
+    if(!aSymmetryAlgo.isDone()) {
+      throw GeomAlgoAPI_Exception(aSymmetryAlgo.getError());
+    }
+    if (!aSymmetryAlgo.checkValid("Symmetry builder by a point")) {
+      throw GeomAlgoAPI_Exception(aSymmetryAlgo.getError());
+    }
+    return aSymmetryAlgo.shape();
+  }
+
+  //=========================================================================================================
+  std::shared_ptr<GeomAPI_Shape> GeomAlgoAPI_ShapeAPI::makeSymmetry(
+    std::shared_ptr<GeomAPI_Shape> theSourceShape,
+    std::shared_ptr<GeomAPI_Ax1>   theAxis) throw (GeomAlgoAPI_Exception)
+  {
+    GeomAlgoAPI_Symmetry aSymmetryAlgo(theSourceShape, theAxis);
+
+    if (!aSymmetryAlgo.check()) {
+      throw GeomAlgoAPI_Exception(aSymmetryAlgo.getError());
+    }
+
+    aSymmetryAlgo.build();
+
+    if(!aSymmetryAlgo.isDone()) {
+      throw GeomAlgoAPI_Exception(aSymmetryAlgo.getError());
+    }
+    if (!aSymmetryAlgo.checkValid("Symmetry builder by an axis")) {
+      throw GeomAlgoAPI_Exception(aSymmetryAlgo.getError());
+    }
+    return aSymmetryAlgo.shape();
+  }
+
+  //=========================================================================================================
+  std::shared_ptr<GeomAPI_Shape> GeomAlgoAPI_ShapeAPI::makeSymmetry(
+    std::shared_ptr<GeomAPI_Shape> theSourceShape,
+    std::shared_ptr<GeomAPI_Ax2>   thePlane) throw (GeomAlgoAPI_Exception)
+  {
+    GeomAlgoAPI_Symmetry aSymmetryAlgo(theSourceShape, thePlane);
+
+    if (!aSymmetryAlgo.check()) {
+      throw GeomAlgoAPI_Exception(aSymmetryAlgo.getError());
+    }
+
+    aSymmetryAlgo.build();
+
+    if(!aSymmetryAlgo.isDone()) {
+      throw GeomAlgoAPI_Exception(aSymmetryAlgo.getError());
+    }
+    if (!aSymmetryAlgo.checkValid("Symmetry builder by a plane")) {
+      throw GeomAlgoAPI_Exception(aSymmetryAlgo.getError());
+    }
+    return aSymmetryAlgo.shape();
+  }
+
+  //=========================================================================================================
+  std::shared_ptr<GeomAPI_Shape> GeomAlgoAPI_ShapeAPI::makeConeSegment(
+    const double theRMin1, const double theRMax1,
+    const double theRMin2, const double theRMax2,
+    const double theZ,
+    const double theStartPhi, const double theDeltaPhi) throw (GeomAlgoAPI_Exception)
+  {
+    GeomAlgoAPI_ConeSegment aConeSegmentAlgo(theRMin1, theRMax1, theRMin2, theRMax2,
+                                             theZ, theStartPhi, theDeltaPhi);
+
+    if (!aConeSegmentAlgo.check()) {
+      throw GeomAlgoAPI_Exception(aConeSegmentAlgo.getError());
+    }
+
+    aConeSegmentAlgo.build();
+
+    if(!aConeSegmentAlgo.isDone()) {
+      throw GeomAlgoAPI_Exception(aConeSegmentAlgo.getError());
+    }
+    if (!aConeSegmentAlgo.checkValid("Cone Segment builder")) {
+      throw GeomAlgoAPI_Exception(aConeSegmentAlgo.getError());
+    }
+    return aConeSegmentAlgo.shape();
+  }
 }