Salome HOME
Merge branch 'Dev_1.1.0' of newgeom:newgeom into Dev_1.1.0
[modules/shaper.git] / src / ExchangePlugin / ExchangePlugin_ImportFeature.h
index 4b3b7a80399296265a19a91a5fcae668d2ef024e..673a6d9509955ac69ccd9298798b1ea936a7f8a7 100644 (file)
@@ -1,33 +1,21 @@
-/*
- * ExchangePlugin_ImportFeature.h
- *
- *  Created on: Aug 28, 2014
- *      Author: sbh
- */
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
 
 #ifndef EXCHANGEPLUGIN_IMPORTFEATURE_H_
 #define EXCHANGEPLUGIN_IMPORTFEATURE_H_
 
 #include <ExchangePlugin.h>
 #include <ModelAPI_Feature.h>
+#include <ModelAPI_Result.h>
 
 #include <map>
 
-#ifdef WIN32
-#include <windows.h>
-#define LibHandle HMODULE
-#define LoadLib( name ) LoadLibrary( name )
-#define GetProc GetProcAddress
-#define UnLoadLib( handle ) FreeLibrary( handle );
-#else
-#include <dlfcn.h>
-#define LibHandle void*
-#define LoadLib( name ) dlopen( name, RTLD_LAZY | RTLD_GLOBAL)
-#define GetProc dlsym
-#define UnLoadLib( handle ) dlclose( handle );
-#endif
-
-class EXCHANGEPLUGIN_EXPORT ExchangePlugin_ImportFeature : public ModelAPI_Feature
+  /**\class ExchangePlugin_ImportFeature
+ * \ingroup Plugins
+ * \brief Feature for import shapes from the external files in CAD formats.
+ *
+ * The set of supported formats is defined in the configuration file.
+ */
+class ExchangePlugin_ImportFeature : public ModelAPI_Feature
 {
  public:
   /// Extrusion kind
@@ -42,28 +30,33 @@ class EXCHANGEPLUGIN_EXPORT ExchangePlugin_ImportFeature : public ModelAPI_Featu
     static const std::string MY_FILE_PATH_ID("import_file_selector");
     return MY_FILE_PATH_ID;
   }
-
-  ExchangePlugin_ImportFeature();
-  virtual ~ExchangePlugin_ImportFeature();
+  /// default constructor
+  EXCHANGEPLUGIN_EXPORT ExchangePlugin_ImportFeature();
+  /// default destructor
+  EXCHANGEPLUGIN_EXPORT virtual ~ExchangePlugin_ImportFeature();
 
   /// Returns the unique kind of a feature
-  virtual const std::string& getKind();
+  EXCHANGEPLUGIN_EXPORT virtual const std::string& getKind();
 
   /// Request for initialization of data model of the feature: adding all attributes
-  virtual void initAttributes();
+  EXCHANGEPLUGIN_EXPORT virtual void initAttributes();
 
   /// Computes or recomputes the results
-  virtual void execute();
+  EXCHANGEPLUGIN_EXPORT virtual void execute();
 
-  virtual bool isInHistory()
+  EXCHANGEPLUGIN_EXPORT virtual bool isInHistory()
   {
-    return false;
+    return true;
   }
 
  protected:
-  bool importFile(const std::string& theFileName);
-  LibHandle loadImportPlugin(const std::string& theFormatName);
-  
+  /// POerforms the import of the file
+  EXCHANGEPLUGIN_EXPORT bool importFile(const std::string& theFileName);
+
+private:
+  /// Loads Naming data structure to the document
+  void loadNamingDS(std::shared_ptr<GeomAPI_Shape> theGeomShape, 
+                                       std::shared_ptr<ModelAPI_ResultBody> theResultBody);
 };
 
 #endif /* IMPORT_IMPORTFEATURE_H_ */