1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2 // Name : PartSetAPI_Part.cpp
6 // 16/06/16 - Sergey POKHODENKO - Creation of the file
8 //--------------------------------------------------------------------------------------
9 #include "PartSetAPI_Part.h"
10 //--------------------------------------------------------------------------------------
11 #include <ModelAPI_ResultPart.h>
12 #include <ModelHighAPI_Dumper.h>
13 //--------------------------------------------------------------------------------------
14 #include <PartSetPlugin_Duplicate.h>
15 #include <PartSetPlugin_Remove.h>
16 //--------------------------------------------------------------------------------------
17 PartSetAPI_Part::PartSetAPI_Part(
18 const std::shared_ptr<ModelAPI_Feature> & theFeature)
19 : ModelHighAPI_Interface(theFeature)
24 PartSetAPI_Part::~PartSetAPI_Part()
28 //--------------------------------------------------------------------------------------
29 std::shared_ptr<ModelAPI_Document> PartSetAPI_Part::document() const
31 return std::dynamic_pointer_cast<ModelAPI_ResultPart>(defaultResult())->partDoc();
34 void PartSetAPI_Part::dump(ModelHighAPI_Dumper& theDumper) const
36 FeaturePtr aBase = feature();
37 const std::string& aDocName = theDumper.name(aBase->document());
39 theDumper << aBase << " = model.addPart(" << aDocName << ")" << std::endl;
42 //--------------------------------------------------------------------------------------
43 PartPtr addPart(const std::shared_ptr<ModelAPI_Document> & thePart)
45 std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(PartSetAPI_Part::ID());
47 return PartPtr(new PartSetAPI_Part(aFeature));
50 PartPtr duplicatePart(const std::shared_ptr<ModelAPI_Document> & thePart)
52 std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(PartSetPlugin_Duplicate::ID());
54 return PartPtr(new PartSetAPI_Part(aFeature));
57 void removePart(const std::shared_ptr<ModelAPI_Document> & thePart)
59 std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(PartSetPlugin_Remove::ID());