1 // Copyright (C) 2014-2022 CEA/DEN, EDF R&D
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.
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.
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
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #ifndef GEOMALGOAPI_BOX_H_
21 #define GEOMALGOAPI_BOX_H_
23 #include <GeomAPI_Pnt.h>
24 #include <GeomAlgoAPI_MakeShape.h>
26 /**\class GeomAlgoAPI_Box
28 * \brief Allows to create Box Primitives
30 class GeomAlgoAPI_Box : public GeomAlgoAPI_MakeShape
33 /// Type of box operation
35 BOX_DIM, ///< Box with dimensions
36 BOX_POINTS, ///< Box with points
37 BOX_POINT_DIMS, ///<Box with coordinates of a point and dimensions
40 GEOMALGOAPI_EXPORT GeomAlgoAPI_Box();
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);
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);
54 /// Creates a box using coordinates of a point (the center of gravity) andthe dimensions.
55 /// \param theOx The X coordinate of the point
56 /// \param theOy The Y coordinate of the point
57 /// \param theOz The Z coordinate of the point
58 /// \param theDx The dimension on X
59 /// \param theDy The dimension on Y
60 /// \param theDz The dimension on Z
61 GEOMALGOAPI_EXPORT GeomAlgoAPI_Box(const double theOx, const double theOy, const double theOz,
62 const double theDx, const double theDy, const double theDz);
64 /// Checks if data for the box construction is OK.
65 GEOMALGOAPI_EXPORT bool check();
68 GEOMALGOAPI_EXPORT void build();
70 /// Prepare the naming (redifined because it is specific for a box).
71 GEOMALGOAPI_EXPORT void prepareNamingFaces();
74 /// Builds the box with the dimensions "Dx", "Dy" and "Dz".
75 void buildWithDimensions();
76 /// Builds the box with two points
77 void buildWithPoints();
78 /// Buils the box with coordinates of a point and dimensions
79 void buildWithPointAndDims();
81 double myOx; /// X coordinate of the point to create a box.
82 double myOy; /// Y coordinate of the point to create a box.
83 double myOz; /// Z coordinate of the point to create a box.
84 double myDx; /// Dimension on X to create a box.
85 double myDy; /// Dimension on Y to create a box.
86 double myDz; /// Dimension Z to create a box.
87 std::shared_ptr<GeomAPI_Pnt> myFirstPoint; /// First point to create a box.
88 std::shared_ptr<GeomAPI_Pnt> mySecondPoint; /// Second point to create a box.
89 MethodType myMethodType; /// Type of method used.
90 std::string headError; /// Head of the error message according to the method
94 #endif // GEOMALGOAPI_BOX_H_