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