1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
3 // File: FeaturesAPI_RemoveSubShapes.cpp
4 // Created: 09 June 2016
5 // Author: Dmitry Bobylev
7 #include "FeaturesAPI_RemoveSubShapes.h"
9 #include <ModelHighAPI_Dumper.h>
10 #include <ModelHighAPI_Tools.h>
12 //==================================================================================================
13 FeaturesAPI_RemoveSubShapes::FeaturesAPI_RemoveSubShapes(
14 const std::shared_ptr<ModelAPI_Feature>& theFeature)
15 : ModelHighAPI_Interface(theFeature)
20 //==================================================================================================
21 FeaturesAPI_RemoveSubShapes::FeaturesAPI_RemoveSubShapes(
22 const std::shared_ptr<ModelAPI_Feature>& theFeature,
23 const ModelHighAPI_Selection& theBase)
24 : ModelHighAPI_Interface(theFeature)
33 //==================================================================================================
34 FeaturesAPI_RemoveSubShapes::~FeaturesAPI_RemoveSubShapes()
39 //==================================================================================================
40 void FeaturesAPI_RemoveSubShapes::setBase(const ModelHighAPI_Selection& theBase)
42 fillAttribute(theBase, mybase);
47 //==================================================================================================
48 void FeaturesAPI_RemoveSubShapes::setSubShapesToKeep(
49 const std::list<ModelHighAPI_Selection>& theSubShapes)
51 fillAttribute(theSubShapes, mysubshapes);
56 //==================================================================================================
57 void FeaturesAPI_RemoveSubShapes::dump(ModelHighAPI_Dumper& theDumper) const
59 FeaturePtr aBase = feature();
60 const std::string& aDocName = theDumper.name(aBase->document());
62 AttributeSelectionPtr anAttrBaseShape =
63 aBase->selection(FeaturesPlugin_RemoveSubShapes::BASE_SHAPE_ID());
64 AttributeSelectionListPtr anAttrSubShapes =
65 aBase->selectionList(FeaturesPlugin_RemoveSubShapes::SUBSHAPES_ID());
67 theDumper << aBase << " = model.addRemoveSubShapes(" << aDocName <<
68 ", " << anAttrBaseShape << ")" << std::endl;
69 theDumper << aBase << ".setSubShapesToKeep(" << anAttrSubShapes << ")" << std::endl;
72 //==================================================================================================
73 RemoveSubShapesPtr addRemoveSubShapes(const std::shared_ptr<ModelAPI_Document>& thePart,
74 const ModelHighAPI_Selection& theBase)
76 std::shared_ptr<ModelAPI_Feature> aFeature =
77 thePart->addFeature(FeaturesAPI_RemoveSubShapes::ID());
78 return RemoveSubShapesPtr(new FeaturesAPI_RemoveSubShapes(aFeature, theBase));