Salome HOME
c47af8b464356c7cf970613c63946d0232972d74
[modules/shaper.git] / src / GeomAlgoAPI / GeomAlgoAPI_Box.h
1 // Copyright (C) 2014-2016 CEA/DEN, EDF R&D
2
3 // File:        GeomAlgoAPI_Box.h
4 // Created:     17 Mar 2016
5 // Author:      Clarisse Genrault (CEA)
6
7 #ifndef GeomAlgoAPI_Box_H_
8 #define GeomAlgoAPI_Box_H_
9
10 #include <GeomAPI_Pnt.h>
11 #include <GeomAlgoAPI_MakeShape.h>
12
13 /**\class GeomAlgoAPI_Box
14  * \ingroup DataAlgo
15  * \brief Allows to create Box Primitives
16  */
17 class GeomAlgoAPI_Box : public GeomAlgoAPI_MakeShape
18 {
19  public:
20   /// Type of box operation
21   enum MethodType {
22     BOX_DIM,   ///< Box with dimensions
23     BOX_POINTS,  ///< Box with points
24   };
25
26   GEOMALGOAPI_EXPORT GeomAlgoAPI_Box();
27
28   /// Creates a box using the dimensions.
29   /// \param theDx The dimension on X
30   /// \param theDy The dimension on Y
31   /// \param theDz The dimension on Z
32   GEOMALGOAPI_EXPORT GeomAlgoAPI_Box(const double theDx, const double theDy, const double theDz);
33
34   /// Creates a box using the two points that defined a diagonal.
35   /// \param theFirstPoint One extermity of the diagonal
36   /// \param theSecondPoint The other extremity of the diagonal
37   GEOMALGOAPI_EXPORT GeomAlgoAPI_Box(std::shared_ptr<GeomAPI_Pnt> theFirstPoint,
38                                      std::shared_ptr<GeomAPI_Pnt> theSecondPoint);
39
40   /// Checks if data for the box construction is OK.
41   GEOMALGOAPI_EXPORT bool check();
42
43   /// Builds the box.
44   GEOMALGOAPI_EXPORT void build();
45
46   /// Prepare the naming (redifined because it is specific for a box).
47   GEOMALGOAPI_EXPORT void prepareNamingFaces();
48
49  private:
50   /// Builds the box with the dimensions "Dx", "Dy" and "Dz".
51   void buildWithDimensions();
52   /// Builds the box with two points
53   void buildWithPoints();
54
55   double myDx; /// Dimension on X to create a box.
56   double myDy; /// Dimension on Y to create a box.
57   double myDz; /// Dimension Z to create a box.
58   std::shared_ptr<GeomAPI_Pnt> myFirstPoint; /// First point to create a box.
59   std::shared_ptr<GeomAPI_Pnt> mySecondPoint; /// Second point to create a box.
60   MethodType myMethodType; /// Type of method used.
61 };
62
63
64 #endif