]> SALOME platform Git repositories - modules/shaper.git/blob - src/GeomAlgoAPI/GeomAlgoAPI_Prism.h
Salome HOME
Prism algo interface changes for more convenient use in nested features.
[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] theFromDistance offset for "from" plane.
29    *  \param[in] theToShape top bounding shape.
30    *  \param[in] theToDistance offset for "to" plane.
31    */
32   GEOMALGOAPI_EXPORT GeomAlgoAPI_Prism(const std::shared_ptr<GeomAPI_Shape>& theBasis,
33                                        const std::shared_ptr<GeomAPI_Shape>& theFromShape,
34                                        double               theFromDistance,
35                                        const std::shared_ptr<GeomAPI_Shape>& theToShape,
36                                        double               theToDistance);
37
38   /// \return true if algorithm succeed.
39   GEOMALGOAPI_EXPORT bool isDone() const;
40
41   /// \return true if resulting shape is valid.
42   GEOMALGOAPI_EXPORT bool isValid() const;
43
44   /// \return true if resulting shape has volume.
45   GEOMALGOAPI_EXPORT bool hasVolume() const;
46
47   /// \return result of the Prism algorithm.
48   GEOMALGOAPI_EXPORT std::shared_ptr<GeomAPI_Shape> shape() const;
49
50   /// \returns the first shape.
51   GEOMALGOAPI_EXPORT std::shared_ptr<GeomAPI_Shape> firstShape() const;
52
53   /// \return the last shape.
54   GEOMALGOAPI_EXPORT std::shared_ptr<GeomAPI_Shape> lastShape() const;
55
56   /// \return map of sub-shapes of the result. To be used for History keeping.
57   GEOMALGOAPI_EXPORT std::shared_ptr<GeomAPI_DataMapOfShapeShape> mapOfShapes() const;
58
59   /// \return interface for History processing.
60   GEOMALGOAPI_EXPORT std::shared_ptr<GeomAlgoAPI_MakeShape> makeShape() const;
61
62 private:
63   /// Builds resulting shape.
64   void build(const std::shared_ptr<GeomAPI_Shape>& theBasis,
65              const std::shared_ptr<GeomAPI_Shape>& theFromShape,
66              double               theFromDistance,
67              const std::shared_ptr<GeomAPI_Shape>& theToShape,
68              double               theToDistance);
69
70 private:
71   /// Fields.
72   bool myDone;
73   std::shared_ptr<GeomAPI_Shape> myShape;
74   std::shared_ptr<GeomAPI_Shape> myFirst;
75   std::shared_ptr<GeomAPI_Shape> myLast;
76   std::shared_ptr<GeomAPI_DataMapOfShapeShape> myMap;
77   std::shared_ptr<GeomAlgoAPI_MakeShape> myMkShape;
78 };
79
80 #endif