1 // Copyright (C) 2014-2017 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
18 // email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
21 #ifndef PRIMITIVESPLUGIN_CYLINDER_H_
22 #define PRIMITIVESPLUGIN_CYLINDER_H_
24 #include <PrimitivesPlugin.h>
25 #include <ModelAPI_Feature.h>
26 #include <GeomAlgoAPI_Cylinder.h>
29 class ModelAPI_ResultBody;
31 /**\class PrimitivesPlugin_Cylinder
33 * \brief Feature for creation of a cylinder.
35 * Creates a cylinder from a radius, a height, an angle, a center point defaulting to
36 * the origin and an axis defaulting to OZ
38 class PrimitivesPlugin_Cylinder : public ModelAPI_Feature
42 inline static const std::string& ID()
44 static const std::string MY_CYLINDER_ID("Cylinder");
45 return MY_CYLINDER_ID;
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_CYLINDER()
58 static const std::string MY_CREATION_METHOD_ID("Cylinder");
59 return MY_CREATION_METHOD_ID;
62 /// Attribute name for creation method
63 inline static const std::string& CREATION_METHOD_CYLINDER_PORTION()
65 static const std::string MY_CREATION_METHOD_ID("CylinderPortion");
66 return MY_CREATION_METHOD_ID;
69 /// Attribute name of the base point
70 inline static const std::string& BASE_POINT_ID()
72 static const std::string MY_BASE_POINT_ID("base_point");
73 return MY_BASE_POINT_ID;
76 /// Attribute name of the axis
77 inline static const std::string& AXIS_ID()
79 static const std::string MY_AXIS_ID("axis");
83 /// Attribute name of the radius
84 inline static const std::string& RADIUS_ID()
86 static const std::string MY_RADIUS_ID("radius");
90 /// Attribute name of the height
91 inline static const std::string& HEIGHT_ID()
93 static const std::string MY_HEIGHT_ID("height");
97 /// Attribute name of the angle
98 inline static const std::string& ANGLE_ID()
100 static const std::string MY_ANGLE_ID("angle");
104 /// Returns the kind of a feature
105 PRIMITIVESPLUGIN_EXPORT virtual const std::string& getKind()
107 static std::string MY_KIND = PrimitivesPlugin_Cylinder::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_Cylinder();
121 /// Load Naming data structure of the feature to the document
122 void loadNamingDS(std::shared_ptr<GeomAlgoAPI_Cylinder> theCylinderAlgo,
123 std::shared_ptr<ModelAPI_ResultBody> theResultCylinder);
125 ///Perform the creation of a cylinder
126 void createCylinder(bool withAngle);
130 #endif // PRIMITIVESPLUGIN_CYLINDER_H_