Salome HOME
d0aa71255a567699072cbc06dbedda56f310d71e
[modules/shaper.git] / src / FeaturesPlugin / FeaturesPlugin_Fillet.h
1 // Copyright (C) 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_Fillet_H_
22 #define FeaturesPlugin_Fillet_H_
23
24 #include "FeaturesPlugin.h"
25
26 #include <GeomAPI_Shape.h>
27
28 #include <ModelAPI_Feature.h>
29
30 class GeomAlgoAPI_MakeShape;
31 class GeomAPI_DataMapOfShapeMapOfShapes;
32
33 /// \class FeaturesPlugin_Fillet
34 /// \ingroup Plugins
35 /// \brief Feature for applying the Fillet operations on Solids.
36 ///        Supports fixed radius fillet and varying 2-radius fillet.
37 class FeaturesPlugin_Fillet : public ModelAPI_Feature
38 {
39 public:
40   /// Feature kind.
41   inline static const std::string& ID()
42   {
43     static const std::string MY_ID("Fillet");
44     return MY_ID;
45   }
46
47   /// \return the kind of a feature.
48   FEATURESPLUGIN_EXPORT virtual const std::string& getKind()
49   {
50     static std::string MY_KIND = FeaturesPlugin_Fillet::ID();
51     return MY_KIND;
52   }
53
54   inline static const std::string& CREATION_METHOD()
55   {
56     static std::string MY_CREATION_METHOD("creation_method");
57     return MY_CREATION_METHOD;
58   }
59
60   inline static const std::string CREATION_METHOD_SINGLE_RADIUS()
61   {
62     static std::string MY_SINGLE_RADIUS("fixed_radius");
63     return MY_SINGLE_RADIUS;
64   }
65
66   inline static const std::string CREATION_METHOD_VARYING_RADIUS()
67   {
68     static std::string MY_VARYING_RADIUS("variable_radius");
69     return MY_VARYING_RADIUS;
70   }
71
72   /// Attribute name of main objects.
73   inline static const std::string& OBJECT_LIST_ID()
74   {
75     static const std::string MY_OBJECT_LIST_ID("main_objects");
76     return MY_OBJECT_LIST_ID;
77   }
78
79   /// Attribute name of start radius.
80   inline static const std::string& START_RADIUS_ID()
81   {
82     static const std::string MY_START_RADIUS_ID("radius1");
83     return MY_START_RADIUS_ID;
84   }
85
86   /// Attribute name of end radius.
87   inline static const std::string& END_RADIUS_ID()
88   {
89     static const std::string MY_END_RADIUS_ID("radius2");
90     return MY_END_RADIUS_ID;
91   }
92
93   /// Attribute name of a radius for fillet with fixed radius.
94   inline static const std::string& RADIUS_ID()
95   {
96     return START_RADIUS_ID();
97   }
98
99   /// Creates a new part document if needed.
100   FEATURESPLUGIN_EXPORT virtual void execute();
101
102   /// Request for initialization of data model of the feature: adding all attributes.
103   FEATURESPLUGIN_EXPORT virtual void initAttributes();
104
105   /// Use plugin manager for features creation.
106   FeaturesPlugin_Fillet();
107
108 private:
109   /// Check algorithm is finished correctly and store error otherwise
110   bool isFailed(const std::shared_ptr<GeomAlgoAPI_MakeShape>& theAlgorithm);
111
112   /// Load Naming data structure of the feature to the document
113   void loadNamingDS(std::shared_ptr<ModelAPI_ResultBody> theResultBody,
114                     const std::shared_ptr<GeomAPI_Shape> theBaseShape,
115                     const ListOfShape& theFilletShapes,
116                     const std::shared_ptr<GeomAPI_Shape> theResultShape,
117                     const std::shared_ptr<GeomAlgoAPI_MakeShape>& theMakeShape);
118 };
119
120 #endif