]> SALOME platform Git repositories - modules/shaper.git/blob - src/ExchangePlugin/ExchangePlugin_ImportFeature.h
Salome HOME
Merge branch 'Dev_1.1.0' of newgeom:newgeom.git into Dev_1.1.0
[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
9 #include <GeomAPI_ICustomPrs.h>
10
11 #include <map>
12
13 #define IMPORTED_FEATURE_COLOR "#E0A01B"
14
15   /**\class ExchangePlugin_ImportFeature
16  * \ingroup Plugins
17  * \brief Feature for import shapes from the external files in CAD formats.
18  *
19  * The set of supported formats is defined in the configuration file.
20  */
21 class ExchangePlugin_ImportFeature : public ModelAPI_Feature, public GeomAPI_ICustomPrs
22 {
23  public:
24   /// Extrusion kind
25   inline static const std::string& ID()
26   {
27     static const std::string MY_IMPORT_ID("Import");
28     return MY_IMPORT_ID;
29   }
30   /// attribute name of referenced face
31   inline static const std::string& FILE_PATH_ID()
32   {
33     static const std::string MY_FILE_PATH_ID("import_file_selector");
34     return MY_FILE_PATH_ID;
35   }
36   /// default constructor
37   EXCHANGEPLUGIN_EXPORT ExchangePlugin_ImportFeature();
38   /// default destructor
39   EXCHANGEPLUGIN_EXPORT virtual ~ExchangePlugin_ImportFeature();
40
41   /// Returns the unique kind of a feature
42   EXCHANGEPLUGIN_EXPORT virtual const std::string& getKind();
43
44   /// Request for initialization of data model of the feature: adding all attributes
45   EXCHANGEPLUGIN_EXPORT virtual void initAttributes();
46
47   /// Computes or recomputes the results
48   EXCHANGEPLUGIN_EXPORT virtual void execute();
49
50   EXCHANGEPLUGIN_EXPORT virtual bool isInHistory()
51   {
52     return true;
53   }
54
55   /// Modifies the given presentation in the custom way.
56   virtual void customisePresentation(AISObjectPtr thePrs);
57
58  protected:
59   /// POerforms the import of the file
60   EXCHANGEPLUGIN_EXPORT bool importFile(const std::string& theFileName);
61
62 private:
63   /// Loads Naming data structure to the document
64   void loadNamingDS(std::shared_ptr<GeomAPI_Shape> theGeomShape, 
65                                         std::shared_ptr<ModelAPI_ResultBody> theResultBody);
66 };
67
68 #endif /* IMPORT_IMPORTFEATURE_H_ */