Salome HOME
Remove unnecessary variable
[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_CompositeFeature.h>
13
14 #include <GeomAlgoAPI_Boolean.h>
15
16 /** \class FeaturesPlugin_CompositeBoolean
17  *  \ingroup Plugins
18  *  \brief Interface for the composite boolean feature.
19  */
20 class FeaturesPlugin_CompositeBoolean : public ModelAPI_CompositeFeature
21 {
22  public:
23   /// Attribute name of sketch feature.
24   inline static const std::string& SKETCH_OBJECT_ID()
25   {
26     static const std::string MY_SKETCH_OBJECT_ID("sketch");
27     return MY_SKETCH_OBJECT_ID;
28   }
29
30   /// Attribute name of sketch feature.
31   inline static const std::string& SKETCH_SELECTION_ID()
32   {
33     static const std::string MY_SKETCH_SELECTION_ID("sketch_selection");
34     return MY_SKETCH_SELECTION_ID;
35   }
36
37   /// Attribute name of objects for boolean operation.
38   inline static const std::string& BOOLEAN_OBJECTS_ID()
39   {
40     static const std::string MY_BOOLEAN_OBJECTS_ID("boolean_objects");
41     return MY_BOOLEAN_OBJECTS_ID;
42   }
43
44   /// Creates a new part document if needed.
45   FEATURESPLUGIN_EXPORT virtual void execute();
46
47   /// Request for initialization of data model of the feature: adding all attributes.
48   FEATURESPLUGIN_EXPORT virtual void initAttributes();
49
50   /// Appends a feature to the sketch sub-elements container.
51   FEATURESPLUGIN_EXPORT virtual std::shared_ptr<ModelAPI_Feature> addFeature(std::string theID);
52
53   /// \return the number of sub-elements.
54   FEATURESPLUGIN_EXPORT virtual int numberOfSubs(bool forTree = false) const;
55
56   /// \return the sub-feature by zero-base index.
57   FEATURESPLUGIN_EXPORT virtual std::shared_ptr<ModelAPI_Feature> subFeature(const int theIndex, bool forTree = false);
58
59   /// \return the sub-feature unique identifier in this composite feature by zero-base index.
60   FEATURESPLUGIN_EXPORT virtual int subFeatureId(const int theIndex) const;
61
62   /// \return true if feature or reuslt belong to this composite feature as subs.
63   FEATURESPLUGIN_EXPORT virtual bool isSub(ObjectPtr theObject) const;
64
65   /// This method to inform that sub-feature is removed and must be removed from the internal data
66   /// structures of the owner (the remove from the document will be done outside just after)
67   FEATURESPLUGIN_EXPORT virtual void removeFeature(std::shared_ptr<ModelAPI_Feature> theFeature);
68
69   /// removes also all sub-sketch
70   FEATURESPLUGIN_EXPORT virtual void erase();
71
72 protected:
73   FeaturesPlugin_CompositeBoolean(){};
74
75   /// Define this function to init attributes for extrusion/revolution.
76   virtual void initMakeSolidsAttributes() = 0;
77
78   /// Define this function to create solids from faces with extrusion/revolution.
79   virtual void makeSolids(const ListOfShape& theFaces,
80                           ListOfShape& theResults,
81                           std::list<std::shared_ptr<GeomAPI_Interface>>& theAlgos) = 0;
82
83   /// Results naming.
84   void loadNamingDS(std::shared_ptr<ModelAPI_ResultBody> theResultBody,
85                     const std::shared_ptr<GeomAPI_Shape>& theBaseShape,
86                     const ListOfShape& theShells,
87                     const std::list<std::shared_ptr<GeomAPI_Interface>>& theAlgos,
88                     const ListOfShape& theTools,
89                     const GeomAlgoAPI_Boolean& theAlgo);
90
91 protected:
92   /// Type of boolean operation.
93   GeomAlgoAPI_Boolean::OperationType myBooleanOperationType;
94 };
95
96 #endif