Salome HOME
Optimization for big sketched (from unit tests)
[modules/shaper.git] / src / PartSetPlugin / PartSetPlugin_Part.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 // File:        PartSetPlugin_Part.h
4 // Created:     27 Mar 2014
5 // Author:      Mikhail PONIKAROV
6
7 #ifndef PartSetPlugin_Part_H_
8 #define PartSetPlugin_Part_H_
9
10 #include "PartSetPlugin.h"
11 #include <ModelAPI_CompositeFeature.h>
12
13 /**\class PartSetPlugin_Part
14  * \ingroup Plugins
15  * \brief Feature for creation of the new part in PartSet.
16  * All sub-features are sub-elements of composite feature.
17  */
18 class PartSetPlugin_Part : public ModelAPI_CompositeFeature
19 {
20  public:
21   /// Part kind
22   inline static const std::string& ID()
23   {
24     static const std::string MY_PART_KIND("Part");
25     return MY_PART_KIND;
26   }
27   /// Returns the kind of a feature
28   PARTSETPLUGIN_EXPORT virtual const std::string& getKind()
29   {
30     static std::string MY_KIND = PartSetPlugin_Part::ID();
31     return MY_KIND;
32   }
33
34   /// Returns to which group in the document must be added feature
35   PARTSETPLUGIN_EXPORT virtual const std::string& getGroup()
36   {
37     static std::string MY_GROUP = "Parts";
38     return MY_GROUP;
39   }
40
41   /// Creates a new part document if needed
42   PARTSETPLUGIN_EXPORT virtual void execute();
43
44   /// Request for initialization of data model of the feature: adding all attributes
45   PARTSETPLUGIN_EXPORT virtual void initAttributes();
46
47   /// Part must be added only to PartSet
48   PARTSETPLUGIN_EXPORT virtual const std::string& documentToAdd();
49
50   // composite feature methods
51
52   /// Adds feature to its document
53   virtual std::shared_ptr<ModelAPI_Feature> addFeature(std::string theID);
54
55   /// Returns the number of sub-features of the document
56   virtual int numberOfSubs(bool forTree = false) const;
57
58   /// Returns the sub-feature by zero-base index
59   virtual std::shared_ptr<ModelAPI_Feature> subFeature(const int theIndex, bool forTree = false);
60
61   /// Returns the sub-feature unique identifier in this composite feature by zero-base index
62   virtual int subFeatureId(const int theIndex) const;
63
64   /// Returns true if feature or reuslt belong to this composite feature as subs
65   virtual bool isSub(ObjectPtr theObject) const;
66
67   /// This method to inform that sub-feature is removed and must be removed from the internal data
68   /// structures of the owner (the remove from the document will be done outside just after)
69   virtual void removeFeature(std::shared_ptr<ModelAPI_Feature> theFeature);
70
71   /// Use plugin manager for features creation
72   PartSetPlugin_Part();
73 };
74
75 #endif