Salome HOME
f3e7880491ec8c0a8b7d25d1c10d205b4913cc65
[modules/shaper.git] / src / FeaturesPlugin / FeaturesPlugin_Extrusion.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
2
3 // File:        FeaturesPlugin_Extrusion.h
4 // Created:     30 May 2014
5 // Author:      Vitaly SMETANNIKOV
6
7 #ifndef FeaturesPlugin_Extrusion_H_
8 #define FeaturesPlugin_Extrusion_H_
9
10 #include "FeaturesPlugin.h"
11 #include <ModelAPI_Feature.h>
12 #include <ModelAPI_ResultBody.h>
13 #include <GeomAlgoAPI_Extrusion.h>
14 #include <GeomAPI_Shape.h>
15
16 /**\class FeaturesPlugin_Extrusion
17  * \ingroup Plugins
18  * \brief Feature for creation of extrusion from the planar face.
19  *
20  * Extrusion creates the lateral faces based on edges of the base face and
21  * the top face equal to the base face. Direction of extrusion is taken from the face
22  * plane, but can be corrected by the "reverse" flag.
23  */
24 class FeaturesPlugin_Extrusion : public ModelAPI_Feature
25 {
26  public:
27   /// Extrusion kind
28   inline static const std::string& ID()
29   {
30     static const std::string MY_EXTRUSION_ID("Extrusion");
31     return MY_EXTRUSION_ID;
32   }
33   /// attribute name of references sketch entities list, it should contain a sketch result or
34   /// a pair a sketch result to sketch face
35   inline static const std::string& LIST_ID()
36   {
37     static const std::string MY_GROUP_LIST_ID("base");
38     return MY_GROUP_LIST_ID;
39   }
40
41   /// attribute name of an object to which the extrusion grows
42   inline static const std::string& AXIS_OBJECT_ID()
43   {
44     static const std::string MY_TO_OBJECT_ID("axis_object");
45     return MY_TO_OBJECT_ID;
46   }
47
48   /// attribute name of extrusion size
49   inline static const std::string& TO_SIZE_ID()
50   {
51     static const std::string MY_TO_SIZE_ID("to_size");
52     return MY_TO_SIZE_ID;
53   }
54
55   /// attribute name of extrusion size
56   inline static const std::string& FROM_SIZE_ID()
57   {
58     static const std::string MY_FROM_SIZE_ID("from_size");
59     return MY_FROM_SIZE_ID;
60   }
61
62   /// attribute name of an object to which the extrusion grows
63   inline static const std::string& TO_OBJECT_ID()
64   {
65     static const std::string MY_TO_OBJECT_ID("to_object");
66     return MY_TO_OBJECT_ID;
67   }
68
69   /// attribute name of tool object
70   inline static const std::string& FROM_OBJECT_ID()
71   {
72     static const std::string MY_FROM_OBJECT_ID("from_object");
73     return MY_FROM_OBJECT_ID;
74   }
75   /// attribute name of reverse direction
76  inline static const std::string& REVERSE_ID()
77  {
78    static const std::string MY_REVERSE_ID("reverse");
79    return MY_REVERSE_ID;
80  }
81
82   /// Returns the kind of a feature
83   FEATURESPLUGIN_EXPORT virtual const std::string& getKind()
84   {
85     static std::string MY_KIND = FeaturesPlugin_Extrusion::ID();
86     return MY_KIND;
87   }
88
89   /// Creates a new part document if needed
90   FEATURESPLUGIN_EXPORT virtual void execute();
91
92   /// Request for initialization of data model of the feature: adding all attributes
93   FEATURESPLUGIN_EXPORT virtual void initAttributes();
94
95   /// Use plugin manager for features creation
96   FeaturesPlugin_Extrusion();
97 private:
98   /// Load Naming data structure of the feature to the document
99   void LoadNamingDS(GeomAlgoAPI_Extrusion& theFeature, std::shared_ptr<ModelAPI_ResultBody> theResultBody,
100                         std::shared_ptr<GeomAPI_Shape> theBasis,
101                         std::shared_ptr<GeomAPI_Shape> theContext);
102
103   /// Set an empty shape to the result of extrusion
104   void clearResult();
105 };
106
107 #endif