Salome HOME
Merge remote-tracking branch 'remotes/origin/HighLevelDump'
[modules/shaper.git] / src / ExchangeAPI / ExchangeAPI_Export.cpp
1 // Name   : ExchangeAPI_Export.cpp
2 // Purpose: 
3 //
4 // History:
5 // 07/06/16 - Sergey POKHODENKO - Creation of the file
6
7 //--------------------------------------------------------------------------------------
8 #include "ExchangeAPI_Export.h"
9 //--------------------------------------------------------------------------------------
10 #include <ModelHighAPI_Tools.h>
11 //--------------------------------------------------------------------------------------
12 void exportToFile(const std::shared_ptr<ModelAPI_Document> & thePart,
13                   const std::string & theFilePath,
14                   const std::list<ModelHighAPI_Selection> & theSelectionList,
15                   const std::string & theFileFormat)
16 {
17   // TODO(spo): check that thePart is not empty
18   std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(ExchangePlugin_ExportFeature::ID());
19   fillAttribute("Regular", aFeature->string(ExchangePlugin_ExportFeature::EXPORT_TYPE_ID()));
20   fillAttribute(theFilePath, aFeature->string(ExchangePlugin_ExportFeature::FILE_PATH_ID()));
21   fillAttribute(theSelectionList, aFeature->selectionList(ExchangePlugin_ExportFeature::SELECTION_LIST_ID()));
22   fillAttribute(theFileFormat, aFeature->string(ExchangePlugin_ExportFeature::FILE_FORMAT_ID()));
23   aFeature->execute();
24 }
25
26 void exportToXAO(const std::shared_ptr<ModelAPI_Document> & thePart,
27                  const std::string & theFilePath,
28                  const std::string & theAuthor,
29                  const std::string & theGeometryName)
30 {
31   // TODO(spo): check that thePart is not empty
32   std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(ExchangePlugin_ExportFeature::ID());
33   fillAttribute("XAO", aFeature->string(ExchangePlugin_ExportFeature::EXPORT_TYPE_ID()));
34   fillAttribute(theFilePath, aFeature->string(ExchangePlugin_ExportFeature::XAO_FILE_PATH_ID()));
35   fillAttribute(theAuthor, aFeature->string(ExchangePlugin_ExportFeature::XAO_AUTHOR_ID()));
36   fillAttribute(theGeometryName, aFeature->string(ExchangePlugin_ExportFeature::XAO_GEOMETRY_NAME_ID()));
37   fillAttribute("XAO", aFeature->string(ExchangePlugin_ExportFeature::FILE_FORMAT_ID()));
38   aFeature->execute();
39 }
40
41 //--------------------------------------------------------------------------------------