1 // Copyright (C) 2014-2019 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 PrimitivesPlugin_Box_H_
21 #define PrimitivesPlugin_Box_H_
23 #include <PrimitivesPlugin.h>
24 #include <ModelAPI_Feature.h>
25 #include <GeomAlgoAPI_Box.h>
28 class ModelAPI_ResultBody;
30 /**\class PrimitivesPlugin_Box
32 * \brief Feature for creation of a box primitive using various methods.
34 * Box creates a cuboid - Parallelepiped with 6 rectangular faces. It can be built via two
35 * methods : using two points that define a diagonal, or using 3 lengths that define the
36 * rectangular dimensions.
38 class PrimitivesPlugin_Box : public ModelAPI_Feature
42 inline static const std::string& ID()
44 static const std::string MY_BOX_ID("Box");
48 /// Attribute name for creation method
49 inline static const std::string& CREATION_METHOD()
51 static const std::string MY_CREATION_METHOD_ID("CreationMethod");
52 return MY_CREATION_METHOD_ID;
55 /// Attribute name for creation method
56 inline static const std::string& CREATION_METHOD_BY_DIMENSIONS()
58 static const std::string MY_CREATION_METHOD_ID("BoxByDimensions");
59 return MY_CREATION_METHOD_ID;
62 /// Attribute name for creation method
63 inline static const std::string& CREATION_METHOD_BY_TWO_POINTS()
65 static const std::string MY_CREATION_METHOD_ID("BoxByTwoPoints");
66 return MY_CREATION_METHOD_ID;
69 /// Attribute name of first point
70 inline static const std::string& POINT_FIRST_ID()
72 static const std::string MY_POINT_FIRST_ID("FirstPoint");
73 return MY_POINT_FIRST_ID;
76 /// Attribute name of second point
77 inline static const std::string& POINT_SECOND_ID()
79 static const std::string MY_POINT_SECOND_ID("SecondPoint");
80 return MY_POINT_SECOND_ID;
83 /// Attribute first coordinate
84 inline static const std::string& DX_ID()
86 static const std::string MY_DX_ID("dx");
90 /// Attribute second coordinate
91 inline static const std::string& DY_ID()
93 static const std::string MY_DY_ID("dy");
97 /// Attribute third coordinate
98 inline static const std::string& DZ_ID()
100 static const std::string MY_DZ_ID("dz");
104 /// Returns the kind of a feature
105 PRIMITIVESPLUGIN_EXPORT virtual const std::string& getKind()
107 static std::string MY_KIND = PrimitivesPlugin_Box::ID();
111 /// Creates a new part document if needed
112 PRIMITIVESPLUGIN_EXPORT virtual void execute();
114 /// Request for initialization of data model of the feature: adding all attributes
115 PRIMITIVESPLUGIN_EXPORT virtual void initAttributes();
117 /// Use plugin manager for features creation
118 PrimitivesPlugin_Box();
121 /// Load Naming data structure of the feature to the document
122 void loadNamingDS(std::shared_ptr<GeomAlgoAPI_Box> theBoxAlgo,
123 std::shared_ptr<ModelAPI_ResultBody> theResultBox);
125 ///Perform the creation of the box using two points defining a diagonal
126 void createBoxByTwoPoints();
128 ///Perform the creation of the box using three cordinates
129 void createBoxByDimensions();