Salome HOME
Remove some TODOs
[modules/shaper.git] / src / BuildAPI / BuildAPI_SubShapes.cpp
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
2
3 // File:        BuildAPI_SubShapes.cpp
4 // Created:     09 June 2016
5 // Author:      Dmitry Bobylev
6
7 #include "BuildAPI_SubShapes.h"
8
9 #include <ModelHighAPI_Tools.h>
10
11 //==================================================================================================
12 BuildAPI_SubShapes::BuildAPI_SubShapes(const std::shared_ptr<ModelAPI_Feature>& theFeature)
13 : ModelHighAPI_Interface(theFeature)
14 {
15   initialize();
16 }
17
18 //==================================================================================================
19 BuildAPI_SubShapes::BuildAPI_SubShapes(const std::shared_ptr<ModelAPI_Feature>& theFeature,
20                                        const ModelHighAPI_Selection& theBaseShape,
21                                        const std::list<ModelHighAPI_Selection>& theSubShapes)
22 : ModelHighAPI_Interface(theFeature)
23 {
24   if(initialize()) {
25     fillAttribute(theBaseShape, mybaseShape);
26     setSubShapes(theSubShapes);
27   }
28 }
29
30 //==================================================================================================
31 BuildAPI_SubShapes::~BuildAPI_SubShapes()
32 {
33
34 }
35
36 //==================================================================================================
37 void BuildAPI_SubShapes::setBaseShape(const ModelHighAPI_Selection& theBaseShape)
38 {
39   fillAttribute(theBaseShape, mybaseShape);
40
41   execute();
42 }
43
44 //==================================================================================================
45 void BuildAPI_SubShapes::setSubShapes(const std::list<ModelHighAPI_Selection>& theSubShapes)
46 {
47   fillAttribute(theSubShapes, mysubShapes);
48
49   execute();
50 }
51
52 //==================================================================================================
53 SubShapesPtr addSubShapes(const std::shared_ptr<ModelAPI_Document>& thePart,
54                           const ModelHighAPI_Selection& theBaseShape,
55                           const std::list<ModelHighAPI_Selection>& theSubShapes)
56 {
57   std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(BuildAPI_SubShapes::ID());
58   return SubShapesPtr(new BuildAPI_SubShapes(aFeature, theBaseShape, theSubShapes));
59 }