Salome HOME
824dcd0dbb5dd787032974c50c93f6c0b95dde69
[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 #include <ModelAPI_Feature.h>
12 #include <GeomAPI_Shape.h>
13 #include <GeomAlgoAPI_Boolean.h>
14
15 class FeaturesPlugin_Boolean : public ModelAPI_Feature
16 {
17  public:
18   /// Extrusion kind
19   inline static const std::string& ID()
20   {
21     static const std::string MY_ID("Boolean");
22     return MY_ID;
23   }
24   /// attribute name of referenced object
25   inline static const std::string& OBJECT_ID()
26   {
27     static const std::string MY_OBJECT_ID("main_object");
28     return MY_OBJECT_ID;
29   }
30   /// attribute name of tool object
31   inline static const std::string& TOOL_ID()
32   {
33     static const std::string MY_TOOL_ID("tool_object");
34     return MY_TOOL_ID;
35   }
36   /// attribute name of operation type
37   inline static const std::string& TYPE_ID()
38   {
39     static const std::string MY_TYPE_ID("bool_type");
40     return MY_TYPE_ID;
41   }
42
43   enum {
44         BOOL_CUT,
45         BOOL_FUSE,
46     BOOL_COMMON
47   };
48
49
50   /// Returns the kind of a feature
51   FEATURESPLUGIN_EXPORT virtual const std::string& getKind()
52   {
53     static std::string MY_KIND = FeaturesPlugin_Boolean::ID();
54     return MY_KIND;
55   }
56
57   /// Creates a new part document if needed
58   FEATURESPLUGIN_EXPORT virtual void execute();
59
60   /// Request for initialization of data model of the feature: adding all attributes
61   FEATURESPLUGIN_EXPORT virtual void initAttributes();
62
63   /// Use plugin manager for features creation
64   FeaturesPlugin_Boolean();
65
66 private:
67   std::shared_ptr<GeomAPI_Shape> getShape(const std::string& theAttrName);
68   
69   /// Load Naming data structure of the feature to the document
70   void LoadNamingDS(GeomAlgoAPI_Boolean* theFeature, 
71                                         std::shared_ptr<ModelAPI_ResultBody> theResultBody,
72                         std::shared_ptr<GeomAPI_Shape> theObject,
73                         std::shared_ptr<GeomAPI_Shape> theTool,
74                                         int theType);
75 };
76
77 #endif