Salome HOME
17b5a7f3a02a8e1b770a559caa904a50b639d0de
[modules/shaper.git] / src / GeomAlgoAPI / GeomAlgoAPI_Prism.h
1 // Copyright (C) 2014-2017  CEA/DEN, EDF R&D
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
18 //
19
20 #ifndef GeomAlgoAPI_Prism_H_
21 #define GeomAlgoAPI_Prism_H_
22
23 #include "GeomAlgoAPI.h"
24
25 #include "GeomAlgoAPI_MakeSweep.h"
26
27 #include <GeomAPI_Dir.h>
28 #include <GeomAPI_Shape.h>
29
30 #include <memory>
31
32 /// \class GeomAlgoAPI_Prism
33 /// \ingroup DataAlgo
34 /// \brief Allows to create the prism based on a given face and bounding planes.
35 /// \n Note that only planar faces are allowed as bounding faces and resulting
36 /// extrusion will be bounded by the infinite planes taken from the faces.
37 class GeomAlgoAPI_Prism : public GeomAlgoAPI_MakeSweep
38 {
39 public:
40   /// \brief Creates extrusion for the given shape along the normal for this shape.
41   /// \param[in] theBaseShape planar face or wire to be extruded.
42   /// \param[in] theToSize offset for "to" plane.
43   /// \param[in] theFromSize offset for "from" plane.
44   GEOMALGOAPI_EXPORT GeomAlgoAPI_Prism(const GeomShapePtr theBaseShape,
45                                        const double       theToSize,
46                                        const double       theFromSize);
47
48   /// \brief Creates extrusion for the given shape along the normal for this shape.
49   /// \param[in] theBaseShape vertex, edge, wire, face or shell.
50   /// \param[in] theDirection direction of extrusion.
51   ///                         Can be empty if theBaseShape is planar wire or face.
52   /// \param[in] theToSize offset for "to" plane.
53   /// \param[in] theFromSize offset for "from" plane.
54   GEOMALGOAPI_EXPORT GeomAlgoAPI_Prism(const GeomShapePtr                 theBaseShape,
55                                        const std::shared_ptr<GeomAPI_Dir> theDirection,
56                                        const double                       theToSize,
57                                        const double                       theFromSize);
58
59   /// \brief Creates extrusion for the given shape along the normal for this shape.
60   /// \param[in] theBaseShape planar face or wire to be extruded.
61   /// \param[in] theToShape top bounding shape. Can be empty.
62   ///                       In this case offset will be applied to the basis.
63   /// \param[in] theToSize offset for "to" plane.
64   /// \param[in] theFromShape bottom bounding shape. Can be empty.
65   ///                         In this case offset will be applied to the basis.
66   /// \param[in] theFromSize offset for "from" plane.
67   GEOMALGOAPI_EXPORT GeomAlgoAPI_Prism(const GeomShapePtr theBaseShape,
68                                        const GeomShapePtr theToShape,
69                                        const double       theToSize,
70                                        const GeomShapePtr theFromShape,
71                                        const double       theFromSize);
72
73   /// \brief Creates extrusion for the given shape along the normal for this shape.
74   /// \param[in] theBaseShape planar face or wire to be extruded.
75   /// \param[in] theDirection direction of extrusion.
76   ///                         Can be empty if theBaseShape is planar wire or face.
77   /// \param[in] theToShape top bounding shape. Can be empty.
78   ///                       In this case offset will be applied to the basis.
79   /// \param[in] theToSize offset for "to" plane.
80   /// \param[in] theFromShape bottom bounding shape. Can be empty.
81   ///                         In this case offset will be applied to the basis.
82   /// \param[in] theFromSize offset for "from" plane.
83   GEOMALGOAPI_EXPORT GeomAlgoAPI_Prism(const GeomShapePtr                 theBaseShape,
84                                        const std::shared_ptr<GeomAPI_Dir> theDirection,
85                                        const GeomShapePtr                 theToShape,
86                                        const double                       theToSize,
87                                        const GeomShapePtr                 theFromShape,
88                                        const double                       theFromSize);
89
90 private:
91   /// Builds resulting shape.
92   void build(const GeomShapePtr&                theBaseShape,
93              const std::shared_ptr<GeomAPI_Dir> theDirection,
94              const GeomShapePtr&                theToShape,
95              const double                       theToSize,
96              const GeomShapePtr&                theFromShape,
97              const double                       theFromSize);
98 };
99
100 #endif