Salome HOME
Added CPP High API for FeaturesPlugin_Pipe
[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 for creation method.
43   inline static const std::string& CREATION_METHOD_SIMPLE()
44   {
45     static const std::string MY_CREATION_METHOD("simple");
46     return MY_CREATION_METHOD;
47   }
48
49   /// Attribute name for creation method.
50   inline static const std::string& CREATION_METHOD_BINORMAL()
51   {
52     static const std::string MY_CREATION_METHOD("binormal");
53     return MY_CREATION_METHOD;
54   }
55
56   /// Attribute name for creation method.
57   inline static const std::string& CREATION_METHOD_LOCATIONS()
58   {
59     static const std::string MY_CREATION_METHOD("locations");
60     return MY_CREATION_METHOD;
61   }
62
63   /// Attribute name of base objects.
64   inline static const std::string& BASE_OBJECTS_ID()
65   {
66     static const std::string MY_BASE_OBJECTS_ID("base_objects");
67     return MY_BASE_OBJECTS_ID;
68   }
69
70   /// Attribute name of path object.
71   inline static const std::string& PATH_OBJECT_ID()
72   {
73     static const std::string MY_PATH_OBJECT_ID("path_object");
74     return MY_PATH_OBJECT_ID;
75   }
76
77   /// Attribute name of Bi-Normal.
78   inline static const std::string& BINORMAL_ID()
79   {
80     static const std::string MY_BINORMAL_ID("binormal");
81     return MY_BINORMAL_ID;
82   }
83
84   /// Attribute name of locations.
85   inline static const std::string& LOCATIONS_ID()
86   {
87     static const std::string MY_LOCATIONS_ID("locations_objects");
88     return MY_LOCATIONS_ID;
89   }
90
91   /// \return the kind of a feature.
92   FEATURESPLUGIN_EXPORT virtual const std::string& getKind()
93   {
94     static std::string MY_KIND = FeaturesPlugin_Pipe::ID();
95     return MY_KIND;
96   }
97
98   /// Creates a new part document if needed
99   FEATURESPLUGIN_EXPORT virtual void execute();
100
101   /// Request for initialization of data model of the feature: adding all attributes
102   FEATURESPLUGIN_EXPORT virtual void initAttributes();
103
104   /// Use plugin manager for features creation
105   FeaturesPlugin_Pipe();
106
107 private:
108   void storeResult(const std::shared_ptr<GeomAPI_Shape> theBaseShape,
109                    GeomAlgoAPI_Pipe& thePipeAlgo,
110                    const int theResultIndex = 0);
111
112   void storeResult(const ListOfShape& theBaseShapes,
113                    GeomAlgoAPI_Pipe& thePipeAlgo,
114                    const int theResultIndex = 0);
115
116   void storeShapes(ResultBodyPtr theResultBody,
117                    const GeomAPI_Shape::ShapeType theBaseShapeType,
118                    const std::shared_ptr<GeomAPI_DataMapOfShapeShape> theMapOfSubShapes,
119                    const ListOfShape& theShapes,
120                    const std::string theName,
121                    int& theTag);
122 };
123
124 #endif