1 // Name : ExchangeAPI_Import.cpp
5 // 07/06/16 - Sergey POKHODENKO - Creation of the file
7 //--------------------------------------------------------------------------------------
8 #include "ExchangeAPI_Import.h"
9 //--------------------------------------------------------------------------------------
10 #include <ModelHighAPI_Dumper.h>
11 #include <ModelHighAPI_Tools.h>
12 //--------------------------------------------------------------------------------------
13 ExchangeAPI_Import::ExchangeAPI_Import(
14 const std::shared_ptr<ModelAPI_Feature> & theFeature)
15 : ModelHighAPI_Interface(theFeature)
20 ExchangeAPI_Import::ExchangeAPI_Import(
21 const std::shared_ptr<ModelAPI_Feature> & theFeature,
22 const std::string & theFilePath)
23 : ModelHighAPI_Interface(theFeature)
26 setFilePath(theFilePath);
29 ExchangeAPI_Import::~ExchangeAPI_Import()
34 //--------------------------------------------------------------------------------------
35 void ExchangeAPI_Import::setFilePath(const std::string & theFilePath)
37 fillAttribute(theFilePath, myfilePath);
42 //--------------------------------------------------------------------------------------
43 void ExchangeAPI_Import::dump(ModelHighAPI_Dumper& theDumper) const
45 FeaturePtr aBase = feature();
46 std::string aPartName = theDumper.name(aBase->document());
48 theDumper << aBase << " = model.addImport(" << aPartName << ", "
49 << aBase->string(ExchangePlugin_ImportFeature::FILE_PATH_ID()) << ")" << std::endl;
52 //--------------------------------------------------------------------------------------
54 const std::shared_ptr<ModelAPI_Document> & thePart,
55 const std::string & theFilePath)
57 // TODO(spo): check that thePart is not empty
58 std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(ExchangeAPI_Import::ID());
59 return ImportPtr(new ExchangeAPI_Import(aFeature, theFilePath));