Salome HOME
Add copyright header according to request of CEA from 06.06.2017
[modules/shaper.git] / src / FeaturesPlugin / FeaturesPlugin_Pipe.h
1 // Copyright (C) 2014-2017  CEA/DEN, EDF R&D
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or
18 // email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
19 //
20
21 #ifndef FeaturesPlugin_Pipe_H_
22 #define FeaturesPlugin_Pipe_H_
23
24 #include "FeaturesPlugin.h"
25
26 #include <GeomAlgoAPI_Pipe.h>
27
28 #include <ModelAPI_Feature.h>
29 #include <ModelAPI_ResultBody.h>
30
31 /// \class FeaturesPlugin_Pipe
32 /// \ingroup Plugins
33 /// \brief Feature for creation of extrusion along a path.
34 /// Pipe creates extrusion of objects along a path.
35 /// It produces the following results from objects:\n
36 /// Vertex -> Edge\n
37 /// Edge -> Face\n
38 /// Wire -> Shell\n
39 /// Face -> Solid
40 class FeaturesPlugin_Pipe : public ModelAPI_Feature
41 {
42 public:
43   /// Feature kind.
44   inline static const std::string& ID()
45   {
46     static const std::string MY_FEATURE_ID("Pipe");
47     return MY_FEATURE_ID;
48   }
49
50   /// Attribute name for creation method.
51   inline static const std::string& CREATION_METHOD()
52   {
53     static const std::string MY_CREATION_METHOD("creation_method");
54     return MY_CREATION_METHOD;
55   }
56
57   /// Attribute name for creation method.
58   inline static const std::string& CREATION_METHOD_SIMPLE()
59   {
60     static const std::string MY_CREATION_METHOD("simple");
61     return MY_CREATION_METHOD;
62   }
63
64   /// Attribute name for creation method.
65   inline static const std::string& CREATION_METHOD_BINORMAL()
66   {
67     static const std::string MY_CREATION_METHOD("binormal");
68     return MY_CREATION_METHOD;
69   }
70
71   /// Attribute name for creation method.
72   inline static const std::string& CREATION_METHOD_LOCATIONS()
73   {
74     static const std::string MY_CREATION_METHOD("locations");
75     return MY_CREATION_METHOD;
76   }
77
78   /// Attribute name of base objects.
79   inline static const std::string& BASE_OBJECTS_ID()
80   {
81     static const std::string MY_BASE_OBJECTS_ID("base_objects");
82     return MY_BASE_OBJECTS_ID;
83   }
84
85   /// Attribute name of path object.
86   inline static const std::string& PATH_OBJECT_ID()
87   {
88     static const std::string MY_PATH_OBJECT_ID("path_object");
89     return MY_PATH_OBJECT_ID;
90   }
91
92   /// Attribute name of Bi-Normal.
93   inline static const std::string& BINORMAL_ID()
94   {
95     static const std::string MY_BINORMAL_ID("binormal");
96     return MY_BINORMAL_ID;
97   }
98
99   /// Attribute name of locations.
100   inline static const std::string& LOCATIONS_ID()
101   {
102     static const std::string MY_LOCATIONS_ID("locations_objects");
103     return MY_LOCATIONS_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_Pipe::ID();
110     return MY_KIND;
111   }
112
113   /// Creates a new part document if needed
114   FEATURESPLUGIN_EXPORT virtual void execute();
115
116   /// Request for initialization of data model of the feature: adding all attributes
117   FEATURESPLUGIN_EXPORT virtual void initAttributes();
118
119   /// Use plugin manager for features creation
120   FeaturesPlugin_Pipe();
121
122 private:
123   void storeResult(const std::shared_ptr<GeomAPI_Shape> theBaseShape,
124                    GeomAlgoAPI_Pipe& thePipeAlgo,
125                    const int theResultIndex = 0);
126
127   void storeResult(const ListOfShape& theBaseShapes,
128                    GeomAlgoAPI_Pipe& thePipeAlgo,
129                    const int theResultIndex = 0);
130
131   void storeShapes(ResultBodyPtr theResultBody,
132                    const GeomAPI_Shape::ShapeType theBaseShapeType,
133                    const std::shared_ptr<GeomAPI_DataMapOfShapeShape> theMapOfSubShapes,
134                    const ListOfShape& theShapes,
135                    const std::string theName,
136                    int& theTag);
137 };
138
139 #endif