Salome HOME
4ffce6277496e0d34e95d5b6eb118bc56943b965
[modules/shaper.git] / src / ExchangePlugin / ExchangePlugin_ExportFeature.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 // File:    ExchangePlugin_ExportFeature.h
4 // Created: May 14, 2015
5 // Author:  Sergey POKHODENKO
6
7 #ifndef EXCHANGEPLUGIN_EXPORTFEATURE_H_
8 #define EXCHANGEPLUGIN_EXPORTFEATURE_H_
9
10 #include <ExchangePlugin.h>
11 #include <ModelAPI_Feature.h>
12 #include <ModelAPI_Result.h>
13
14 #include <map>
15
16 /**
17  * \class ExchangePlugin_ExportFeature
18  * \ingroup Plugins
19  * \brief Feature for export shapes to the external files in CAD formats.
20  *
21  * The list of supported formats is defined in the configuration file.
22  */
23 class ExchangePlugin_ExportFeature : public ModelAPI_Feature
24 {
25 public:
26   /// Feature kind
27   inline static const std::string& ID()
28   {
29     static const std::string MY_EXPORT_ID("Export");
30     return MY_EXPORT_ID;
31   }
32   /// attribute name for file format
33   inline static const std::string& EXPORT_TYPE_ID()
34   {
35     static const std::string MY_EXPORT_TYPE_ID("ExportType");
36     return MY_EXPORT_TYPE_ID;
37   }
38   /// attribute name of file path
39   inline static const std::string& FILE_PATH_ID()
40   {
41     static const std::string MY_FILE_PATH_ID("file_path");
42     return MY_FILE_PATH_ID;
43   }
44   /// attribute name of file format
45   inline static const std::string& FILE_FORMAT_ID()
46   {
47     static const std::string MY_FILE_FORMAT_ID("file_format");
48     return MY_FILE_FORMAT_ID;
49   }
50   /// attribute name of selection list
51   inline static const std::string& SELECTION_LIST_ID()
52   {
53     static const std::string MY_SELECTION_LIST_ID("selection_list");
54     return MY_SELECTION_LIST_ID;
55   }
56   /// attribute name of author for XAO format
57   inline static const std::string& XAO_AUTHOR_ID()
58   {
59     static const std::string MY_XAO_AUTHOR_ID("xao_author");
60     return MY_XAO_AUTHOR_ID;
61   }
62   /// attribute name of geometry name for XAO format
63   inline static const std::string& XAO_GEOMETRY_NAME_ID()
64   {
65     static const std::string MY_XAO_GEOMETRY_NAME_ID("xao_geometry_name");
66     return MY_XAO_GEOMETRY_NAME_ID;
67   }
68   /// Default constructor
69   EXCHANGEPLUGIN_EXPORT ExchangePlugin_ExportFeature();
70   /// Default destructor
71   EXCHANGEPLUGIN_EXPORT virtual ~ExchangePlugin_ExportFeature();
72
73   /// Returns the unique kind of a feature
74   EXCHANGEPLUGIN_EXPORT virtual const std::string& getKind()
75   {
76     return ExchangePlugin_ExportFeature::ID();
77   }
78
79   /// Request for initialization of data model of the feature: adding all attributes
80   EXCHANGEPLUGIN_EXPORT virtual void initAttributes();
81
82   /// Computes or recomputes the results
83   EXCHANGEPLUGIN_EXPORT virtual void execute();
84
85   /// Reimplemented from ModelAPI_Feature::isMacro(). Returns true.
86   EXCHANGEPLUGIN_EXPORT virtual bool isMacro() const { return true; }
87
88   /// Reimplemented from ModelAPI_Feature::isPreviewNeeded(). Returns false.
89   EXCHANGEPLUGIN_EXPORT virtual bool isPreviewNeeded() const { return false; }
90
91 protected:
92   /// Performs export of the file
93   EXCHANGEPLUGIN_EXPORT void exportFile(const std::string& theFileName,
94                                         const std::string& theFormat);
95
96   /// Performs export to XAO file
97   EXCHANGEPLUGIN_EXPORT void exportXAO(const std::string& theFileName);
98 };
99
100 #endif /* EXPORT_EXPORTFEATURE_H_ */