Salome HOME
Added CPP High API for FeaturesPlugin_Revolution
[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 for creation method.
39   inline static const std::string& CREATION_METHOD_BY_ANGLES()
40   {
41     static const std::string MY_CREATION_METHOD_ID("ByAngles");
42     return MY_CREATION_METHOD_ID;
43   }
44
45   /// Attribute name for creation method.
46   inline static const std::string& CREATION_METHOD_BY_PLANES()
47   {
48     static const std::string MY_CREATION_METHOD_ID("ByPlanesAndOffsets");
49     return MY_CREATION_METHOD_ID;
50   }
51
52   /// Attribute name of an revolution axis.
53   inline static const std::string& AXIS_OBJECT_ID()
54   {
55     static const std::string MY_AXIS_OBJECT_ID("axis_object");
56     return MY_AXIS_OBJECT_ID;
57   }
58
59   /// Attribute name of revolution to angle.
60   inline static const std::string& TO_ANGLE_ID()
61   {
62     static const std::string MY_TO_ANGLE_ID("to_angle");
63     return MY_TO_ANGLE_ID;
64   }
65
66   /// Attribute name of revolution from angle.
67   inline static const std::string& FROM_ANGLE_ID()
68   {
69     static const std::string MY_FROM_ANGLE_ID("from_angle");
70     return MY_FROM_ANGLE_ID;
71   }
72
73   /// Attribute name of an object to which the revolution grows.
74   inline static const std::string& TO_OBJECT_ID()
75   {
76     static const std::string MY_TO_OBJECT_ID("to_object");
77     return MY_TO_OBJECT_ID;
78   }
79
80   /// Attribute name of revolution offset.
81   inline static const std::string& TO_OFFSET_ID()
82   {
83     static const std::string MY_TO_OFFSET_ID("to_offset");
84     return MY_TO_OFFSET_ID;
85   }
86
87   /// Attribute name of an object from which the revolution grows.
88   inline static const std::string& FROM_OBJECT_ID()
89   {
90     static const std::string MY_FROM_OBJECT_ID("from_object");
91     return MY_FROM_OBJECT_ID;
92   }
93
94   /// Attribute name of revolution offset.
95   inline static const std::string& FROM_OFFSET_ID()
96   {
97     static const std::string MY_FROM_OFFSET_ID("from_offset");
98     return MY_FROM_OFFSET_ID;
99   }
100
101   /// \return the kind of a feature.
102   FEATURESPLUGIN_EXPORT virtual const std::string& getKind()
103   {
104     static std::string MY_KIND = FeaturesPlugin_Revolution::ID();
105     return MY_KIND;
106   }
107
108   /// Creates a new part document if needed.
109   FEATURESPLUGIN_EXPORT virtual void execute();
110
111   /// Request for initialization of data model of the feature: adding all attributes.
112   FEATURESPLUGIN_EXPORT virtual void initAttributes();
113
114   /// Use plugin manager for features creation.
115   FeaturesPlugin_Revolution();
116
117   protected:
118   /// Generates revolutions.
119   /// \param[out] theBaseShapes list of base shapes.
120   /// \param[out] theMakeShapes list of according algos.
121   /// \return false in case one of algo failed.
122   bool makeRevolutions(ListOfShape& theBaseShapes,
123                        ListOfMakeShape& theMakeShapes);
124 };
125
126 #endif