1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
3 // File: ModelAPI_CompositeFeature.h
4 // Created: 20 Oct 2014
5 // Author: Mikhail PONIKAROV
7 #ifndef MODELAPI_COMPOSITEFEATURE_H_
8 #define MODELAPI_COMPOSITEFEATURE_H_
11 #include "ModelAPI_Feature.h"
13 /**\class ModelAPI_CompositeFeature
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.
19 class ModelAPI_CompositeFeature : public ModelAPI_Feature
22 MODELAPI_EXPORT virtual ~ModelAPI_CompositeFeature();
24 /// Adds feature to the sketch and to its document
25 virtual std::shared_ptr<ModelAPI_Feature> addFeature(std::string theID) = 0;
27 /// Returns the number of sub-elements
28 virtual int numberOfSubs(bool forTree = false) const = 0;
30 /// Returns the sub-feature by zero-base index
31 virtual std::shared_ptr<ModelAPI_Feature> subFeature(const int theIndex,
32 bool forTree = false) = 0;
34 /// Returns the sub-feature unique identifier in this composite feature by zero-base index
35 virtual int subFeatureId(const int theIndex) const = 0;
37 /// Returns true if feature or result belong to this composite feature as subs
38 virtual bool isSub(ObjectPtr theObject) const = 0;
40 /// This method to inform that sub-feature is removed and must be removed from the internal data
41 /// structures of the owner (the remove from the document will be done outside just after)
42 virtual void removeFeature(std::shared_ptr<ModelAPI_Feature> theFeature) = 0;
44 /// Exchanges IDs of two given features: needed for more correct naming in some cases (issue 769)
45 MODELAPI_EXPORT virtual void exchangeIDs(std::shared_ptr<ModelAPI_Feature> theFeature1,
46 std::shared_ptr<ModelAPI_Feature> theFeature2);
48 /// in addition removes all subs
49 MODELAPI_EXPORT virtual void erase();
52 //! Pointer on the composite feature object
53 typedef std::shared_ptr<ModelAPI_CompositeFeature> CompositeFeaturePtr;