1 // Name : PartSetAPI_Part.cpp
5 // 16/06/16 - Sergey POKHODENKO - Creation of the file
7 //--------------------------------------------------------------------------------------
8 #include "PartSetAPI_Part.h"
9 //--------------------------------------------------------------------------------------
10 #include <ModelAPI_ResultPart.h>
11 #include <ModelHighAPI_Dumper.h>
12 //--------------------------------------------------------------------------------------
13 #include <PartSetPlugin_Duplicate.h>
14 #include <PartSetPlugin_Remove.h>
15 //--------------------------------------------------------------------------------------
16 PartSetAPI_Part::PartSetAPI_Part(
17 const std::shared_ptr<ModelAPI_Feature> & theFeature)
18 : ModelHighAPI_Interface(theFeature)
23 PartSetAPI_Part::~PartSetAPI_Part()
27 //--------------------------------------------------------------------------------------
28 std::shared_ptr<ModelAPI_Document> PartSetAPI_Part::document() const
30 return std::dynamic_pointer_cast<ModelAPI_ResultPart>(defaultResult())->partDoc();
33 void PartSetAPI_Part::dump(ModelHighAPI_Dumper& theDumper) const
35 FeaturePtr aBase = feature();
36 const std::string& aDocName = theDumper.name(aBase->document());
38 theDumper << aBase << " = model.addPart(" << aDocName << ")" << std::endl;
41 //--------------------------------------------------------------------------------------
42 PartPtr addPart(const std::shared_ptr<ModelAPI_Document> & thePart)
44 // TODO(spo): check that thePart is not empty
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 // TODO(spo): check that thePart is not empty
53 std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(PartSetPlugin_Duplicate::ID());
55 return PartPtr(new PartSetAPI_Part(aFeature));
58 void removePart(const std::shared_ptr<ModelAPI_Document> & thePart)
60 // TODO(spo): check that thePart is not empty
61 std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(PartSetPlugin_Remove::ID());