Salome HOME
Naming for extrusion cut.
[modules/shaper.git] / src / FeaturesPlugin / FeaturesPlugin_ExtrusionCut.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 // File:        FeaturesPlugin_ExtrusionCut.h
4 // Created:     12 May 2015
5 // Author:      Dmitry Bobylev
6
7 #ifndef FeaturesPlugin_ExtrusionCut_H_
8 #define FeaturesPlugin_ExtrusionCut_H_
9
10 #include <FeaturesPlugin.h>
11
12 #include <ModelAPI_CompositeFeature.h>
13
14 #include <GeomAlgoAPI_Boolean.h>
15
16 /** \class FeaturesPlugin_ExtrusionCut
17  *  \ingroup Plugins
18  */
19 class FeaturesPlugin_ExtrusionCut : public ModelAPI_CompositeFeature
20 {
21  public:
22   /// Revolution kind.
23   inline static const std::string& ID()
24   {
25     static const std::string MY_REVOLUTION_ID("ExtrusionCut");
26     return MY_REVOLUTION_ID;
27   }
28
29   /// attribute name of references sketch entities list, it should contain a sketch result or
30   /// a pair a sketch result to sketch face
31   inline static const std::string& CUTLIST_ID()
32   {
33     static const std::string MY_CUT_LIST_ID("cut_objects");
34     return MY_CUT_LIST_ID;
35   }
36
37   /// attribute name of an object to which the extrusion grows
38   inline static const std::string& SKETCH_OBJECT_ID()
39   {
40     static const std::string MY_TO_OBJECT_ID("sketch");
41     return MY_TO_OBJECT_ID;
42   }
43
44   /// attribute name of extrusion size
45   inline static const std::string& TO_SIZE_ID()
46   {
47     static const std::string MY_TO_SIZE_ID("to_size");
48     return MY_TO_SIZE_ID;
49   }
50
51   /// attribute name of an object to which the extrusion grows
52   inline static const std::string& TO_OBJECT_ID()
53   {
54     static const std::string MY_TO_OBJECT_ID("to_object");
55     return MY_TO_OBJECT_ID;
56   }
57
58   /// attribute name of tool object
59   inline static const std::string& FROM_OBJECT_ID()
60   {
61     static const std::string MY_FROM_OBJECT_ID("from_object");
62     return MY_FROM_OBJECT_ID;
63   }
64
65   /// attribute name of extrusion size
66   inline static const std::string& FROM_SIZE_ID()
67   {
68     static const std::string MY_FROM_SIZE_ID("from_size");
69     return MY_FROM_SIZE_ID;
70   }
71
72   /// Returns the kind of a feature
73   FEATURESPLUGIN_EXPORT virtual const std::string& getKind()
74   {
75     static std::string MY_KIND = FeaturesPlugin_ExtrusionCut::ID();
76     return MY_KIND;
77   }
78
79   /// Creates a new part document if needed.
80   FEATURESPLUGIN_EXPORT virtual void execute();
81
82   /// Request for initialization of data model of the feature: adding all attributes.
83   FEATURESPLUGIN_EXPORT virtual void initAttributes();
84
85   /// Use plugin manager for features creation.
86   FeaturesPlugin_ExtrusionCut();
87
88   /// appends a feature to the sketch sub-elements container
89   FEATURESPLUGIN_EXPORT virtual std::shared_ptr<ModelAPI_Feature> addFeature(std::string theID);
90   
91   /// Returns the number of sub-elements
92   FEATURESPLUGIN_EXPORT virtual int numberOfSubs() const;
93
94   /// Returns the sub-feature by zero-base index
95   FEATURESPLUGIN_EXPORT virtual std::shared_ptr<ModelAPI_Feature> subFeature(const int theIndex) const;
96
97   /// Returns the sub-feature unique identifier in this composite feature by zero-base index
98   FEATURESPLUGIN_EXPORT virtual int subFeatureId(const int theIndex) const;
99
100   /// Returns true if feature or reuslt belong to this composite feature as subs
101   FEATURESPLUGIN_EXPORT virtual bool isSub(ObjectPtr theObject) const;
102
103   /// This method to inform that sub-feature is removed and must be removed from the internal data
104   /// structures of the owner (the remove from the document will be done outside just after)
105   FEATURESPLUGIN_EXPORT virtual void removeFeature(std::shared_ptr<ModelAPI_Feature> theFeature);
106
107 private:
108   void LoadNamingDS(std::shared_ptr<ModelAPI_ResultBody> theResultBody,
109                     const std::shared_ptr<GeomAPI_Shape>& theBaseShape,
110                     const ListOfShape& theTools,
111                     const GeomAlgoAPI_Boolean& theAlgo);
112 };
113
114 #endif