Salome HOME
Update SketchPlugin_Projection feature (issue #1459)
[modules/shaper.git] / src / ExchangePlugin / ExchangePlugin_ImportFeature.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 // File:    ExchangePlugin_ImportFeature.h
4 // Created: Aug 28, 2014
5 // Author:  Sergey BELASH
6
7 #ifndef EXCHANGEPLUGIN_IMPORTFEATURE_H_
8 #define EXCHANGEPLUGIN_IMPORTFEATURE_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_ImportFeature
18  * \ingroup Plugins
19  * \brief Feature for import shapes from the external files in CAD formats.
20  *
21  * The list of supported formats is defined in the configuration file.
22  */
23 class ExchangePlugin_ImportFeature : public ModelAPI_Feature
24 {
25  public:
26   /// Feature kind
27   inline static const std::string& ID()
28   {
29     static const std::string MY_IMPORT_ID("Import");
30     return MY_IMPORT_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("file_path");
36     return MY_FILE_PATH_ID;
37   }
38   /// Default constructor
39   EXCHANGEPLUGIN_EXPORT ExchangePlugin_ImportFeature();
40   /// Default destructor
41   EXCHANGEPLUGIN_EXPORT virtual ~ExchangePlugin_ImportFeature();
42
43   /// Returns the unique kind of a feature
44   EXCHANGEPLUGIN_EXPORT virtual const std::string& getKind();
45
46   /// Request for initialization of data model of the feature: adding all attributes
47   EXCHANGEPLUGIN_EXPORT virtual void initAttributes();
48
49   /// Computes or recomputes the results
50   EXCHANGEPLUGIN_EXPORT virtual void execute();
51
52   /// Reimplemented from ModelAPI_Feature::isPreviewNeeded(). Returns false.
53   EXCHANGEPLUGIN_EXPORT virtual bool isPreviewNeeded() const { return false; }
54
55  protected:
56   /// Performs the import of the file
57   EXCHANGEPLUGIN_EXPORT bool importFile(const std::string& theFileName);
58
59 private:
60   /// Loads Naming data structure to the document
61   void loadNamingDS(std::shared_ptr<GeomAPI_Shape> theGeomShape, 
62                     std::shared_ptr<ModelAPI_ResultBody> theResultBody);
63 };
64
65 #endif /* IMPORT_IMPORTFEATURE_H_ */