Salome HOME
Add CPPHighAPI for export to XAO
[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(theFilePath, aFeature->string(ExchangePlugin_ExportFeature::FILE_PATH_ID()));
20   fillAttribute(theSelectionList, aFeature->selectionList(ExchangePlugin_ExportFeature::SELECTION_LIST_ID()));
21   fillAttribute(theFileFormat, aFeature->string(ExchangePlugin_ExportFeature::FILE_FORMAT_ID()));
22   aFeature->execute();
23 }
24
25 void exportToXAO(const std::shared_ptr<ModelAPI_Document> & thePart,
26                  const std::string & theFilePath,
27                  const std::string & theAuthor,
28                  const std::string & theGeometryName)
29 {
30   // TODO(spo): check that thePart is not empty
31   std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(ExchangePlugin_ExportFeature::ID());
32   fillAttribute(theFilePath, aFeature->string(ExchangePlugin_ExportFeature::FILE_PATH_ID()));
33   fillAttribute(theAuthor, aFeature->string(ExchangePlugin_ExportFeature::XAO_AUTHOR_ID()));
34   fillAttribute(theGeometryName, aFeature->string(ExchangePlugin_ExportFeature::XAO_GEOMETRY_NAME_ID()));
35   aFeature->execute();
36 }
37
38 //--------------------------------------------------------------------------------------