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