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