1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
3 // File: FeaturesPlugin_Recover.h
4 // Created: 29 Jul 2016
5 // Author: Natalia ERMOLAEVA
7 #ifndef FEATURESPLUGIN_RECOVER_H_
8 #define FEATURESPLUGIN_RECOVER_H_
10 #include "FeaturesPlugin.h"
11 #include <ModelAPI_Feature.h>
12 #include <GeomAPI_Shape.h>
14 /**\class FeaturesPlugin_Recover
16 * \brief Feature for display of concealed attributes of some feature.
18 class FeaturesPlugin_Recover : public ModelAPI_Feature
20 /// List of already registered unconcealed pairs of unconcealed result and feature that caused
21 /// concealment. If attributes of this feature were changed, this list helps to synchronise
22 /// the current state with validators.
23 std::set<std::shared_ptr<ModelAPI_Object> > myRegistered;
24 /// The last stored Base to unregister Unconcealed when even attributes are already erased.
25 FeaturePtr myCurrentBase;
26 /// previous state of persistent flag
30 inline static const std::string& ID()
32 static const std::string MY_RECOVER_ID("Recover");
35 /// Attribute name of base feature.
36 inline static const std::string& BASE_FEATURE()
38 static const std::string MY_BASE_FEATURE("base_feature");
39 return MY_BASE_FEATURE;
42 /// Attribute name of recovered results list.
43 inline static const std::string& RECOVERED_ENTITIES()
45 static const std::string MY_RECOVERED_ENTITIES_ID("recovered");
46 return MY_RECOVERED_ENTITIES_ID;
49 /// Attribute name of persistenc concealment flag.
50 inline static const std::string& PERSISTENT()
52 static const std::string MY_PERSISTENT_ID("persistent");
53 return MY_PERSISTENT_ID;
56 /// Returns the kind of a feature
57 FEATURESPLUGIN_EXPORT virtual const std::string& getKind()
59 static std::string MY_KIND = FeaturesPlugin_Recover::ID();
63 /// Creates a new part document if needed
64 FEATURESPLUGIN_EXPORT virtual void execute();
66 /// Request for initialization of data model of the feature: adding all attributes
67 FEATURESPLUGIN_EXPORT virtual void initAttributes();
69 /// Use plugin manager for features creation
70 FeaturesPlugin_Recover();
72 /// Called on change of any argument-attribute of this object. Needed here for synchronization
73 /// of registered unconcealed.
74 virtual void attributeChanged(const std::string& theID);
76 /// Synchronises myRegistered before all attributes are erased
79 /// on unstability of feature, remove all unconcealment effect
80 virtual bool setStable(const bool theFlag);
81 /// on disable of feature, remove all unconcealment effect
82 virtual bool setDisabled(const bool theFlag);
84 /// Synchronises registration of unconcealed entities with the attributes values of this feature
85 void synchronizeRegistered();
87 /// Returns the base feature of this
88 FeaturePtr baseFeature();
90 /// erases all registered cashed values
91 void clearRegistered();