]> SALOME platform Git repositories - modules/shaper.git/blob - src/PrimitivesPlugin/PrimitivesPlugin_Cylinder.h
Salome HOME
Add "Cylinder" primitive.
[modules/shaper.git] / src / PrimitivesPlugin / PrimitivesPlugin_Cylinder.h
1 // Copyright (C) 2014-201x CEA/DEN, EDF R&D
2
3 // File:        PrimitivesPlugin_Cylinder.h
4 // Created:     09 Jan 2017
5 // Author:      Clarisse Genrault (CEA)
6
7 #ifndef PRIMITIVESPLUGIN_CYLINDER_H_
8 #define PRIMITIVESPLUGIN_CYLINDER_H_
9
10 #include <PrimitivesPlugin.h>
11 #include <ModelAPI_Feature.h>
12 #include <GeomAlgoAPI_Cylinder.h>
13
14 class GeomAPI_Shape;
15 class ModelAPI_ResultBody;
16
17 /**\class PrimitivesPlugin_Cylinder
18  * \ingroup Plugins
19  * \brief Feature for creation of a cylinder.
20  *
21  * Creates a cylinder from a radius, a height, an angle, a center point defaulting to
22  * the origin and an axis defaulting to OZ
23  */
24 class PrimitivesPlugin_Cylinder : public ModelAPI_Feature
25 {
26  public:
27   /// Cylinder kind
28   inline static const std::string& ID()
29   {
30     static const std::string MY_CYLINDER_ID("Cylinder");
31     return MY_CYLINDER_ID;
32   }
33
34   /// Attribute name for creation method
35   inline static const std::string& CREATION_METHOD()
36   {
37     static const std::string MY_CREATION_METHOD_ID("CreationMethod");
38     return MY_CREATION_METHOD_ID;
39   }
40   
41   /// Attribute name for creation method
42   inline static const std::string& CREATION_METHOD_CYLINDER()
43   {
44     static const std::string MY_CREATION_METHOD_ID("Cylinder");
45     return MY_CREATION_METHOD_ID;
46   }
47   
48   /// Attribute name for creation method
49   inline static const std::string& CREATION_METHOD_CYLINDER_PORTION()
50   {
51     static const std::string MY_CREATION_METHOD_ID("CylinderPortion");
52     return MY_CREATION_METHOD_ID;
53   }
54
55   /// Attribute name of the base point
56   inline static const std::string& BASE_POINT_ID()
57   {
58     static const std::string MY_BASE_POINT_ID("base_point");
59     return MY_BASE_POINT_ID;
60   }
61
62   /// Attribute name of the axis
63   inline static const std::string& AXIS_ID()
64   {
65     static const std::string MY_AXIS_ID("axis");
66     return MY_AXIS_ID;
67   }
68
69   /// Attribute name of the radius
70   inline static const std::string& RADIUS_ID()
71   {
72     static const std::string MY_RADIUS_ID("radius");
73     return MY_RADIUS_ID;
74   }
75
76   /// Attribute name of the height
77   inline static const std::string& HEIGHT_ID()
78   {
79     static const std::string MY_HEIGHT_ID("height");
80     return MY_HEIGHT_ID;
81   }
82
83   /// Attribute name of the angle
84   inline static const std::string& ANGLE_ID()
85   {
86     static const std::string MY_ANGLE_ID("angle");
87     return MY_ANGLE_ID;
88   }
89
90   /// Returns the kind of a feature
91   PRIMITIVESPLUGIN_EXPORT virtual const std::string& getKind()
92   {
93     static std::string MY_KIND = PrimitivesPlugin_Cylinder::ID();
94     return MY_KIND;
95   }
96
97   /// Creates a new part document if needed
98   PRIMITIVESPLUGIN_EXPORT virtual void execute();
99
100   /// Request for initialization of data model of the feature: adding all attributes
101   PRIMITIVESPLUGIN_EXPORT virtual void initAttributes();
102
103   /// Use plugin manager for features creation
104   PrimitivesPlugin_Cylinder();
105
106  private:
107   /// Load Naming data structure of the feature to the document
108   void loadNamingDS(std::shared_ptr<GeomAlgoAPI_Cylinder> theCylinderAlgo,
109                     std::shared_ptr<ModelAPI_ResultBody> theResultCylinder);
110
111   ///Perform the creation of a cylinder
112   void createCylinder(bool withAngle);
113
114 };
115
116 #endif // PRIMITIVESPLUGIN_CYLINDER_H_