Salome HOME
79c3c6f0b9b03390ec04d6eb83e14ad3307deaea
[modules/shaper.git] / src / FeaturesAPI / FeaturesAPI_RemoveSubShapes.cpp
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
2
3 // File:        FeaturesAPI_RemoveSubShapes.cpp
4 // Created:     09 June 2016
5 // Author:      Dmitry Bobylev
6
7 #include "FeaturesAPI_RemoveSubShapes.h"
8
9 #include <ModelHighAPI_Tools.h>
10
11 //==================================================================================================
12 FeaturesAPI_RemoveSubShapes::FeaturesAPI_RemoveSubShapes(const std::shared_ptr<ModelAPI_Feature>& theFeature)
13 : ModelHighAPI_Interface(theFeature)
14 {
15   initialize();
16 }
17
18 //==================================================================================================
19 FeaturesAPI_RemoveSubShapes::FeaturesAPI_RemoveSubShapes(const std::shared_ptr<ModelAPI_Feature>& theFeature,
20                                                          const ModelHighAPI_Selection& theBase)
21 : ModelHighAPI_Interface(theFeature)
22 {
23   if(initialize()) {
24     setBase(theBase);
25
26     execute();
27   }
28 }
29
30 //==================================================================================================
31 FeaturesAPI_RemoveSubShapes::~FeaturesAPI_RemoveSubShapes()
32 {
33
34 }
35
36 //==================================================================================================
37 void FeaturesAPI_RemoveSubShapes::setBase(const ModelHighAPI_Selection& theBase)
38 {
39   fillAttribute(theBase, mybase);
40
41   execute();
42 }
43
44 //==================================================================================================
45 void FeaturesAPI_RemoveSubShapes::setSubShapesToKeep(const std::list<ModelHighAPI_Selection>& theSubShapes)
46 {
47   fillAttribute(theSubShapes, mysubshapes);
48
49   execute();
50 }
51
52 // TODO(spo): make add* as static functions of the class
53 //==================================================================================================
54 RemoveSubShapesPtr addRemoveSubShapes(const std::shared_ptr<ModelAPI_Document>& thePart,
55                                       const ModelHighAPI_Selection& theBase)
56 {
57   std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesAPI_RemoveSubShapes::ID());
58   return RemoveSubShapesPtr(new FeaturesAPI_RemoveSubShapes(aFeature, theBase));
59 }