Salome HOME
Issue #561: Import Performance - disable preview by isPreviewNeeded() returns false.
[modules/shaper.git] / src / ExchangePlugin / ExchangePlugin_ImportFeature.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 #ifndef EXCHANGEPLUGIN_IMPORTFEATURE_H_
4 #define EXCHANGEPLUGIN_IMPORTFEATURE_H_
5
6 #include <ExchangePlugin.h>
7 #include <ModelAPI_Feature.h>
8 #include <ModelAPI_Result.h>
9
10 #include <map>
11
12   /**\class ExchangePlugin_ImportFeature
13  * \ingroup Plugins
14  * \brief Feature for import shapes from the external files in CAD formats.
15  *
16  * The set of supported formats is defined in the configuration file.
17  */
18 class ExchangePlugin_ImportFeature : public ModelAPI_Feature
19 {
20  public:
21   /// Extrusion kind
22   inline static const std::string& ID()
23   {
24     static const std::string MY_IMPORT_ID("Import");
25     return MY_IMPORT_ID;
26   }
27   /// attribute name of referenced face
28   inline static const std::string& FILE_PATH_ID()
29   {
30     static const std::string MY_FILE_PATH_ID("import_file_selector");
31     return MY_FILE_PATH_ID;
32   }
33   /// default constructor
34   EXCHANGEPLUGIN_EXPORT ExchangePlugin_ImportFeature();
35   /// default destructor
36   EXCHANGEPLUGIN_EXPORT virtual ~ExchangePlugin_ImportFeature();
37
38   /// Returns the unique kind of a feature
39   EXCHANGEPLUGIN_EXPORT virtual const std::string& getKind();
40
41   /// Request for initialization of data model of the feature: adding all attributes
42   EXCHANGEPLUGIN_EXPORT virtual void initAttributes();
43
44   /// Computes or recomputes the results
45   EXCHANGEPLUGIN_EXPORT virtual void execute();
46
47   /// Reimplemented from ModelAPI_Feature::isPreviewNeeded(). Returns false.
48   EXCHANGEPLUGIN_EXPORT virtual bool isPreviewNeeded() const { return false; }
49
50  protected:
51   /// Performs the import of the file
52   EXCHANGEPLUGIN_EXPORT bool importFile(const std::string& theFileName);
53
54 private:
55   /// Loads Naming data structure to the document
56   void loadNamingDS(std::shared_ptr<GeomAPI_Shape> theGeomShape, 
57                     std::shared_ptr<ModelAPI_ResultBody> theResultBody);
58 };
59
60 #endif /* IMPORT_IMPORTFEATURE_H_ */