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 PRIMITIVESPLUGIN_CYLINDER_H_
21 #define PRIMITIVESPLUGIN_CYLINDER_H_
23 #include <PrimitivesPlugin.h>
24 #include <ModelAPI_Feature.h>
25 #include <GeomAlgoAPI_Cylinder.h>
28 class ModelAPI_ResultBody;
30 /**\class PrimitivesPlugin_Cylinder
32 * \brief Feature for creation of a cylinder.
34 * Creates a cylinder from a radius, a height, an angle, a center point defaulting to
35 * the origin and an axis defaulting to OZ
37 class PrimitivesPlugin_Cylinder : public ModelAPI_Feature
41 inline static const std::string& ID()
43 static const std::string MY_CYLINDER_ID("Cylinder");
44 return MY_CYLINDER_ID;
47 /// Attribute name for creation method
48 inline static const std::string& CREATION_METHOD()
50 static const std::string MY_CREATION_METHOD_ID("CreationMethod");
51 return MY_CREATION_METHOD_ID;
54 /// Attribute name for creation method
55 inline static const std::string& CREATION_METHOD_CYLINDER()
57 static const std::string MY_CREATION_METHOD_ID("Cylinder");
58 return MY_CREATION_METHOD_ID;
61 /// Attribute name for creation method
62 inline static const std::string& CREATION_METHOD_CYLINDER_PORTION()
64 static const std::string MY_CREATION_METHOD_ID("CylinderPortion");
65 return MY_CREATION_METHOD_ID;
68 /// Attribute name of the base point
69 inline static const std::string& BASE_POINT_ID()
71 static const std::string MY_BASE_POINT_ID("base_point");
72 return MY_BASE_POINT_ID;
75 /// Attribute name of the axis
76 inline static const std::string& AXIS_ID()
78 static const std::string MY_AXIS_ID("axis");
82 /// Attribute name of the radius
83 inline static const std::string& RADIUS_ID()
85 static const std::string MY_RADIUS_ID("radius");
89 /// Attribute name of the height
90 inline static const std::string& HEIGHT_ID()
92 static const std::string MY_HEIGHT_ID("height");
96 /// Attribute name of the angle
97 inline static const std::string& ANGLE_ID()
99 static const std::string MY_ANGLE_ID("angle");
103 /// Returns the kind of a feature
104 PRIMITIVESPLUGIN_EXPORT virtual const std::string& getKind()
106 static std::string MY_KIND = PrimitivesPlugin_Cylinder::ID();
110 /// Creates a new part document if needed
111 PRIMITIVESPLUGIN_EXPORT virtual void execute();
113 /// Request for initialization of data model of the feature: adding all attributes
114 PRIMITIVESPLUGIN_EXPORT virtual void initAttributes();
116 /// Use plugin manager for features creation
117 PrimitivesPlugin_Cylinder();
120 /// Load Naming data structure of the feature to the document
121 void loadNamingDS(std::shared_ptr<GeomAlgoAPI_Cylinder> theCylinderAlgo,
122 std::shared_ptr<ModelAPI_ResultBody> theResultCylinder);
124 ///Perform the creation of a cylinder
125 void createCylinder(bool withAngle);
129 #endif // PRIMITIVESPLUGIN_CYLINDER_H_