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