Salome HOME
Update copyrights
[modules/shaper.git] / src / FeaturesAPI / FeaturesAPI_RevolutionBoolean.h
1 // Copyright (C) 2014-2019  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_RevolutionBoolean_H_
21 #define FeaturesAPI_RevolutionBoolean_H_
22
23 #include "FeaturesAPI.h"
24
25 #include <FeaturesPlugin_CompositeBoolean.h>
26 #include <FeaturesPlugin_RevolutionCut.h>
27 #include <FeaturesPlugin_RevolutionFuse.h>
28
29 #include <ModelHighAPI_Interface.h>
30 #include <ModelHighAPI_Macro.h>
31
32 class ModelHighAPI_Double;
33 class ModelHighAPI_Dumper;
34 class ModelHighAPI_Reference;
35 class ModelHighAPI_Selection;
36
37 /// \class FeaturesAPI_RevolutionBoolean
38 /// \ingroup CPPHighAPI
39 /// \brief Interface for RevolutionBoolean feature.
40 class FeaturesAPI_RevolutionBoolean: public ModelHighAPI_Interface
41 {
42 public:
43   /// Destructor.
44   FEATURESAPI_EXPORT
45   virtual ~FeaturesAPI_RevolutionBoolean();
46
47   INTERFACE_11("",
48                sketch, FeaturesPlugin_Revolution::SKETCH_ID(),
49                ModelAPI_AttributeReference, /** Sketch launcher */,
50                baseObjects, FeaturesPlugin_Revolution::BASE_OBJECTS_ID(),
51                ModelAPI_AttributeSelectionList, /** Base objects */,
52                axis, FeaturesPlugin_Revolution::AXIS_OBJECT_ID(),
53                ModelAPI_AttributeSelection, /** Axis */,
54                creationMethod, FeaturesPlugin_Revolution::CREATION_METHOD(),
55                ModelAPI_AttributeString, /** Creation method */,
56                toAngle, FeaturesPlugin_Revolution::TO_ANGLE_ID(),
57                ModelAPI_AttributeDouble, /** To angle */,
58                fromAngle, FeaturesPlugin_Revolution::FROM_ANGLE_ID(),
59                ModelAPI_AttributeDouble, /** From angle */,
60                toObject, FeaturesPlugin_Revolution::TO_OBJECT_ID(),
61                ModelAPI_AttributeSelection, /** To object */,
62                toOffset, FeaturesPlugin_Revolution::TO_OFFSET_ID(),
63                ModelAPI_AttributeDouble, /** To offset */,
64                fromObject, FeaturesPlugin_Revolution::FROM_OBJECT_ID(),
65                ModelAPI_AttributeSelection, /** From object */,
66                fromOffset, FeaturesPlugin_Revolution::FROM_OFFSET_ID(),
67                ModelAPI_AttributeDouble, /** From offset */,
68                booleanObjects, FeaturesPlugin_CompositeBoolean::OBJECTS_ID(),
69                ModelAPI_AttributeSelectionList, /** Boolean objects */)
70
71   /// Modify base attribute of the feature.
72   FEATURESAPI_EXPORT
73   void setNestedSketch(const ModelHighAPI_Reference& theSketch);
74
75   /// Modify base attribute of the feature.
76   FEATURESAPI_EXPORT
77   void setBase(const std::list<ModelHighAPI_Selection>& theBaseObjects);
78
79   /// Modify axis_object attribute of the feature.
80   FEATURESAPI_EXPORT
81   void setAxis(const ModelHighAPI_Selection& theAxis);
82
83   /// Modify CreationMethod, to_angle, from_angle attributes of the feature.
84   FEATURESAPI_EXPORT
85   void setAngles(const ModelHighAPI_Double& theToAngle, const ModelHighAPI_Double& theFromAngle);
86
87   /// Modify creation_method, to_angle, from_angle attributes of the feature.
88   FEATURESAPI_EXPORT
89   void setAngle(const ModelHighAPI_Double& theAngle);
90
91   /// Modify creation_method, to_object, to_offset, from_object,
92   /// from_offset attributes of the feature.
93   FEATURESAPI_EXPORT
94   void setPlanesAndOffsets(const ModelHighAPI_Selection& theToObject,
95                            const ModelHighAPI_Double& theToOffset,
96                            const ModelHighAPI_Selection& theFromObject,
97                            const ModelHighAPI_Double& theFromOffset);
98
99   /// Modiyfy main_objects attribute of the feature.
100   FEATURESAPI_EXPORT
101   void setBooleanObjects(const std::list<ModelHighAPI_Selection>& theBooleanObjects);
102
103   /// Dump wrapped feature
104   FEATURESAPI_EXPORT
105   virtual void dump(ModelHighAPI_Dumper& theDumper) const;
106
107 protected:
108   /// Constructor without values.
109   FEATURESAPI_EXPORT
110   explicit FeaturesAPI_RevolutionBoolean(const std::shared_ptr<ModelAPI_Feature>& theFeature);
111
112 private:
113   void execIfBaseNotEmpty();
114 };
115
116 /// \class FeaturesAPI_RevolutionCut
117 /// \ingroup CPPHighAPI
118 /// \brief Interface for RevolutionCut feature.
119 class FeaturesAPI_RevolutionCut: public FeaturesAPI_RevolutionBoolean
120 {
121 public:
122
123   static std::string ID() { return FeaturesPlugin_RevolutionCut::ID(); }
124   virtual std::string getID() { return ID(); }
125
126   /// Constructor without values.
127   FEATURESAPI_EXPORT
128   explicit FeaturesAPI_RevolutionCut(const std::shared_ptr<ModelAPI_Feature>& theFeature);
129
130   /// Constructor with values.
131   FEATURESAPI_EXPORT
132   explicit FeaturesAPI_RevolutionCut(const std::shared_ptr<ModelAPI_Feature>& theFeature,
133                                      const std::list<ModelHighAPI_Selection>& theBaseObjects,
134                                      const ModelHighAPI_Selection& theAxis,
135                                      const ModelHighAPI_Double& theAngle,
136                                      const std::list<ModelHighAPI_Selection>& theBooleanObjects);
137
138   /// Constructor with values.
139   FEATURESAPI_EXPORT
140   explicit FeaturesAPI_RevolutionCut(const std::shared_ptr<ModelAPI_Feature>& theFeature,
141                                      const std::list<ModelHighAPI_Selection>& theBaseObjects,
142                                      const ModelHighAPI_Selection& theAxis,
143                                      const ModelHighAPI_Double& theToAngle,
144                                      const ModelHighAPI_Double& theFromAngle,
145                                      const std::list<ModelHighAPI_Selection>& theBooleanObjects);
146
147   /// Constructor with values.
148   FEATURESAPI_EXPORT
149   explicit FeaturesAPI_RevolutionCut(const std::shared_ptr<ModelAPI_Feature>& theFeature,
150                                      const std::list<ModelHighAPI_Selection>& theBaseObjects,
151                                      const ModelHighAPI_Selection& theAxis,
152                                      const ModelHighAPI_Selection& theToObject,
153                                      const ModelHighAPI_Double& theToOffset,
154                                      const ModelHighAPI_Selection& theFromObject,
155                                      const ModelHighAPI_Double& theFromOffset,
156                                      const std::list<ModelHighAPI_Selection>& theBooleanObjects);
157 };
158
159 /// Pointer on RevolutionCut object.
160 typedef std::shared_ptr<FeaturesAPI_RevolutionCut> RevolutionCutPtr;
161
162 /// \ingroup CPPHighAPI
163 /// \brief Create RevolutionCut feature.
164 FEATURESAPI_EXPORT
165 RevolutionCutPtr addRevolutionCut(const std::shared_ptr<ModelAPI_Document>& thePart,
166                                   const std::list<ModelHighAPI_Selection>& theBaseObjects,
167                                   const ModelHighAPI_Selection& theAxis,
168                                   const ModelHighAPI_Double& theAngle,
169                                   const std::list<ModelHighAPI_Selection>& theBooleanObjects);
170
171 /// \ingroup CPPHighAPI
172 /// \brief Create RevolutionCut feature.
173 FEATURESAPI_EXPORT
174 RevolutionCutPtr addRevolutionCut(const std::shared_ptr<ModelAPI_Document>& thePart,
175                                   const std::list<ModelHighAPI_Selection>& theBaseObjects,
176                                   const ModelHighAPI_Selection& theAxis,
177                                   const ModelHighAPI_Double& theToAngle,
178                                   const ModelHighAPI_Double& theFromAngle,
179                                   const std::list<ModelHighAPI_Selection>& theBooleanObjects);
180
181 /// \ingroup CPPHighAPI
182 /// \brief Create RevolutionCut feature.
183 FEATURESAPI_EXPORT
184 RevolutionCutPtr addRevolutionCut(const std::shared_ptr<ModelAPI_Document>& thePart,
185                                   const std::list<ModelHighAPI_Selection>& theBaseObjects,
186                                   const ModelHighAPI_Selection& theAxis,
187                                   const ModelHighAPI_Selection& theToObject,
188                                   const ModelHighAPI_Double& theToOffset,
189                                   const ModelHighAPI_Selection& theFromObject,
190                                   const ModelHighAPI_Double& theFromOffset,
191                                   const std::list<ModelHighAPI_Selection>& theBooleanObjects);
192
193 /// \class FeaturesAPI_RevolutionFuse
194 /// \ingroup CPPHighAPI
195 /// \brief Interface for RevolutionFuse feature.
196 class FeaturesAPI_RevolutionFuse: public FeaturesAPI_RevolutionBoolean
197 {
198 public:
199
200   static std::string ID() { return FeaturesPlugin_RevolutionFuse::ID(); }
201   virtual std::string getID() { return ID(); }
202
203   /// Constructor without values.
204   FEATURESAPI_EXPORT
205   explicit FeaturesAPI_RevolutionFuse(const std::shared_ptr<ModelAPI_Feature>& theFeature);
206
207   /// Constructor with values.
208   FEATURESAPI_EXPORT
209   explicit FeaturesAPI_RevolutionFuse(const std::shared_ptr<ModelAPI_Feature>& theFeature,
210                                       const std::list<ModelHighAPI_Selection>& theBaseObjects,
211                                       const ModelHighAPI_Selection& theAxis,
212                                       const ModelHighAPI_Double& theAngle,
213                                       const std::list<ModelHighAPI_Selection>& theBooleanObjects);
214
215   /// Constructor with values.
216   FEATURESAPI_EXPORT
217   explicit FeaturesAPI_RevolutionFuse(const std::shared_ptr<ModelAPI_Feature>& theFeature,
218                                       const std::list<ModelHighAPI_Selection>& theBaseObjects,
219                                       const ModelHighAPI_Selection& theAxis,
220                                       const ModelHighAPI_Double& theToAngle,
221                                       const ModelHighAPI_Double& theFromAngle,
222                                       const std::list<ModelHighAPI_Selection>& theBooleanObjects);
223
224   /// Constructor with values.
225   FEATURESAPI_EXPORT
226   explicit FeaturesAPI_RevolutionFuse(const std::shared_ptr<ModelAPI_Feature>& theFeature,
227                                       const std::list<ModelHighAPI_Selection>& theBaseObjects,
228                                       const ModelHighAPI_Selection& theAxis,
229                                       const ModelHighAPI_Selection& theToObject,
230                                       const ModelHighAPI_Double& theToOffset,
231                                       const ModelHighAPI_Selection& theFromObject,
232                                       const ModelHighAPI_Double& theFromOffset,
233                                       const std::list<ModelHighAPI_Selection>& theBooleanObjects);
234 };
235
236 /// Pointer on RevolutionFuse object.
237 typedef std::shared_ptr<FeaturesAPI_RevolutionFuse> RevolutionFusePtr;
238
239 /// \ingroup CPPHighAPI
240 /// \brief Create RevolutionFuse feature.
241 FEATURESAPI_EXPORT
242 RevolutionFusePtr addRevolutionFuse(const std::shared_ptr<ModelAPI_Document>& thePart,
243                                     const std::list<ModelHighAPI_Selection>& theBaseObjects,
244                                     const ModelHighAPI_Selection& theAxis,
245                                     const ModelHighAPI_Double& theAngle,
246                                     const std::list<ModelHighAPI_Selection>& theBooleanObjects);
247
248 /// \ingroup CPPHighAPI
249 /// \brief Create RevolutionFuse feature.
250 FEATURESAPI_EXPORT
251 RevolutionFusePtr addRevolutionFuse(const std::shared_ptr<ModelAPI_Document>& thePart,
252                                     const std::list<ModelHighAPI_Selection>& theBaseObjects,
253                                     const ModelHighAPI_Selection& theAxis,
254                                     const ModelHighAPI_Double& theToAngle,
255                                     const ModelHighAPI_Double& theFromAngle,
256                                     const std::list<ModelHighAPI_Selection>& theBooleanObjects);
257
258 /// \ingroup CPPHighAPI
259 /// \brief Create RevolutionFuse feature.
260 FEATURESAPI_EXPORT
261 RevolutionFusePtr addRevolutionFuse(const std::shared_ptr<ModelAPI_Document>& thePart,
262                                     const std::list<ModelHighAPI_Selection>& theBaseObjects,
263                                     const ModelHighAPI_Selection& theAxis,
264                                     const ModelHighAPI_Selection& theToObject,
265                                     const ModelHighAPI_Double& theToOffset,
266                                     const ModelHighAPI_Selection& theFromObject,
267                                     const ModelHighAPI_Double& theFromOffset,
268                                     const std::list<ModelHighAPI_Selection>& theBooleanObjects);
269
270 #endif // FeaturesAPI_RevolutionBoolean_H_