Salome HOME
Add copyright header according to request of CEA from 06.06.2017
[modules/shaper.git] / src / FeaturesAPI / FeaturesAPI_ExtrusionBoolean.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 FeaturesAPI_ExtrusionBoolean_H_
22 #define FeaturesAPI_ExtrusionBoolean_H_
23
24 #include "FeaturesAPI.h"
25
26 #include <FeaturesPlugin_ExtrusionCut.h>
27 #include <FeaturesPlugin_ExtrusionFuse.h>
28
29 #include <ModelHighAPI_Interface.h>
30 #include <ModelHighAPI_Macro.h>
31
32 class ModelHighAPI_Double;
33 class ModelHighAPI_Reference;
34 class ModelHighAPI_Selection;
35
36 /// \class FeaturesAPI_ExtrusionBoolean
37 /// \ingroup CPPHighAPI
38 /// \brief Interface for ExtrusionBoolean feature.
39 class FeaturesAPI_ExtrusionBoolean: public ModelHighAPI_Interface
40 {
41 public:
42   /// Destructor.
43   FEATURESAPI_EXPORT
44   virtual ~FeaturesAPI_ExtrusionBoolean();
45
46   INTERFACE_11("",
47                sketch, FeaturesPlugin_Extrusion::SKETCH_ID(),
48                ModelAPI_AttributeReference, /** Sketch launcher */,
49                baseObjects, FeaturesPlugin_Extrusion::BASE_OBJECTS_ID(),
50                ModelAPI_AttributeSelectionList, /** Base objects */,
51                direction, FeaturesPlugin_Extrusion::DIRECTION_OBJECT_ID(),
52                ModelAPI_AttributeSelection, /** Direction */,
53                creationMethod, FeaturesPlugin_Extrusion::CREATION_METHOD(),
54                ModelAPI_AttributeString, /** Creation method */,
55                toSize, FeaturesPlugin_Extrusion::TO_SIZE_ID(),
56                ModelAPI_AttributeDouble, /** To size */,
57                fromSize, FeaturesPlugin_Extrusion::FROM_SIZE_ID(),
58                ModelAPI_AttributeDouble, /** From size */,
59                toObject, FeaturesPlugin_Extrusion::TO_OBJECT_ID(),
60                ModelAPI_AttributeSelection, /** To object */,
61                toOffset, FeaturesPlugin_Extrusion::TO_OFFSET_ID(),
62                ModelAPI_AttributeDouble, /** To offset */,
63                fromObject, FeaturesPlugin_Extrusion::FROM_OBJECT_ID(),
64                ModelAPI_AttributeSelection, /** From object */,
65                fromOffset, FeaturesPlugin_Extrusion::FROM_OFFSET_ID(),
66                ModelAPI_AttributeDouble, /** From offset */,
67                booleanObjects, FeaturesPlugin_CompositeBoolean::OBJECTS_ID(),
68                ModelAPI_AttributeSelectionList, /** Boolean objects */)
69
70   /// Modify base attribute of the feature.
71   FEATURESAPI_EXPORT
72   void setNestedSketch(const ModelHighAPI_Reference& theSketch);
73
74   /// Modify base attribute of the feature.
75   FEATURESAPI_EXPORT
76   void setBase(const std::list<ModelHighAPI_Selection>& theBaseObjects);
77
78   /// Modify direction_object attribute of the feature.
79   FEATURESAPI_EXPORT
80   void setDirection(const ModelHighAPI_Selection& theDirection);
81
82   /// Modify CreationMethod, to_size, from_size attributes of the feature.
83   FEATURESAPI_EXPORT
84   void setSizes(const ModelHighAPI_Double& theToSize, const ModelHighAPI_Double& theFromSize);
85
86   /// Modify creation_method, to_size, from_size attributes of the feature.
87   FEATURESAPI_EXPORT
88   void setSize(const ModelHighAPI_Double& theSize);
89
90   /// Modify creation_method, to_object, to_offset, from_object,
91   /// from_offset attributes of the feature.
92   FEATURESAPI_EXPORT
93   void setPlanesAndOffsets(const ModelHighAPI_Selection& theToObject,
94                            const ModelHighAPI_Double& theToOffset,
95                            const ModelHighAPI_Selection& theFromObject,
96                            const ModelHighAPI_Double& theFromOffset);
97
98   /// Modiyfy main_objects attribute of the feature.
99   FEATURESAPI_EXPORT
100   void setBooleanObjects(const std::list<ModelHighAPI_Selection>& theBooleanObjects);
101
102   /// Dump wrapped feature
103   FEATURESAPI_EXPORT
104   virtual void dump(ModelHighAPI_Dumper& theDumper) const;
105
106 protected:
107   /// Constructor without values.
108   FEATURESAPI_EXPORT
109   explicit FeaturesAPI_ExtrusionBoolean(const std::shared_ptr<ModelAPI_Feature>& theFeature);
110
111 private:
112   void execIfBaseNotEmpty();
113 };
114
115 /// \class FeaturesAPI_ExtrusionCut
116 /// \ingroup CPPHighAPI
117 /// \brief Interface for ExtrusionCut feature.
118 class FeaturesAPI_ExtrusionCut: public FeaturesAPI_ExtrusionBoolean
119 {
120 public:
121
122   static std::string ID() { return FeaturesPlugin_ExtrusionCut::ID(); }
123   virtual std::string getID() { return ID(); }
124
125   //FEATURESAPI_EXPORT
126   //virtual std::string getID() {
127   //  return FeaturesPlugin_ExtrusionCut::ID();
128   //}
129
130   /// Constructor without values.
131   FEATURESAPI_EXPORT
132   explicit FeaturesAPI_ExtrusionCut(const std::shared_ptr<ModelAPI_Feature>& theFeature);
133
134   /// Constructor with values.
135   FEATURESAPI_EXPORT
136   explicit FeaturesAPI_ExtrusionCut(const std::shared_ptr<ModelAPI_Feature>& theFeature,
137                                     const std::list<ModelHighAPI_Selection>& theBaseObjects,
138                                     const ModelHighAPI_Double& theSize,
139                                     const std::list<ModelHighAPI_Selection>& theBooleanObjects);
140
141   /// Constructor with values.
142   FEATURESAPI_EXPORT
143   explicit FeaturesAPI_ExtrusionCut(const std::shared_ptr<ModelAPI_Feature>& theFeature,
144                                     const std::list<ModelHighAPI_Selection>& theBaseObjects,
145                                     const ModelHighAPI_Selection& theDirection,
146                                     const ModelHighAPI_Double& theSize,
147                                     const std::list<ModelHighAPI_Selection>& theBooleanObjects);
148
149   /// Constructor with values.
150   FEATURESAPI_EXPORT
151   explicit FeaturesAPI_ExtrusionCut(const std::shared_ptr<ModelAPI_Feature>& theFeature,
152                                     const std::list<ModelHighAPI_Selection>& theBaseObjects,
153                                     const ModelHighAPI_Double& theToSize,
154                                     const ModelHighAPI_Double& theFromSize,
155                                     const std::list<ModelHighAPI_Selection>& theBooleanObjects);
156
157   /// Constructor with values.
158   FEATURESAPI_EXPORT
159   explicit FeaturesAPI_ExtrusionCut(const std::shared_ptr<ModelAPI_Feature>& theFeature,
160                                     const std::list<ModelHighAPI_Selection>& theBaseObjects,
161                                     const ModelHighAPI_Selection& theDirection,
162                                     const ModelHighAPI_Double& theToSize,
163                                     const ModelHighAPI_Double& theFromSize,
164                                     const std::list<ModelHighAPI_Selection>& theBooleanObjects);
165
166   /// Constructor with values.
167   FEATURESAPI_EXPORT
168   explicit FeaturesAPI_ExtrusionCut(const std::shared_ptr<ModelAPI_Feature>& theFeature,
169                                     const std::list<ModelHighAPI_Selection>& theBaseObjects,
170                                     const ModelHighAPI_Selection& theToObject,
171                                     const ModelHighAPI_Double& theToOffset,
172                                     const ModelHighAPI_Selection& theFromObject,
173                                     const ModelHighAPI_Double& theFromOffset,
174                                     const std::list<ModelHighAPI_Selection>& theBooleanObjects);
175
176   /// Constructor with values.
177   FEATURESAPI_EXPORT
178   explicit FeaturesAPI_ExtrusionCut(const std::shared_ptr<ModelAPI_Feature>& theFeature,
179                                     const std::list<ModelHighAPI_Selection>& theBaseObjects,
180                                     const ModelHighAPI_Selection& theDirection,
181                                     const ModelHighAPI_Selection& theToObject,
182                                     const ModelHighAPI_Double& theToOffset,
183                                     const ModelHighAPI_Selection& theFromObject,
184                                     const ModelHighAPI_Double& theFromOffset,
185                                     const std::list<ModelHighAPI_Selection>& theBooleanObjects);
186 };
187
188 /// Pointer on ExtrusionCut object.
189 typedef std::shared_ptr<FeaturesAPI_ExtrusionCut> ExtrusionCutPtr;
190
191 /// \ingroup CPPHighAPI
192 /// \brief Create ExtrusionCut feature.
193 FEATURESAPI_EXPORT
194 ExtrusionCutPtr addExtrusionCut(const std::shared_ptr<ModelAPI_Document>& thePart,
195                                 const std::list<ModelHighAPI_Selection>& theBaseObjects,
196                                 const ModelHighAPI_Double& theSize,
197                                 const std::list<ModelHighAPI_Selection>& theBooleanObjects);
198
199 /// \ingroup CPPHighAPI
200 /// \brief Create ExtrusionCut feature.
201 FEATURESAPI_EXPORT
202 ExtrusionCutPtr addExtrusionCut(const std::shared_ptr<ModelAPI_Document>& thePart,
203                                 const std::list<ModelHighAPI_Selection>& theBaseObjects,
204                                 const ModelHighAPI_Selection& theDirection,
205                                 const ModelHighAPI_Double& theSize,
206                                 const std::list<ModelHighAPI_Selection>& theBooleanObjects);
207
208 /// \ingroup CPPHighAPI
209 /// \brief Create ExtrusionCut feature.
210 FEATURESAPI_EXPORT
211 ExtrusionCutPtr addExtrusionCut(const std::shared_ptr<ModelAPI_Document>& thePart,
212                                 const std::list<ModelHighAPI_Selection>& theBaseObjects,
213                                 const ModelHighAPI_Double& theToSize,
214                                 const ModelHighAPI_Double& theFromSize,
215                                 const std::list<ModelHighAPI_Selection>& theBooleanObjects);
216
217 /// \ingroup CPPHighAPI
218 /// \brief Create ExtrusionCut feature.
219 FEATURESAPI_EXPORT
220 ExtrusionCutPtr addExtrusionCut(const std::shared_ptr<ModelAPI_Document>& thePart,
221                                 const std::list<ModelHighAPI_Selection>& theBaseObjects,
222                                 const ModelHighAPI_Selection& theDirection,
223                                 const ModelHighAPI_Double& theToSize,
224                                 const ModelHighAPI_Double& theFromSize,
225                                 const std::list<ModelHighAPI_Selection>& theBooleanObjects);
226
227 /// \ingroup CPPHighAPI
228 /// \brief Create ExtrusionCut feature.
229 FEATURESAPI_EXPORT
230 ExtrusionCutPtr addExtrusionCut(const std::shared_ptr<ModelAPI_Document>& thePart,
231                                 const std::list<ModelHighAPI_Selection>& theBaseObjects,
232                                 const ModelHighAPI_Selection& theToObject,
233                                 const ModelHighAPI_Double& theToOffset,
234                                 const ModelHighAPI_Selection& theFromObject,
235                                 const ModelHighAPI_Double& theFromOffset,
236                                 const std::list<ModelHighAPI_Selection>& theBooleanObjects);
237
238 /// \ingroup CPPHighAPI
239 /// \brief Create ExtrusionCut feature.
240 FEATURESAPI_EXPORT
241 ExtrusionCutPtr addExtrusionCut(const std::shared_ptr<ModelAPI_Document>& thePart,
242                                 const std::list<ModelHighAPI_Selection>& theBaseObjects,
243                                 const ModelHighAPI_Selection& theDirection,
244                                 const ModelHighAPI_Selection& theToObject,
245                                 const ModelHighAPI_Double& theToOffset,
246                                 const ModelHighAPI_Selection& theFromObject,
247                                 const ModelHighAPI_Double& theFromOffset,
248                                 const std::list<ModelHighAPI_Selection>& theBooleanObjects);
249
250 /// \class FeaturesAPI_ExtrusionFuse
251 /// \ingroup CPPHighAPI
252 /// \brief Interface for ExtrusionFuse feature.
253 class FeaturesAPI_ExtrusionFuse: public FeaturesAPI_ExtrusionBoolean
254 {
255 public:
256   static std::string ID() { return FeaturesPlugin_ExtrusionFuse::ID(); }
257   virtual std::string getID() { return ID(); }
258
259   /// Constructor without values.
260   FEATURESAPI_EXPORT
261   explicit FeaturesAPI_ExtrusionFuse(const std::shared_ptr<ModelAPI_Feature>& theFeature);
262
263   /// Constructor with values.
264   FEATURESAPI_EXPORT
265   explicit FeaturesAPI_ExtrusionFuse(const std::shared_ptr<ModelAPI_Feature>& theFeature,
266                                      const std::list<ModelHighAPI_Selection>& theBaseObjects,
267                                      const ModelHighAPI_Double& theSize,
268                                      const std::list<ModelHighAPI_Selection>& theBooleanObjects);
269
270   /// Constructor with values.
271   FEATURESAPI_EXPORT
272   explicit FeaturesAPI_ExtrusionFuse(const std::shared_ptr<ModelAPI_Feature>& theFeature,
273                                      const std::list<ModelHighAPI_Selection>& theBaseObjects,
274                                      const ModelHighAPI_Selection& theDirection,
275                                      const ModelHighAPI_Double& theSize,
276                                      const std::list<ModelHighAPI_Selection>& theBooleanObjects);
277
278   /// Constructor with values.
279   FEATURESAPI_EXPORT
280   explicit FeaturesAPI_ExtrusionFuse(const std::shared_ptr<ModelAPI_Feature>& theFeature,
281                                      const std::list<ModelHighAPI_Selection>& theBaseObjects,
282                                      const ModelHighAPI_Double& theToSize,
283                                      const ModelHighAPI_Double& theFromSize,
284                                      const std::list<ModelHighAPI_Selection>& theBooleanObjects);
285
286   /// Constructor with values.
287   FEATURESAPI_EXPORT
288   explicit FeaturesAPI_ExtrusionFuse(const std::shared_ptr<ModelAPI_Feature>& theFeature,
289                                      const std::list<ModelHighAPI_Selection>& theBaseObjects,
290                                      const ModelHighAPI_Selection& theDirection,
291                                      const ModelHighAPI_Double& theToSize,
292                                      const ModelHighAPI_Double& theFromSize,
293                                      const std::list<ModelHighAPI_Selection>& theBooleanObjects);
294
295   /// Constructor with values.
296   FEATURESAPI_EXPORT
297   explicit FeaturesAPI_ExtrusionFuse(const std::shared_ptr<ModelAPI_Feature>& theFeature,
298                                      const std::list<ModelHighAPI_Selection>& theBaseObjects,
299                                      const ModelHighAPI_Selection& theToObject,
300                                      const ModelHighAPI_Double& theToOffset,
301                                      const ModelHighAPI_Selection& theFromObject,
302                                      const ModelHighAPI_Double& theFromOffset,
303                                      const std::list<ModelHighAPI_Selection>& theBooleanObjects);
304
305   /// Constructor with values.
306   FEATURESAPI_EXPORT
307   explicit FeaturesAPI_ExtrusionFuse(const std::shared_ptr<ModelAPI_Feature>& theFeature,
308                                      const std::list<ModelHighAPI_Selection>& theBaseObjects,
309                                      const ModelHighAPI_Selection& theDirection,
310                                      const ModelHighAPI_Selection& theToObject,
311                                      const ModelHighAPI_Double& theToOffset,
312                                      const ModelHighAPI_Selection& theFromObject,
313                                      const ModelHighAPI_Double& theFromOffset,
314                                      const std::list<ModelHighAPI_Selection>& theBooleanObjects);
315 };
316
317 /// Pointer on ExtrusionFuse object.
318 typedef std::shared_ptr<FeaturesAPI_ExtrusionFuse> ExtrusionFusePtr;
319
320 /// \ingroup CPPHighAPI
321 /// \brief Create ExtrusionFuse feature.
322 FEATURESAPI_EXPORT
323 ExtrusionFusePtr addExtrusionFuse(const std::shared_ptr<ModelAPI_Document>& thePart,
324                                   const std::list<ModelHighAPI_Selection>& theBaseObjects,
325                                   const ModelHighAPI_Double& theSize,
326                                   const std::list<ModelHighAPI_Selection>& theBooleanObjects);
327
328 /// \ingroup CPPHighAPI
329 /// \brief Create ExtrusionFuse feature.
330 FEATURESAPI_EXPORT
331 ExtrusionFusePtr addExtrusionFuse(const std::shared_ptr<ModelAPI_Document>& thePart,
332                                   const std::list<ModelHighAPI_Selection>& theBaseObjects,
333                                   const ModelHighAPI_Selection& theDirection,
334                                   const ModelHighAPI_Double& theSize,
335                                   const std::list<ModelHighAPI_Selection>& theBooleanObjects);
336
337 /// \ingroup CPPHighAPI
338 /// \brief Create ExtrusionFuse feature.
339 FEATURESAPI_EXPORT
340 ExtrusionFusePtr addExtrusionFuse(const std::shared_ptr<ModelAPI_Document>& thePart,
341                                   const std::list<ModelHighAPI_Selection>& theBaseObjects,
342                                   const ModelHighAPI_Double& theToSize,
343                                   const ModelHighAPI_Double& theFromSize,
344                                   const std::list<ModelHighAPI_Selection>& theBooleanObjects);
345
346 /// \ingroup CPPHighAPI
347 /// \brief Create ExtrusionFuse feature.
348 FEATURESAPI_EXPORT
349 ExtrusionFusePtr addExtrusionFuse(const std::shared_ptr<ModelAPI_Document>& thePart,
350                                   const std::list<ModelHighAPI_Selection>& theBaseObjects,
351                                   const ModelHighAPI_Selection& theDirection,
352                                   const ModelHighAPI_Double& theToSize,
353                                   const ModelHighAPI_Double& theFromSize,
354                                   const std::list<ModelHighAPI_Selection>& theBooleanObjects);
355
356 /// \ingroup CPPHighAPI
357 /// \brief Create ExtrusionFuse feature.
358 FEATURESAPI_EXPORT
359 ExtrusionFusePtr addExtrusionFuse(const std::shared_ptr<ModelAPI_Document>& thePart,
360                                   const std::list<ModelHighAPI_Selection>& theBaseObjects,
361                                   const ModelHighAPI_Selection& theToObject,
362                                   const ModelHighAPI_Double& theToOffset,
363                                   const ModelHighAPI_Selection& theFromObject,
364                                   const ModelHighAPI_Double& theFromOffset,
365                                   const std::list<ModelHighAPI_Selection>& theBooleanObjects);
366
367 /// \ingroup CPPHighAPI
368 /// \brief Create ExtrusionFuse feature.
369 FEATURESAPI_EXPORT
370 ExtrusionFusePtr addExtrusionFuse(const std::shared_ptr<ModelAPI_Document>& thePart,
371                                   const std::list<ModelHighAPI_Selection>& theBaseObjects,
372                                   const ModelHighAPI_Selection& theDirection,
373                                   const ModelHighAPI_Selection& theToObject,
374                                   const ModelHighAPI_Double& theToOffset,
375                                   const ModelHighAPI_Selection& theFromObject,
376                                   const ModelHighAPI_Double& theFromOffset,
377                                   const std::list<ModelHighAPI_Selection>& theBooleanObjects);
378
379 #endif // FeaturesAPI_ExtrusionBoolean_H_