Salome HOME
Separate attributes for Extrusion and Revolution features.
[modules/shaper.git] / src / FeaturesPlugin / FeaturesPlugin_Revolution.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 // File:        FeaturesPlugin_Revolution.h
4 // Created:     12 May 2015
5 // Author:      Dmitry Bobylev
6
7 #ifndef FeaturesPlugin_Revolution_H_
8 #define FeaturesPlugin_Revolution_H_
9
10 #include <FeaturesPlugin.h>
11
12 #include <GeomAlgoAPI_Revolution.h>
13 #include <ModelAPI_Feature.h>
14
15 class GeomAPI_Shape;
16 class ModelAPI_ResultBody;
17
18 /** \class FeaturesPlugin_Revolution
19  *  \ingroup Plugins
20  *  \brief Feature for creation of revolution from the planar face.
21  *  Revolution creates the lateral faces based on edges of the base face and
22  *  the start and end faces and/or start and end angles.
23  */
24 class FeaturesPlugin_Revolution : public ModelAPI_Feature
25 {
26  public:
27   /// Revolution kind.
28   inline static const std::string& ID()
29   {
30     static const std::string MY_REVOLUTION_ID("Revolution");
31     return MY_REVOLUTION_ID;
32   }
33
34   /// Attribute name of references sketch entities list, it should contain a sketch result or
35   /// a pair a sketch result to sketch face.
36   inline static const std::string& LIST_ID()
37   {
38     static const std::string MY_GROUP_LIST_ID("base");
39     return MY_GROUP_LIST_ID;
40   }
41
42   /// Attribute name of an revolution axis.
43   inline static const std::string& AXIS_OBJECT_ID()
44   {
45     static const std::string MY_AXIS_ID("axis_object");
46     return MY_AXIS_ID;
47   }
48
49   /// attribute name for creation method
50   inline static const std::string& CREATION_METHOD()
51   {
52     static const std::string METHOD_ATTR("CreationMethod");
53     return METHOD_ATTR;
54   }
55
56   /// Attribute name of revolution angle.
57   inline static const std::string& TO_ANGLE_ID()
58   {
59     static const std::string MY_TO_ANGLE_ID("to_angle");
60     return MY_TO_ANGLE_ID;
61   }
62
63   /// Attribute name of revolution angle.
64   inline static const std::string& FROM_ANGLE_ID()
65   {
66     static const std::string MY_FROM_ANGLE_ID("from_angle");
67     return MY_FROM_ANGLE_ID;
68   }
69
70   /// Attribute name of an object to which the revolution grows.
71   inline static const std::string& TO_OBJECT_ID()
72   {
73     static const std::string MY_TO_OBJECT_ID("to_object");
74     return MY_TO_OBJECT_ID;
75   }
76
77   /// attribute name of extrusion offset.
78   inline static const std::string& TO_OFFSET_ID()
79   {
80     static const std::string MY_TO_OFFSET_ID("to_offset");
81     return MY_TO_OFFSET_ID;
82   }
83
84   /// Attribute name of tool object.
85   inline static const std::string& FROM_OBJECT_ID()
86   {
87     static const std::string MY_FROM_OBJECT_ID("from_object");
88     return MY_FROM_OBJECT_ID;
89   }
90
91   /// attribute name of extrusion offset.
92   inline static const std::string& FROM_OFFSET_ID()
93   {
94     static const std::string MY_FROM_OFFSET_ID("from_offset");
95     return MY_FROM_OFFSET_ID;
96   }
97
98   /// \return the kind of a feature.
99   FEATURESPLUGIN_EXPORT virtual const std::string& getKind()
100   {
101     static std::string MY_KIND = FeaturesPlugin_Revolution::ID();
102     return MY_KIND;
103   }
104
105   /// Creates a new part document if needed.
106   FEATURESPLUGIN_EXPORT virtual void execute();
107
108   /// Request for initialization of data model of the feature: adding all attributes.
109   FEATURESPLUGIN_EXPORT virtual void initAttributes();
110
111   /// Use plugin manager for features creation.
112   FeaturesPlugin_Revolution();
113
114 private:
115   /// Load Naming data structure of the feature to the document.
116   void LoadNamingDS(GeomAlgoAPI_Revolution& theFeature, std::shared_ptr<ModelAPI_ResultBody> theResultBody,
117                     std::shared_ptr<GeomAPI_Shape> theBasis,
118                     std::shared_ptr<GeomAPI_Shape> theContext);
119 };
120
121 #endif