Salome HOME
26a22bf5d85d58ce87d0cd47f55080a585461cd7
[modules/shaper.git] / src / GeomAlgoAPI / GeomAlgoAPI_Extrusion.h
1 // File:        GeomAlgoAPI_Extrusion.h
2 // Created:     22 October 2014
3 // Author:      Sergey Zaritchny
4
5 #ifndef GeomAlgoAPI_Extrusion_H_
6 #define GeomAlgoAPI_Extrusion_H_
7
8 #include <GeomAlgoAPI.h>
9 #include <GeomAPI_Shape.h>
10 #include <GeomAPI_Dir.h>
11 #include <GeomAlgoAPI_MakeShape.h>
12 #include <GeomAPI_DataMapOfShapeShape.h>
13 #include <memory>
14 /**\class GeomAlgoAPI_Extrusion
15  * \ingroup DataAlgo
16  * \brief Allows to create the prism based on a given face and a direction
17  */
18
19 class GeomAlgoAPI_Extrusion : public GeomAPI_Interface
20 {
21  public:
22
23   /* \brief Creates extrusion for the given shape along the normal for this shape
24    * \param[in] theBasis face or wire to be extruded
25    * \param[in] theSize  the length of extrusion (if the value is less than 0, the extrusion in opposite normal)
26    * \return a solid or a face/shell which is obtained from specified one  
27    */
28   /// Constructor
29   GEOMALGOAPI_EXPORT GeomAlgoAPI_Extrusion (std::shared_ptr<GeomAPI_Shape> theBasis, double theSize);
30
31   /// Returns True if algorithm succeed
32   GEOMALGOAPI_EXPORT const bool isDone() const;
33
34   ///  Returns True if resulting shape is valid
35   GEOMALGOAPI_EXPORT const bool isValid() const;
36
37   /// Returns True if resulting shape has volume
38   GEOMALGOAPI_EXPORT const bool hasVolume() const;
39
40   /// Returns result of the Extrusion algorithm which may be a Solid or a Face
41   GEOMALGOAPI_EXPORT const std::shared_ptr<GeomAPI_Shape>& shape () const;
42
43   /// Returns the first shape 
44   GEOMALGOAPI_EXPORT const std::shared_ptr<GeomAPI_Shape>& firstShape();
45
46   /// returns last shape
47   GEOMALGOAPI_EXPORT const std::shared_ptr<GeomAPI_Shape>& lastShape(); 
48  
49   /// Returns map of sub-shapes of the result. To be used for History keeping
50   GEOMALGOAPI_EXPORT void  mapOfShapes (GeomAPI_DataMapOfShapeShape& theMap) const;
51
52   /// Return interface for for History processing
53   GEOMALGOAPI_EXPORT GeomAlgoAPI_MakeShape* makeShape () const;
54
55   /// Destructor
56   GEOMALGOAPI_EXPORT  ~GeomAlgoAPI_Extrusion();
57 private:
58   /// builds resulting shape
59   void build(const std::shared_ptr<GeomAPI_Shape>& theBasis);
60   /// fields
61   double mySize;
62   bool myDone;
63   std::shared_ptr<GeomAPI_Shape> myShape;
64   std::shared_ptr<GeomAPI_Shape> myFirst;
65   std::shared_ptr<GeomAPI_Shape> myLast;
66   GeomAPI_DataMapOfShapeShape myMap;
67   GeomAlgoAPI_MakeShape * myMkShape;
68 };
69
70 #endif