Salome HOME
fde00d55d965ad3c0a5cbfacb611d7becb08cfba
[modules/shaper.git] / src / GeomAlgoAPI / GeomAlgoAPI_Prism.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 // File:        GeomAlgoAPI_Prism.h
4 // Created:     5 May 2015
5 // Author:      Dmitry Bobylev
6
7 #ifndef GeomAlgoAPI_Prism_H_
8 #define GeomAlgoAPI_Prism_H_
9
10 #include <GeomAlgoAPI.h>
11 #include <GeomAPI_Shape.h>
12 #include <GeomAlgoAPI_MakeShape.h>
13 #include <GeomAPI_DataMapOfShapeShape.h>
14 #include <memory>
15
16 /** \class GeomAlgoAPI_Prism
17  *  \ingroup DataAlgo
18  *  \brief Allows to create the prism based on a given face and bounding planes.
19  *  \n Note that only planar faces are allowed as bounding faces and resulting
20  *  extrusion will be bounded by the infinite planes taken from the faces.
21  */
22 class GeomAlgoAPI_Prism : public GeomAPI_Interface
23 {
24 public:
25   /** \brief Creates extrusion for the given shape along the normal for this shape.
26    *  \param[in] theBasis face or wire to be extruded;
27    *  \param[in] theFromShape bottom bounding shape;
28    *  \param[in] theToShape top bounding shape;
29    */
30   GEOMALGOAPI_EXPORT GeomAlgoAPI_Prism(std::shared_ptr<GeomAPI_Shape> theBasis,
31                                        std::shared_ptr<GeomAPI_Shape> theFromShape,
32                                        std::shared_ptr<GeomAPI_Shape> theToShape);
33
34   /// \return true if algorithm succeed.
35   GEOMALGOAPI_EXPORT const bool isDone() const;
36
37   /// \return true if resulting shape is valid.
38   GEOMALGOAPI_EXPORT const bool isValid() const;
39
40   /// \return true if resulting shape has volume.
41   GEOMALGOAPI_EXPORT const bool hasVolume() const;
42
43   /// \return result of the Prism algorithm.
44   GEOMALGOAPI_EXPORT const std::shared_ptr<GeomAPI_Shape>& shape() const;
45
46   /// \returns the first shape.
47   GEOMALGOAPI_EXPORT const std::shared_ptr<GeomAPI_Shape>& firstShape();
48
49   /// \return the last shape.
50   GEOMALGOAPI_EXPORT const std::shared_ptr<GeomAPI_Shape>& lastShape();
51
52   /// \return map of sub-shapes of the result. To be used for History keeping.
53   GEOMALGOAPI_EXPORT void  mapOfShapes(GeomAPI_DataMapOfShapeShape& theMap) const;
54
55   /// \return interface for History processing.
56   GEOMALGOAPI_EXPORT GeomAlgoAPI_MakeShape* makeShape() const;
57
58   /// Destructor.
59   GEOMALGOAPI_EXPORT  ~GeomAlgoAPI_Prism();
60
61 private:
62   /// Builds resulting shape.
63   void build(const std::shared_ptr<GeomAPI_Shape>& theBasis);
64
65 private:
66   /// Fields.
67   std::shared_ptr<GeomAPI_Shape> myFromShape;
68   std::shared_ptr<GeomAPI_Shape> myToShape;
69   bool myDone;
70   std::shared_ptr<GeomAPI_Shape> myShape;
71   std::shared_ptr<GeomAPI_Shape> myFirst;
72   std::shared_ptr<GeomAPI_Shape> myLast;
73   GeomAPI_DataMapOfShapeShape myMap;
74   GeomAlgoAPI_MakeShape* myMkShape;
75 };
76
77 #endif