1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
3 // File: BuildAPI_SubShapes.cpp
4 // Created: 09 June 2016
5 // Author: Dmitry Bobylev
7 #include "BuildAPI_SubShapes.h"
9 #include <ModelHighAPI_Dumper.h>
10 #include <ModelHighAPI_Tools.h>
12 //==================================================================================================
13 BuildAPI_SubShapes::BuildAPI_SubShapes(const std::shared_ptr<ModelAPI_Feature>& theFeature)
14 : ModelHighAPI_Interface(theFeature)
19 //==================================================================================================
20 BuildAPI_SubShapes::BuildAPI_SubShapes(const std::shared_ptr<ModelAPI_Feature>& theFeature,
21 const ModelHighAPI_Selection& theBaseShape,
22 const std::list<ModelHighAPI_Selection>& theSubShapes)
23 : ModelHighAPI_Interface(theFeature)
26 fillAttribute(theBaseShape, mybaseShape);
27 setSubShapes(theSubShapes);
31 //==================================================================================================
32 BuildAPI_SubShapes::~BuildAPI_SubShapes()
37 //==================================================================================================
38 void BuildAPI_SubShapes::setBaseShape(const ModelHighAPI_Selection& theBaseShape)
40 fillAttribute(theBaseShape, mybaseShape);
45 //==================================================================================================
46 void BuildAPI_SubShapes::setSubShapes(const std::list<ModelHighAPI_Selection>& theSubShapes)
48 fillAttribute(theSubShapes, mysubShapes);
53 //==================================================================================================
54 void BuildAPI_SubShapes::dump(ModelHighAPI_Dumper& theDumper) const
56 FeaturePtr aBase = feature();
57 std::string aPartName = theDumper.name(aBase->document());
59 theDumper << aBase << " = model.addSubShapes(" << aPartName << ", "
60 << aBase->selection(BuildPlugin_SubShapes::BASE_SHAPE_ID()) << ", "
61 << aBase->selectionList(BuildPlugin_SubShapes::SUBSHAPES_ID()) << ")" << std::endl;
64 //==================================================================================================
65 SubShapesPtr addSubShapes(const std::shared_ptr<ModelAPI_Document>& thePart,
66 const ModelHighAPI_Selection& theBaseShape,
67 const std::list<ModelHighAPI_Selection>& theSubShapes)
69 std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(BuildAPI_SubShapes::ID());
70 return SubShapesPtr(new BuildAPI_SubShapes(aFeature, theBaseShape, theSubShapes));