Salome HOME
Compsolid creation in extrusion
[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] theToSize offset for "to" plane.
28    *  \param[in] theFromSize offset for "from" plane.
29    */
30   GEOMALGOAPI_EXPORT GeomAlgoAPI_Prism(std::shared_ptr<GeomAPI_Shape> theBasis,
31                                        double                         theToSize,
32                                        double                         theFromSize);
33
34   /** \brief Creates extrusion for the given shape along the normal for this shape.
35    *  \param[in] theBasis face or wire to be extruded.
36    *  \param[in] theToShape top bounding shape.  Can be empty. In this case offset will be applied to the basis.
37    *  \param[in] theToSize offset for "to" plane.
38    *  \param[in] theFromShape bottom bounding shape. Can be empty. In this case offset will be applied to the basis.
39    *  \param[in] theFromSize offset for "from" plane.
40    */
41   GEOMALGOAPI_EXPORT GeomAlgoAPI_Prism(std::shared_ptr<GeomAPI_Shape> theBasis,
42                                        std::shared_ptr<GeomAPI_Shape> theToShape,
43                                        double                         theToSize,
44                                        std::shared_ptr<GeomAPI_Shape> theFromShape,
45                                        double                         theFromSize);
46
47   /// \return true if algorithm succeed.
48   GEOMALGOAPI_EXPORT bool isDone() const;
49
50   /// \return true if resulting shape is valid.
51   GEOMALGOAPI_EXPORT bool isValid() const;
52
53   /// \return true if resulting shape has volume.
54   GEOMALGOAPI_EXPORT bool hasVolume() const;
55
56   /// \return result of the Prism algorithm.
57   GEOMALGOAPI_EXPORT std::shared_ptr<GeomAPI_Shape> shape() const;
58
59   /// \returns the list of from faces.
60   GEOMALGOAPI_EXPORT const ListOfShape& fromFaces() const;
61
62   /// \return the list of to faces.
63   GEOMALGOAPI_EXPORT const ListOfShape& toFaces() const;
64
65   /// \return map of sub-shapes of the result. To be used for History keeping.
66   GEOMALGOAPI_EXPORT std::shared_ptr<GeomAPI_DataMapOfShapeShape> mapOfShapes() const;
67
68   /// \return interface for History processing.
69   GEOMALGOAPI_EXPORT std::shared_ptr<GeomAlgoAPI_MakeShape> makeShape() const;
70
71 private:
72   /// Builds resulting shape.
73   void build(const std::shared_ptr<GeomAPI_Shape>& theBasis,
74              const std::shared_ptr<GeomAPI_Shape>& theToShape,
75              double                                theToSize,
76              const std::shared_ptr<GeomAPI_Shape>& theFromShape,
77              double                                theFromSize);
78
79 private:
80   /// Fields.
81   bool myDone;
82   std::shared_ptr<GeomAPI_Shape> myShape;
83   ListOfShape myFromFaces;
84   ListOfShape myToFaces;
85   std::shared_ptr<GeomAPI_DataMapOfShapeShape> myMap;
86   std::shared_ptr<GeomAlgoAPI_MakeShape> myMkShape;
87 };
88
89 #endif