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