Salome HOME
Fixed naming in Partition and in GeomAlgoAPI_MakeShapeList.
[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
12 #include "FeaturesPlugin_CompositeSketch.h"
13
14 #include <GeomAlgoAPI_MakeShape.h>
15
16 /// \class FeaturesPlugin_Extrusion
17 /// \ingroup Plugins
18 /// \brief Feature for creation of extrusion from the planar face.
19 /// Extrusion creates the lateral faces based on edges of the base face and
20 /// the top and bottom faces equal to the base face or this faces can be projection on the
21 /// bounding planes if they were set. Direction of extrusion is taken from the face
22 /// plane or if the bounding faces were set then it will be from the bottom to the top plane.
23 class FeaturesPlugin_Extrusion: public FeaturesPlugin_CompositeSketch
24 {
25 public:
26   /// Use plugin manager for features creation
27   FeaturesPlugin_Extrusion();
28
29   /// Feature kind.
30   inline static const std::string& ID()
31   {
32     static const std::string MY_ID("Extrusion");
33     return MY_ID;
34   }
35
36   /// Attribute name for creation method.
37   inline static const std::string& CREATION_METHOD()
38   {
39     static const std::string MY_CREATION_METHOD_ID("CreationMethod");
40     return MY_CREATION_METHOD_ID;
41   }
42
43   /// Attribute name for creation method.
44   inline static const std::string& CREATION_METHOD_BY_SIZES()
45   {
46     static const std::string MY_CREATION_METHOD_ID("BySizes");
47     return MY_CREATION_METHOD_ID;
48   }
49
50   /// Attribute name for creation method.
51   inline static const std::string& CREATION_METHOD_BY_PLANES()
52   {
53     static const std::string MY_CREATION_METHOD_ID("ByPlanesAndOffsets");
54     return MY_CREATION_METHOD_ID;
55   }
56
57   /// Attribute name of an object to which the extrusion grows.
58   inline static const std::string& DIRECTION_OBJECT_ID()
59   {
60     static const std::string MY_DIRECTION_OBJECT_ID("direction_object");
61     return MY_DIRECTION_OBJECT_ID;
62   }
63
64   /// Attribute name of extrusion to size.
65   inline static const std::string& TO_SIZE_ID()
66   {
67     static const std::string MY_TO_SIZE_ID("to_size");
68     return MY_TO_SIZE_ID;
69   }
70
71   /// Attribute name of extrusion from size.
72   inline static const std::string& FROM_SIZE_ID()
73   {
74     static const std::string MY_FROM_SIZE_ID("from_size");
75     return MY_FROM_SIZE_ID;
76   }
77
78   /// Attribute name of an object to which the extrusion grows.
79   inline static const std::string& TO_OBJECT_ID()
80   {
81     static const std::string MY_TO_OBJECT_ID("to_object");
82     return MY_TO_OBJECT_ID;
83   }
84
85   /// Attribute name of extrusion offset.
86   inline static const std::string& TO_OFFSET_ID()
87   {
88     static const std::string MY_TO_OFFSET_ID("to_offset");
89     return MY_TO_OFFSET_ID;
90   }
91
92   /// Attribute name of an object from which the extrusion grows.
93   inline static const std::string& FROM_OBJECT_ID()
94   {
95     static const std::string MY_FROM_OBJECT_ID("from_object");
96     return MY_FROM_OBJECT_ID;
97   }
98
99   /// Attribute name of extrusion offset.
100   inline static const std::string& FROM_OFFSET_ID()
101   {
102     static const std::string MY_FROM_OFFSET_ID("from_offset");
103     return MY_FROM_OFFSET_ID;
104   }
105
106   /// \return the kind of a feature.
107   FEATURESPLUGIN_EXPORT virtual const std::string& getKind()
108   {
109     static std::string MY_KIND = FeaturesPlugin_Extrusion::ID();
110     return MY_KIND;
111   }
112
113   /// Request for initialization of data model of the feature: adding all attributes.
114   FEATURESPLUGIN_EXPORT virtual void initAttributes();
115
116   /// Creates a new part document if needed.
117   FEATURESPLUGIN_EXPORT virtual void execute();
118
119 protected:
120   /// Generates extrusions.
121   /// \param[out] theBaseShapes list of base shapes.
122   /// \param[out] theMakeShapes list of according algos.
123   /// \return false in case one of algo failed.
124   bool makeExtrusions(ListOfShape& theBaseShapes,
125                       ListOfMakeShape& theMakeShapes);
126 };
127
128 #endif