1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
3 // File: ExchangePlugin_ExportFeature.h
4 // Created: May 14, 2015
5 // Author: Sergey POKHODENKO
7 #ifndef EXCHANGEPLUGIN_EXPORTFEATURE_H_
8 #define EXCHANGEPLUGIN_EXPORTFEATURE_H_
10 #include <ExchangePlugin.h>
11 #include <ModelAPI_Feature.h>
12 #include <ModelAPI_Result.h>
16 /**\class ExchangePlugin_ExportFeature
18 * \brief Feature for export shapes to the external files in CAD formats.
20 * The set of supported formats is defined in the configuration file.
22 class ExchangePlugin_ExportFeature : public ModelAPI_Feature
25 inline static const std::string& ID()
27 static const std::string MY_EXPORT_ID("Export");
30 /// attribute name of file format
31 inline static const std::string& FILE_FORMAT_ID()
33 static const std::string MY_FILE_FORMAT_ID("export_file_format");
34 return MY_FILE_FORMAT_ID;
36 /// attribute name of file path
37 inline static const std::string& FILE_PATH_ID()
39 static const std::string MY_FILE_PATH_ID("export_file_selector");
40 return MY_FILE_PATH_ID;
42 /// attribute name of selection list
43 inline static const std::string& SELECTION_LIST_ID()
45 static const std::string MY_SELECTION_LIST_ID("selection_list");
46 return MY_SELECTION_LIST_ID;
48 /// default constructor
49 EXCHANGEPLUGIN_EXPORT ExchangePlugin_ExportFeature();
50 /// default destructor
51 EXCHANGEPLUGIN_EXPORT virtual ~ExchangePlugin_ExportFeature();
53 /// Request for initialization of data model of the feature: adding all attributes
54 EXCHANGEPLUGIN_EXPORT virtual void initAttributes();
56 /// Returns the unique kind of a feature
57 EXCHANGEPLUGIN_EXPORT virtual const std::string& getKind();
59 /// Computes or recomputes the results
60 EXCHANGEPLUGIN_EXPORT virtual void execute();
62 /// Reimplemented from ModelAPI_Feature::isMacro(). Returns true.
63 EXCHANGEPLUGIN_EXPORT virtual bool isMacro() const { return true; }
65 /// Reimplemented from ModelAPI_Feature::isPreviewNeeded(). Returns false.
66 EXCHANGEPLUGIN_EXPORT virtual bool isPreviewNeeded() const { return false; }
69 /// Performs the export of the file
70 EXCHANGEPLUGIN_EXPORT bool exportFile(const std::string& theFileName,
71 const std::string& theFormat,
72 std::shared_ptr<GeomAPI_Shape> theShape);
75 #endif /* EXPORT_EXPORTFEATURE_H_ */