1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
3 // File: PartSetPlugin_Part.h
4 // Created: 27 Mar 2014
5 // Author: Mikhail PONIKAROV
7 #ifndef PartSetPlugin_Part_H_
8 #define PartSetPlugin_Part_H_
10 #include "PartSetPlugin.h"
11 #include <ModelAPI_CompositeFeature.h>
13 /**\class PartSetPlugin_Part
15 * \brief Feature for creation of the new part in PartSet.
16 * All sub-features are sub-elements of composite feature.
18 class PartSetPlugin_Part : public ModelAPI_CompositeFeature
22 inline static const std::string& ID()
24 static const std::string MY_PART_KIND("Part");
27 /// Returns the kind of a feature
28 PARTSETPLUGIN_EXPORT virtual const std::string& getKind()
30 static std::string MY_KIND = PartSetPlugin_Part::ID();
34 /// Returns to which group in the document must be added feature
35 PARTSETPLUGIN_EXPORT virtual const std::string& getGroup()
37 static std::string MY_GROUP = "Parts";
41 /// Creates a new part document if needed
42 PARTSETPLUGIN_EXPORT virtual void execute();
44 /// Request for initialization of data model of the feature: adding all attributes
45 PARTSETPLUGIN_EXPORT virtual void initAttributes();
47 /// Part must be added only to PartSet
48 PARTSETPLUGIN_EXPORT virtual const std::string& documentToAdd();
50 // composite feature methods
52 /// Adds feature to its document
53 virtual std::shared_ptr<ModelAPI_Feature> addFeature(std::string theID);
55 /// Returns the number of sub-features of the document
56 virtual int numberOfSubs() const;
58 /// Returns the sub-feature by zero-base index
59 virtual std::shared_ptr<ModelAPI_Feature> subFeature(const int theIndex) const;
61 /// Returns the sub-feature unique identifier in this composite feature by zero-base index
62 virtual int subFeatureId(const int theIndex) const;
64 /// Returns true if feature or reuslt belong to this composite feature as subs
65 virtual bool isSub(ObjectPtr theObject) const;
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);
71 /// Use plugin manager for features creation