Salome HOME
Issue #1660: Ability to change the deflection coefficient
[modules/shaper.git] / src / FeaturesPlugin / FeaturesPlugin_CompositeBoolean.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 // File:        FeaturesPlugin_CompositeBoolean.h
4 // Created:     11 June 2015
5 // Author:      Dmitry Bobylev
6
7 #ifndef FeaturesPlugin_CompositeBoolean_H_
8 #define FeaturesPlugin_CompositeBoolean_H_
9
10 #include "FeaturesPlugin.h"
11
12 #include <ModelAPI_Feature.h>
13 #include <ModelAPI_ResultBody.h>
14 #include <GeomAlgoAPI_MakeShape.h>
15
16 /// \class FeaturesPlugin_CompositeBoolean
17 /// \ingroup Plugins
18 /// \brief Interface for the composite boolean feature.
19 class FeaturesPlugin_CompositeBoolean
20 {
21 public:
22   enum OperationType {
23     BOOL_CUT,
24     BOOL_FUSE,
25     BOOL_COMMON,
26     BOOL_SMASH
27   };
28
29   /// Attribute name of main objects.
30   inline static const std::string& OBJECTS_ID()
31   {
32     static const std::string MY_OBJECTS_ID("main_objects");
33     return MY_OBJECTS_ID;
34   }
35
36   /// Creates a new part document if needed.
37   FEATURESPLUGIN_EXPORT virtual void executeCompositeBoolean();
38
39 protected:
40   FeaturesPlugin_CompositeBoolean(){};
41
42   /// Initializes boolean attributes.
43   void initBooleanAttributes();
44
45   /// This function need to be defined for extrusion/revolution generation.
46   virtual bool makeGeneration(ListOfShape& theBaseShapes,
47                               ListOfMakeShape& theMakeShapes) = 0;
48
49   /// Makes boolean operation.
50   /// \param[in] theTools list of tools.
51   /// \param[out] theObjects list of objects.
52   /// \param[out] theMakeShapes list of according algos.
53   /// \return false in failed.
54   bool makeBoolean(const ListOfShape& theTools,
55                    ListOfShape& theObjects,
56                    ListOfMakeShape& theMakeShapes);
57
58   /// Stores generation history.
59   virtual void storeGenerationHistory(ResultBodyPtr theResultBody,
60                                       const GeomShapePtr theBaseShape,
61                                       const std::shared_ptr<GeomAlgoAPI_MakeShape> theMakeShape,
62                                       int& theTag) = 0;
63
64   /// Stores modification history.
65   void storeModificationHistory(ResultBodyPtr theResultBody,
66                                 const GeomShapePtr theObject,
67                                 const ListOfShape& theTools,
68                                 const std::shared_ptr<GeomAlgoAPI_MakeShape> theMakeShape,
69                                 int& theTag);
70
71 protected:
72   ModelAPI_Feature* myFeature;
73   OperationType myOperationType;
74 };
75
76 #endif