Salome HOME
Bug #1170: wrong object names in Main objects field Partition
[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 <GeomAlgoAPI_Prism.h>
13
14 class GeomAPI_Shape;
15 class ModelAPI_ResultBody;
16
17 /**\class FeaturesPlugin_Extrusion
18  * \ingroup Plugins
19  * \brief Feature for creation of extrusion from the planar face.
20  *
21  * Extrusion creates the lateral faces based on edges of the base face and
22  * the top and bottom faces equal to the base face or this faces can be projection on the
23  * bounding planes if they were set. Direction of extrusion is taken from the face
24  * plane or if the bounding faces were set then it will be from the bottom to the top plane.
25  */
26 class FeaturesPlugin_Extrusion : public ModelAPI_Feature
27 {
28  public:
29   /// Extrusion kind
30   inline static const std::string& ID()
31   {
32     static const std::string MY_EXTRUSION_ID("Extrusion");
33     return MY_EXTRUSION_ID;
34   }
35   /// attribute name of references sketch entities list, it should contain a sketch result or
36   /// a pair a sketch result to sketch face
37   inline static const std::string& LIST_ID()
38   {
39     static const std::string MY_GROUP_LIST_ID("base");
40     return MY_GROUP_LIST_ID;
41   }
42
43   /// attribute name of an object to which the extrusion grows
44   inline static const std::string& AXIS_OBJECT_ID()
45   {
46     static const std::string MY_TO_OBJECT_ID("axis_object");
47     return MY_TO_OBJECT_ID;
48   }
49
50   /// attribute name for creation method
51   inline static const std::string& CREATION_METHOD()
52   {
53     static const std::string METHOD_ATTR("CreationMethod");
54     return METHOD_ATTR;
55   }
56
57   /// attribute name of extrusion size
58   inline static const std::string& TO_SIZE_ID()
59   {
60     static const std::string MY_TO_SIZE_ID("to_size");
61     return MY_TO_SIZE_ID;
62   }
63
64   /// attribute name of extrusion size
65   inline static const std::string& FROM_SIZE_ID()
66   {
67     static const std::string MY_FROM_SIZE_ID("from_size");
68     return MY_FROM_SIZE_ID;
69   }
70
71   /// attribute name of an object to which the extrusion grows
72   inline static const std::string& TO_OBJECT_ID()
73   {
74     static const std::string MY_TO_OBJECT_ID("to_object");
75     return MY_TO_OBJECT_ID;
76   }
77
78   /// attribute name of extrusion offset
79   inline static const std::string& TO_OFFSET_ID()
80   {
81     static const std::string MY_TO_OFFSET_ID("to_offset");
82     return MY_TO_OFFSET_ID;
83   }
84
85   /// attribute name of tool object
86   inline static const std::string& FROM_OBJECT_ID()
87   {
88     static const std::string MY_FROM_OBJECT_ID("from_object");
89     return MY_FROM_OBJECT_ID;
90   }
91
92   /// attribute name of extrusion offset
93   inline static const std::string& FROM_OFFSET_ID()
94   {
95     static const std::string MY_FROM_OFFSET_ID("from_offset");
96     return MY_FROM_OFFSET_ID;
97   }
98
99   /// Returns the kind of a feature
100   FEATURESPLUGIN_EXPORT virtual const std::string& getKind()
101   {
102     static std::string MY_KIND = FeaturesPlugin_Extrusion::ID();
103     return MY_KIND;
104   }
105
106   /// Creates a new part document if needed
107   FEATURESPLUGIN_EXPORT virtual void execute();
108
109   /// Request for initialization of data model of the feature: adding all attributes
110   FEATURESPLUGIN_EXPORT virtual void initAttributes();
111
112   /// Use plugin manager for features creation
113   FeaturesPlugin_Extrusion();
114 private:
115   /// Load Naming data structure of the feature to the document
116   void loadNamingDS(GeomAlgoAPI_Prism& thePrismAlgo,
117                     std::shared_ptr<ModelAPI_ResultBody> theResultBody,
118                     std::shared_ptr<GeomAPI_Shape> theBasis);
119 };
120
121 #endif