Salome HOME
Pipe feature
[modules/shaper.git] / src / FeaturesPlugin / FeaturesPlugin_Pipe.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
2
3 // File:        FeaturesPlugin_Pipe.h
4 // Created:     16 March 2016
5 // Author:      Dmitry Bobylev
6
7 #ifndef FeaturesPlugin_Pipe_H_
8 #define FeaturesPlugin_Pipe_H_
9
10 #include "FeaturesPlugin.h"
11
12 #include <GeomAlgoAPI_Pipe.h>
13
14 #include <ModelAPI_Feature.h>
15 #include <ModelAPI_ResultBody.h>
16
17 /// \class FeaturesPlugin_Pipe
18 /// \ingroup Plugins
19 /// \brief Feature for creation of extrusion along a path.
20 /// Pipe creates extrusion of objects along a path. It produces the following results from objects:\n
21 /// Vertex -> Edge\n
22 /// Edge -> Face\n
23 /// Wire -> Shell\n
24 /// Face -> Solid
25 class FeaturesPlugin_Pipe : public ModelAPI_Feature
26 {
27 public:
28   /// Feature kind.
29   inline static const std::string& ID()
30   {
31     static const std::string MY_FEATURE_ID("Pipe");
32     return MY_FEATURE_ID;
33   }
34
35   /// Attribute name for creation method.
36   inline static const std::string& CREATION_METHOD()
37   {
38     static const std::string MY_CREATION_METHOD("creation_method");
39     return MY_CREATION_METHOD;
40   }
41
42   /// Attribute name of base objects.
43   inline static const std::string& BASE_OBJECTS_ID()
44   {
45     static const std::string MY_BASE_OBJECTS_ID("base_objects");
46     return MY_BASE_OBJECTS_ID;
47   }
48
49   /// Attribute name of path object.
50   inline static const std::string& PATH_OBJECT_ID()
51   {
52     static const std::string MY_PATH_OBJECT_ID("path_object");
53     return MY_PATH_OBJECT_ID;
54   }
55
56   /// Attribute name of Bi-Normal.
57   inline static const std::string& BINORMAL_ID()
58   {
59     static const std::string MY_BINORMAL_ID("binormal");
60     return MY_BINORMAL_ID;
61   }
62
63   /// Attribute name of locations.
64   inline static const std::string& LOCATIONS_ID()
65   {
66     static const std::string MY_LOCATIONS_ID("locations_objects");
67     return MY_LOCATIONS_ID;
68   }
69
70   /// \return the kind of a feature.
71   FEATURESPLUGIN_EXPORT virtual const std::string& getKind()
72   {
73     static std::string MY_KIND = FeaturesPlugin_Pipe::ID();
74     return MY_KIND;
75   }
76
77   /// Creates a new part document if needed
78   FEATURESPLUGIN_EXPORT virtual void execute();
79
80   /// Request for initialization of data model of the feature: adding all attributes
81   FEATURESPLUGIN_EXPORT virtual void initAttributes();
82
83   /// Use plugin manager for features creation
84   FeaturesPlugin_Pipe();
85
86 private:
87   void storeResult(const std::shared_ptr<GeomAPI_Shape> theBaseShape,
88                    GeomAlgoAPI_Pipe& thePipeAlgo,
89                    const int theResultIndex = 0);
90
91   void storeResult(const ListOfShape& theBaseShapes,
92                    GeomAlgoAPI_Pipe& thePipeAlgo,
93                    const int theResultIndex = 0);
94
95   void storeShapes(ResultBodyPtr theResultBody,
96                    const GeomAPI_Shape::ShapeType theBaseShapeType,
97                    const std::shared_ptr<GeomAPI_DataMapOfShapeShape> theMapOfSubShapes,
98                    const ListOfShape& theShapes,
99                    const std::string theName,
100                    int& theTag);
101 };
102
103 #endif