Salome HOME
62a7c84b81173465fd8032649b58dc1f3b853967
[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   /**\class ExchangePlugin_ImportFeature
17  * \ingroup Plugins
18  * \brief Feature for import shapes from the external files in CAD formats.
19  *
20  * The set of supported formats is defined in the configuration file.
21  */
22 class ExchangePlugin_ImportFeature : public ModelAPI_Feature
23 {
24  public:
25   /// Extrusion kind
26   inline static const std::string& ID()
27   {
28     static const std::string MY_IMPORT_ID("Import");
29     return MY_IMPORT_ID;
30   }
31   /// attribute name of referenced face
32   inline static const std::string& FILE_PATH_ID()
33   {
34     static const std::string MY_FILE_PATH_ID("file_path");
35     return MY_FILE_PATH_ID;
36   }
37   /// default constructor
38   EXCHANGEPLUGIN_EXPORT ExchangePlugin_ImportFeature();
39   /// default destructor
40   EXCHANGEPLUGIN_EXPORT virtual ~ExchangePlugin_ImportFeature();
41
42   /// Returns the unique kind of a feature
43   EXCHANGEPLUGIN_EXPORT virtual const std::string& getKind();
44
45   /// Request for initialization of data model of the feature: adding all attributes
46   EXCHANGEPLUGIN_EXPORT virtual void initAttributes();
47
48   /// Computes or recomputes the results
49   EXCHANGEPLUGIN_EXPORT virtual void execute();
50
51   /// Reimplemented from ModelAPI_Feature::isPreviewNeeded(). Returns false.
52   EXCHANGEPLUGIN_EXPORT virtual bool isPreviewNeeded() const { return false; }
53
54  protected:
55   /// Performs the import of the file
56   EXCHANGEPLUGIN_EXPORT bool importFile(const std::string& theFileName);
57
58 private:
59   /// Loads Naming data structure to the document
60   void loadNamingDS(std::shared_ptr<GeomAPI_Shape> theGeomShape, 
61                     std::shared_ptr<ModelAPI_ResultBody> theResultBody);
62 };
63
64 #endif /* IMPORT_IMPORTFEATURE_H_ */