Salome HOME
Issue #1063: Problem of dynamic cast on Linux for Selection validators is solved
[modules/shaper.git] / src / ModelAPI / ModelAPI_CompositeFeature.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 // File:        ModelAPI_CompositeFeature.h
4 // Created:     20 Oct 2014
5 // Author:      Mikhail PONIKAROV
6
7 #ifndef MODELAPI_COMPOSITEFEATURE_H_
8 #define MODELAPI_COMPOSITEFEATURE_H_
9
10 #include "ModelAPI.h"
11 #include "ModelAPI_Feature.h"
12
13 /**\class ModelAPI_CompositeFeature
14  * \ingroup DataModel
15  * \brief Feature that consists of other features: like sketcher
16  * with edges inside. It just allows to add a feature to this feature only
17  * instead of adding in both document and this feature.
18  */
19 class ModelAPI_CompositeFeature : public ModelAPI_Feature
20 {
21 public:
22   MODELAPI_EXPORT virtual ~ModelAPI_CompositeFeature();
23
24   /// Adds feature to the sketch and to its document
25   virtual std::shared_ptr<ModelAPI_Feature> addFeature(std::string theID) = 0;
26
27   /// Returns the number of sub-elements
28   virtual int numberOfSubs(bool forTree = false) const = 0;
29
30   /// Returns the sub-feature by zero-base index
31   virtual std::shared_ptr<ModelAPI_Feature> subFeature(const int theIndex, bool forTree = false) = 0;
32
33   /// Returns the sub-feature unique identifier in this composite feature by zero-base index
34   virtual int subFeatureId(const int theIndex) const = 0;
35
36   /// Returns true if feature or result belong to this composite feature as subs
37   virtual bool isSub(ObjectPtr theObject) const = 0;
38
39   /// This method to inform that sub-feature is removed and must be removed from the internal data
40   /// structures of the owner (the remove from the document will be done outside just after)
41   virtual void removeFeature(std::shared_ptr<ModelAPI_Feature> theFeature) = 0;
42
43   /// Exchanges IDs of two given features: needed for more correct naming in some cases (issue 769)
44   MODELAPI_EXPORT virtual void exchangeIDs(std::shared_ptr<ModelAPI_Feature> theFeature1,
45     std::shared_ptr<ModelAPI_Feature> theFeature2);
46 };
47
48 //! Pointer on the composite feature object
49 typedef std::shared_ptr<ModelAPI_CompositeFeature> CompositeFeaturePtr;
50
51 #endif