1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
3 // File: FeaturesAPI_Partition.cpp
4 // Created: 09 June 2016
5 // Author: Dmitry Bobylev
7 #include "FeaturesAPI_Partition.h"
9 #include <ModelHighAPI_Dumper.h>
10 #include <ModelHighAPI_Tools.h>
12 //==================================================================================================
13 FeaturesAPI_Partition::FeaturesAPI_Partition(const std::shared_ptr<ModelAPI_Feature>& theFeature)
14 : ModelHighAPI_Interface(theFeature)
19 //==================================================================================================
20 FeaturesAPI_Partition::FeaturesAPI_Partition(const std::shared_ptr<ModelAPI_Feature>& theFeature,
21 const std::list<ModelHighAPI_Selection>& theBaseObjects)
22 : ModelHighAPI_Interface(theFeature)
25 setBase(theBaseObjects);
29 //==================================================================================================
30 FeaturesAPI_Partition::~FeaturesAPI_Partition()
35 //==================================================================================================
36 void FeaturesAPI_Partition::setBase(const std::list<ModelHighAPI_Selection>& theBaseObjects)
38 fillAttribute(theBaseObjects, mybaseObjects);
43 //==================================================================================================
44 void FeaturesAPI_Partition::dump(ModelHighAPI_Dumper& theDumper) const
46 FeaturePtr aBase = feature();
47 const std::string& aDocName = theDumper.name(aBase->document());
49 AttributeSelectionListPtr anAttrObjects =
50 aBase->selectionList(FeaturesPlugin_Partition::BASE_OBJECTS_ID());
52 theDumper << aBase << " = model.addPartition(" << aDocName <<
53 ", " << anAttrObjects << ")" << std::endl;
56 //==================================================================================================
57 PartitionPtr addPartition(const std::shared_ptr<ModelAPI_Document>& thePart,
58 const std::list<ModelHighAPI_Selection>& theBaseObjects)
60 std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesAPI_Partition::ID());
61 return PartitionPtr(new FeaturesAPI_Partition(aFeature, theBaseObjects));