1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
3 // File: CollectionAPI_Group.cpp
4 // Created: 07 June 2016
5 // Author: Dmitry Bobylev
7 #include "CollectionAPI_Group.h"
9 #include <ModelHighAPI_Dumper.h>
10 #include <ModelHighAPI_Integer.h>
11 #include <ModelHighAPI_Selection.h>
12 #include <ModelHighAPI_Tools.h>
14 //==================================================================================================
15 CollectionAPI_Group::CollectionAPI_Group(const std::shared_ptr<ModelAPI_Feature>& theFeature)
16 : ModelHighAPI_Interface(theFeature)
21 //==================================================================================================
22 CollectionAPI_Group::CollectionAPI_Group(const std::shared_ptr<ModelAPI_Feature>& theFeature,
23 const std::list<ModelHighAPI_Selection>& theGroupList)
24 : ModelHighAPI_Interface(theFeature)
27 setGroupList(theGroupList);
31 //==================================================================================================
32 CollectionAPI_Group::~CollectionAPI_Group()
37 //==================================================================================================
38 void CollectionAPI_Group::setGroupList(const std::list<ModelHighAPI_Selection>& theGroupList)
40 fillAttribute(theGroupList, mygroupList);
45 //==================================================================================================
46 void CollectionAPI_Group::dump(ModelHighAPI_Dumper& theDumper) const
48 FeaturePtr aBase = feature();
49 const std::string& aDocName = theDumper.name(aBase->document());
51 AttributeSelectionListPtr anAttrList = aBase->selectionList(CollectionPlugin_Group::LIST_ID());
53 theDumper << aBase << " = model.addGroup(" << aDocName << ", " << anAttrList << ")" << std::endl;
56 //==================================================================================================
57 GroupPtr addGroup(const std::shared_ptr<ModelAPI_Document>& thePart,
58 const std::list<ModelHighAPI_Selection>& theGroupList)
60 std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(CollectionAPI_Group::ID());
61 return GroupPtr(new CollectionAPI_Group(aFeature, theGroupList));