Salome HOME
Issue #1367: Fill feature.
[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 "FeaturesPlugin_CompositeSketch.h"
13
14 #include <GeomAlgoAPI_MakeShape.h>
15
16 /// \class FeaturesPlugin_Revolution
17 /// \ingroup Plugins
18 /// \brief Feature for creation of revolution from the planar face.
19 /// Revolution creates the lateral faces based on edges of the base face and
20 /// the start and end faces and/or start and end angles.
21 class FeaturesPlugin_Revolution: public FeaturesPlugin_CompositeSketch
22 {
23 public:
24   /// Feature kind.
25   inline static const std::string& ID()
26   {
27     static const std::string MY_ID("Revolution");
28     return MY_ID;
29   }
30
31   /// Attribute name for creation method.
32   inline static const std::string& CREATION_METHOD()
33   {
34     static const std::string MY_CREATION_METHOD_ID("CreationMethod");
35     return MY_CREATION_METHOD_ID;
36   }
37
38   /// Attribute name of an revolution axis.
39   inline static const std::string& AXIS_OBJECT_ID()
40   {
41     static const std::string MY_AXIS_OBJECT_ID("axis_object");
42     return MY_AXIS_OBJECT_ID;
43   }
44
45   /// Attribute name of revolution to angle.
46   inline static const std::string& TO_ANGLE_ID()
47   {
48     static const std::string MY_TO_ANGLE_ID("to_angle");
49     return MY_TO_ANGLE_ID;
50   }
51
52   /// Attribute name of revolution from angle.
53   inline static const std::string& FROM_ANGLE_ID()
54   {
55     static const std::string MY_FROM_ANGLE_ID("from_angle");
56     return MY_FROM_ANGLE_ID;
57   }
58
59   /// Attribute name of an object to which the revolution grows.
60   inline static const std::string& TO_OBJECT_ID()
61   {
62     static const std::string MY_TO_OBJECT_ID("to_object");
63     return MY_TO_OBJECT_ID;
64   }
65
66   /// Attribute name of revolution offset.
67   inline static const std::string& TO_OFFSET_ID()
68   {
69     static const std::string MY_TO_OFFSET_ID("to_offset");
70     return MY_TO_OFFSET_ID;
71   }
72
73   /// Attribute name of an object from which the revolution grows.
74   inline static const std::string& FROM_OBJECT_ID()
75   {
76     static const std::string MY_FROM_OBJECT_ID("from_object");
77     return MY_FROM_OBJECT_ID;
78   }
79
80   /// Attribute name of revolution offset.
81   inline static const std::string& FROM_OFFSET_ID()
82   {
83     static const std::string MY_FROM_OFFSET_ID("from_offset");
84     return MY_FROM_OFFSET_ID;
85   }
86
87   /// \return the kind of a feature.
88   FEATURESPLUGIN_EXPORT virtual const std::string& getKind()
89   {
90     static std::string MY_KIND = FeaturesPlugin_Revolution::ID();
91     return MY_KIND;
92   }
93
94   /// Creates a new part document if needed.
95   FEATURESPLUGIN_EXPORT virtual void execute();
96
97   /// Request for initialization of data model of the feature: adding all attributes.
98   FEATURESPLUGIN_EXPORT virtual void initAttributes();
99
100   /// Use plugin manager for features creation.
101   FeaturesPlugin_Revolution();
102
103   protected:
104   /// Generates revolutions.
105   /// \param[out] theBaseShapes list of base shapes.
106   /// \param[out] theMakeShapes list of according algos.
107   /// \return false in case one of algo failed.
108   bool makeRevolutions(ListOfShape& theBaseShapes,
109                        ListOfMakeShape& theMakeShapes);
110 };
111
112 #endif