Salome HOME
Correction of compilation error
[modules/shaper.git] / src / ExchangePlugin / ExchangePlugin_ExportFeature.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 #ifndef EXCHANGEPLUGIN_EXPORTFEATURE_H_
4 #define EXCHANGEPLUGIN_EXPORTFEATURE_H_
5
6 #include <ExchangePlugin.h>
7 #include <ModelAPI_Feature.h>
8 #include <ModelAPI_Result.h>
9
10 #include <map>
11
12 /**\class ExchangePlugin_ExportFeature
13  * \ingroup Plugins
14  * \brief Feature for export shapes to the external files in CAD formats.
15  *
16  * The set of supported formats is defined in the configuration file.
17  */
18 class ExchangePlugin_ExportFeature : public ModelAPI_Feature
19 {
20 public:
21   inline static const std::string& ID()
22   {
23     static const std::string MY_EXPORT_ID("Export");
24     return MY_EXPORT_ID;
25   }
26   /// attribute name of file format
27   inline static const std::string& FILE_FORMAT_ID()
28   {
29     static const std::string MY_FILE_FORMAT_ID("export_file_format");
30     return MY_FILE_FORMAT_ID;
31   }
32   /// attribute name of file path
33   inline static const std::string& FILE_PATH_ID()
34   {
35     static const std::string MY_FILE_PATH_ID("export_file_selector");
36     return MY_FILE_PATH_ID;
37   }
38   /// attribute name of selection list
39   inline static const std::string& SELECTION_LIST_ID()
40   {
41     static const std::string MY_SELECTION_LIST_ID("selection_list");
42     return MY_SELECTION_LIST_ID;
43   }
44   /// default constructor
45   EXCHANGEPLUGIN_EXPORT ExchangePlugin_ExportFeature();
46   /// default destructor
47   EXCHANGEPLUGIN_EXPORT virtual ~ExchangePlugin_ExportFeature();
48
49   /// Request for initialization of data model of the feature: adding all attributes
50   EXCHANGEPLUGIN_EXPORT virtual void initAttributes();
51
52   /// Returns the unique kind of a feature
53   EXCHANGEPLUGIN_EXPORT virtual const std::string& getKind();
54
55   /// Computes or recomputes the results
56   EXCHANGEPLUGIN_EXPORT virtual void execute();
57
58   /// Reimplemented from ModelAPI_Feature::isMacro(). Returns true.
59   EXCHANGEPLUGIN_EXPORT virtual bool isMacro() const { return true; }
60
61   /// Reimplemented from ModelAPI_Feature::isPreviewNeeded(). Returns false.
62   EXCHANGEPLUGIN_EXPORT virtual bool isPreviewNeeded() const { return false; }
63
64 protected:
65   /// Performs the export of the file
66   EXCHANGEPLUGIN_EXPORT bool exportFile(const std::string& theFileName,
67                                         const std::string& theFormat,
68                                         std::shared_ptr<GeomAPI_Shape> theShape);
69 };
70
71 #endif /* EXPORT_EXPORTFEATURE_H_ */