Salome HOME
Merge remote-tracking branch 'remotes/origin/EDF_2020_Lot2'
[modules/shaper.git] / src / GeomAlgoAPI / GeomAlgoAPI_Box.h
1 // Copyright (C) 2014-2020  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
18 //
19
20 #ifndef GEOMALGOAPI_BOX_H_
21 #define GEOMALGOAPI_BOX_H_
22
23 #include <GeomAPI_Pnt.h>
24 #include <GeomAlgoAPI_MakeShape.h>
25
26 /**\class GeomAlgoAPI_Box
27  * \ingroup DataAlgo
28  * \brief Allows to create Box Primitives
29  */
30 class GeomAlgoAPI_Box : public GeomAlgoAPI_MakeShape
31 {
32  public:
33   /// Type of box operation
34   enum MethodType {
35     BOX_DIM,   ///< Box with dimensions
36     BOX_POINTS,  ///< Box with points
37   };
38
39   GEOMALGOAPI_EXPORT GeomAlgoAPI_Box();
40
41   /// Creates a box using the dimensions.
42   /// \param theDx The dimension on X
43   /// \param theDy The dimension on Y
44   /// \param theDz The dimension on Z
45   GEOMALGOAPI_EXPORT GeomAlgoAPI_Box(const double theDx, const double theDy, const double theDz);
46
47   /// Creates a box using the two points that defined a diagonal.
48   /// \param theFirstPoint One extermity of the diagonal
49   /// \param theSecondPoint The other extremity of the diagonal
50   GEOMALGOAPI_EXPORT GeomAlgoAPI_Box(std::shared_ptr<GeomAPI_Pnt> theFirstPoint,
51                                      std::shared_ptr<GeomAPI_Pnt> theSecondPoint);
52
53   /// Checks if data for the box construction is OK.
54   GEOMALGOAPI_EXPORT bool check();
55
56   /// Builds the box.
57   GEOMALGOAPI_EXPORT void build();
58
59   /// Prepare the naming (redifined because it is specific for a box).
60   GEOMALGOAPI_EXPORT void prepareNamingFaces();
61
62  private:
63   /// Builds the box with the dimensions "Dx", "Dy" and "Dz".
64   void buildWithDimensions();
65   /// Builds the box with two points
66   void buildWithPoints();
67
68   double myDx; /// Dimension on X to create a box.
69   double myDy; /// Dimension on Y to create a box.
70   double myDz; /// Dimension Z to create a box.
71   std::shared_ptr<GeomAPI_Pnt> myFirstPoint; /// First point to create a box.
72   std::shared_ptr<GeomAPI_Pnt> mySecondPoint; /// Second point to create a box.
73   MethodType myMethodType; /// Type of method used.
74 };
75
76
77 #endif // GEOMALGOAPI_BOX_H_