Salome HOME
Issue #2038: Incorrect naming after translation
[modules/shaper.git] / src / FeaturesPlugin / FeaturesPlugin_Boolean.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
2
3 // File:        FeaturesPlugin_Boolean.h
4 // Created:     02 Sept 2014
5 // Author:      Vitaly SMETANNIKOV
6
7 #ifndef FeaturesPlugin_Cut_H_
8 #define FeaturesPlugin_Cut_H_
9
10 #include "FeaturesPlugin.h"
11
12 #include <GeomAlgoAPI_MakeShape.h>
13
14 #include <ModelAPI_Feature.h>
15
16 /// \class FeaturesPlugin_Boolean
17 /// \ingroup Plugins
18 /// \brief Feature for applying of Boolean operations on Solids.
19 /// Supports four kinds of Boolean operations: Cut, Fuse, Common and Smash.
20 class FeaturesPlugin_Boolean : public ModelAPI_Feature
21 {
22 public:
23   enum OperationType {
24     BOOL_CUT,
25     BOOL_FUSE,
26     BOOL_COMMON,
27     BOOL_FILL,
28     BOOL_SMASH
29   };
30
31   /// Feature kind.
32   inline static const std::string& ID()
33   {
34     static const std::string MY_ID("Boolean");
35     return MY_ID;
36   }
37
38   /// Attribute name of main objects.
39   inline static const std::string& OBJECT_LIST_ID()
40   {
41     static const std::string MY_OBJECT_LIST_ID("main_objects");
42     return MY_OBJECT_LIST_ID;
43   }
44
45   /// Attribute name of tool objects.
46   inline static const std::string& TOOL_LIST_ID()
47   {
48     static const std::string MY_TOOL_LIST_ID("tool_objects");
49     return MY_TOOL_LIST_ID;
50   }
51
52   /// Attribute name of operation type.
53   inline static const std::string& TYPE_ID()
54   {
55     static const std::string MY_TYPE_ID("bool_type");
56     return MY_TYPE_ID;
57   }
58
59   /// \return the kind of a feature.
60   FEATURESPLUGIN_EXPORT virtual const std::string& getKind()
61   {
62     static std::string MY_KIND = FeaturesPlugin_Boolean::ID();
63     return MY_KIND;
64   }
65
66   /// Creates a new part document if needed.
67   FEATURESPLUGIN_EXPORT virtual void execute();
68
69   /// Request for initialization of data model of the feature: adding all attributes.
70   FEATURESPLUGIN_EXPORT virtual void initAttributes();
71
72   /// Use plugin manager for features creation.
73   FeaturesPlugin_Boolean();
74
75 private:
76   std::shared_ptr<GeomAPI_Shape> getShape(const std::string& theAttrName);
77
78   /// Load Naming data structure of the feature to the document
79   void loadNamingDS(std::shared_ptr<ModelAPI_ResultBody> theResultBody,
80                     const std::shared_ptr<GeomAPI_Shape> theBaseShape,
81                     const ListOfShape& theTools,
82                     const std::shared_ptr<GeomAPI_Shape> theResultShape,
83                     GeomAlgoAPI_MakeShape& theMakeShape,
84                     GeomAPI_DataMapOfShapeShape& theMapOfShapes);
85 };
86
87 #endif