Salome HOME
5f4b513d93a66244ec602a88777ea26a96dc8d9a
[modules/shaper.git] / src / FeaturesAPI / FeaturesAPI_Fillet.h
1 // Copyright (C) 2017-2023  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 email : webmaster.salome@opencascade.com
18 //
19
20 #ifndef FeaturesAPI_Fillet_H_
21 #define FeaturesAPI_Fillet_H_
22
23 #include "FeaturesAPI.h"
24
25 #include <FeaturesPlugin_Fillet.h>
26 #include <FeaturesPlugin_Fillet1D.h>
27
28 #include <ModelHighAPI_Double.h>
29 #include <ModelHighAPI_Interface.h>
30 #include <ModelHighAPI_Macro.h>
31
32 class ModelHighAPI_Selection;
33
34 /// \class FeaturesAPI_Fillet
35 /// \ingroup CPPHighAPI
36 /// \brief Interface for Fillet feature.
37 class FeaturesAPI_Fillet: public ModelHighAPI_Interface
38 {
39 public:
40   /// Destructor.
41   virtual ~FeaturesAPI_Fillet() {}
42
43   virtual std::shared_ptr<ModelAPI_AttributeDouble> radius() const = 0;
44
45   /// Modify base objects of the fillet.
46   virtual void setBase(const std::list<ModelHighAPI_Selection>& theBaseObjects) = 0;
47
48   /// Modify fillet to have fixed radius
49   virtual void setRadius(const ModelHighAPI_Double& theRadius) = 0;
50
51 protected:
52   FeaturesAPI_Fillet(const std::shared_ptr<ModelAPI_Feature>& theFeature);
53 };
54
55 /// Pointer on the fillet object.
56 typedef std::shared_ptr<FeaturesAPI_Fillet> FilletPtr;
57
58
59 /// \class FeaturesAPI_Fillet1D
60 /// \ingroup CPPHighAPI
61 /// \brief Interface for Fillet1D feature - fillet on vertices of a wire.
62 class FeaturesAPI_Fillet1D : public FeaturesAPI_Fillet
63 {
64 public:
65   /// Constructor without values.
66   FEATURESAPI_EXPORT
67   explicit FeaturesAPI_Fillet1D(const std::shared_ptr<ModelAPI_Feature>& theFeature);
68
69   /// Constructor with values.
70   FEATURESAPI_EXPORT
71   explicit FeaturesAPI_Fillet1D(const std::shared_ptr<ModelAPI_Feature>& theFeature,
72                                 const std::list<ModelHighAPI_Selection>& theBaseObjects,
73                                 const ModelHighAPI_Double& theRadius);
74
75   /// Destructor.
76   FEATURESAPI_EXPORT
77   virtual ~FeaturesAPI_Fillet1D();
78
79   INTERFACE_4(FeaturesPlugin_Fillet1D::ID(),
80               creationMethod, FeaturesPlugin_Fillet1D::CREATION_METHOD(),
81                               ModelAPI_AttributeString,
82                               /** Creation method */,
83               baseWires, FeaturesPlugin_Fillet1D::WIRE_LIST_ID(),
84                            ModelAPI_AttributeSelectionList,
85                            /** Base objects */,
86               baseVertices, FeaturesPlugin_Fillet1D::VERTEX_LIST_ID(),
87                             ModelAPI_AttributeSelectionList,
88                             /** Base objects */,
89               radius, FeaturesPlugin_Fillet1D::RADIUS_ID(),
90                       ModelAPI_AttributeDouble,
91                       /** Value of the fixed radius fillet */)
92
93   /// Modify base objects of the fillet.
94   FEATURESAPI_EXPORT
95   virtual void setBase(const std::list<ModelHighAPI_Selection>& theBaseObjects);
96
97   /// Modify fillet to have fixed radius
98   FEATURESAPI_EXPORT
99   virtual void setRadius(const ModelHighAPI_Double& theRadius);
100
101   /// Dump wrapped feature
102   FEATURESAPI_EXPORT
103   virtual void dump(ModelHighAPI_Dumper& theDumper) const;
104
105 private:
106   void execIfBaseNotEmpty();
107 };
108
109
110 /// \class FeaturesAPI_Fillet2D
111 /// \ingroup CPPHighAPI
112 /// \brief Interface for Fillet feature - fillet edges on a solid.
113 class FeaturesAPI_Fillet2D : public FeaturesAPI_Fillet
114 {
115 public:
116   /// Constructor without values.
117   FEATURESAPI_EXPORT
118   explicit FeaturesAPI_Fillet2D(const std::shared_ptr<ModelAPI_Feature>& theFeature);
119
120   /// Constructor with values.
121   FEATURESAPI_EXPORT
122   explicit FeaturesAPI_Fillet2D(const std::shared_ptr<ModelAPI_Feature>& theFeature,
123                                 const std::list<ModelHighAPI_Selection>& theBaseObjects,
124                                 const ModelHighAPI_Double& theRadius);
125
126   /// Constructor with values.
127   FEATURESAPI_EXPORT
128   explicit FeaturesAPI_Fillet2D(const std::shared_ptr<ModelAPI_Feature>& theFeature,
129                                 const std::list<ModelHighAPI_Selection>& theBaseObjects,
130                                 const ModelHighAPI_Double& theRadius1,
131                                 const ModelHighAPI_Double& theRadius2);
132
133   /// Destructor.
134   FEATURESAPI_EXPORT
135   virtual ~FeaturesAPI_Fillet2D();
136
137   INTERFACE_5(FeaturesPlugin_Fillet::ID(),
138               creationMethod, FeaturesPlugin_Fillet::CREATION_METHOD(),
139                               ModelAPI_AttributeString,
140                               /** Creation method */,
141               baseObjects, FeaturesPlugin_Fillet::OBJECT_LIST_ID(),
142                            ModelAPI_AttributeSelectionList,
143                            /** Base objects */,
144               radius, FeaturesPlugin_Fillet::RADIUS_ID(),
145                       ModelAPI_AttributeDouble,
146                       /** Value of the fixed radius fillet */,
147               startRadius, FeaturesPlugin_Fillet::START_RADIUS_ID(),
148                            ModelAPI_AttributeDouble,
149                            /** Start radius of the varying radius fillet */,
150               endRadius, FeaturesPlugin_Fillet::END_RADIUS_ID(),
151                          ModelAPI_AttributeDouble,
152                          /** End radius of the varying radius fillet */)
153
154   /// Modify base objects of the fillet.
155   FEATURESAPI_EXPORT
156   virtual void setBase(const std::list<ModelHighAPI_Selection>& theBaseObjects);
157
158   /// Modify fillet to have fixed radius
159   FEATURESAPI_EXPORT
160   virtual void setRadius(const ModelHighAPI_Double& theRadius);
161
162   /// Modify fillet to have varying radius
163   FEATURESAPI_EXPORT
164   void setRadius(const ModelHighAPI_Double& theRadius1, const ModelHighAPI_Double& theRadius2);
165
166   /// Dump wrapped feature
167   FEATURESAPI_EXPORT
168   virtual void dump(ModelHighAPI_Dumper& theDumper) const;
169
170 private:
171   void execIfBaseNotEmpty();
172 };
173
174
175 /// \ingroup CPPHighAPI
176 /// \brief Create Fillet feature.
177 FEATURESAPI_EXPORT
178 FilletPtr addFillet(const std::shared_ptr<ModelAPI_Document>& thePart,
179                     const std::list<ModelHighAPI_Selection>& theBaseObjects,
180                     const ModelHighAPI_Double& theRadius1,
181                     const ModelHighAPI_Double& theRadius2 = ModelHighAPI_Double(-1.0),
182                     const bool keepSubResults = false);
183
184 #endif // FeaturesAPI_Fillet_H_