Salome HOME
Reading of the construction naming name support (in the frames of Dump Python issue...
[modules/shaper.git] / src / FeaturesAPI / FeaturesAPI_Recover.cpp
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
2
3 // File:        FeaturesAPI_Recover.cpp
4 // Created:     07 June 2016
5 // Author:      Dmitry Bobylev
6
7 #include "FeaturesAPI_Recover.h"
8
9 #include <ModelHighAPI_Reference.h>
10 #include <ModelHighAPI_Tools.h>
11
12 //=================================================================================================
13 FeaturesAPI_Recover::FeaturesAPI_Recover(const std::shared_ptr<ModelAPI_Feature>& theFeature)
14 : ModelHighAPI_Interface(theFeature)
15 {
16   initialize();
17 }
18
19 //=================================================================================================
20 FeaturesAPI_Recover::FeaturesAPI_Recover(const std::shared_ptr<ModelAPI_Feature>& theFeature,
21   const ModelHighAPI_Reference& theBaseFeature,
22   const std::list<ModelHighAPI_Selection>& theRecoveredList, const bool thePersistent)
23 : ModelHighAPI_Interface(theFeature)
24 {
25   if(initialize()) {
26     setBaseFeature(theBaseFeature);
27     setRecoveredList(theRecoveredList);
28     setIsPersistent(thePersistent);
29   }
30 }
31
32 //=================================================================================================
33 FeaturesAPI_Recover::~FeaturesAPI_Recover()
34 {}
35
36 //=================================================================================================
37 void FeaturesAPI_Recover::setBaseFeature(const ModelHighAPI_Reference& theBaseFeature)
38 {
39   fillAttribute(theBaseFeature, mybaseFeature);
40   // do not need to execute because on attribute changed it does everything anyway
41 }
42
43 //=================================================================================================
44 void FeaturesAPI_Recover::setRecoveredList(const std::list<ModelHighAPI_Selection>& theRecoverList)
45 {
46   fillAttribute(theRecoverList, myrecoveredList);
47   // do not need to execute because on attribute changed it does everything anyway
48 }
49
50 //=================================================================================================
51 void FeaturesAPI_Recover::setIsPersistent(bool thePersistent)
52 {
53   fillAttribute(thePersistent, myisPersistent);
54   // do not need to execute because on attribute changed it does everything anyway
55 }
56
57 //=================================================================================================
58 RecoverPtr addRecover(const std::shared_ptr<ModelAPI_Document>& thePart,
59   const ModelHighAPI_Reference& theBaseFeature,
60   const std::list<ModelHighAPI_Selection>& theRecoveredList, const bool thePersistent)
61 {
62   std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesAPI_Recover::ID());
63   return RecoverPtr(new FeaturesAPI_Recover(
64     aFeature, theBaseFeature, theRecoveredList, thePersistent));
65 }