Salome HOME
8.3. Intersection feature
[modules/shaper.git] / src / FeaturesPlugin / FeaturesPlugin_Intersection.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
2
3 // File:        FeaturesPlugin_Intersection.h
4 // Created:     15 Feb 2016
5 // Author:      Dmitry Bobylev
6
7 #ifndef FeaturesPlugin_Intersection_H_
8 #define FeaturesPlugin_Intersection_H_
9
10 #include "FeaturesPlugin.h"
11
12 #include <ModelAPI_Feature.h>
13
14 #include <GeomAPI_Shape.h>
15
16 class GeomAlgoAPI_MakeShape;
17
18 /// \class FeaturesPlugin_Intersection
19 /// \ingroup Plugins
20 /// \brief Intersection feature takes a list of shapes as objects and list of shapes as tools.
21 /// The types of objects and tools may be different: whole objects, compsoilds, solids, shells, faces or edges.
22 /// The result is less than the minimal dimension from pair of intersection:
23 /// for two solids or two faces it is wire, for the edge and face it is vertex, etc.
24 class FeaturesPlugin_Intersection : public ModelAPI_Feature
25 {
26 public:
27   /// Feature kind.
28   inline static const std::string& ID()
29   {
30     static const std::string MY_ID("Intersection");
31     return MY_ID;
32   }
33
34   /// Attribute name of objects.
35   inline static const std::string& OBJECT_LIST_ID()
36   {
37     static const std::string MY_OBJECT_LIST_ID("main_objects");
38     return MY_OBJECT_LIST_ID;
39   }
40
41   /// Attribute name of tools.
42   inline static const std::string& TOOL_LIST_ID()
43   {
44     static const std::string MY_TOOL_LIST_ID("tool_objects");
45     return MY_TOOL_LIST_ID;
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_Intersection::ID();
52     return MY_KIND;
53   }
54
55   /// Executes feature.
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_Intersection();
63
64 private:
65   /// Load Naming data structure of the feature to the document.
66   void loadNamingDS(std::shared_ptr<ModelAPI_ResultBody> theResultBody,
67                     const std::shared_ptr<GeomAPI_Shape> theBaseShape,
68                     const ListOfShape& theTools,
69                     GeomAlgoAPI_MakeShape& theMakeShape);
70 };
71
72 #endif