Salome HOME
add Picture import
[modules/shaper.git] / src / ExchangePlugin / ExchangePlugin_Import.h
index eeac517943217320b69804add40fb0a5a0e5726e..7bb2928947979096adba1cc7948db9dbcb751246 100644 (file)
@@ -26,9 +26,9 @@
 #include <ModelAPI_Result.h>
 #include <ModelAPI_AttributeInteger.h>
 #include <ModelAPI_AttributeStringArray.h>
-
 #include <map>
 
+
 /**
  * \class ExchangePlugin_ImportFeature
  * \ingroup Plugins
  *
  * The list of supported formats is defined in the configuration file.
  */
-class ExchangePlugin_Import : public ModelAPI_Feature
+class ExchangePlugin_ImportBase : public ModelAPI_Feature
 {
- public:
-  /// Feature kind
-  inline static const std::string& ID()
-  {
-    static const std::string MY_IMPORT_ID("ImportMacro");
-    return MY_IMPORT_ID;
-  }
-  /// Feature kind
-  inline static const std::string& IMPORT_TYPE_ID()
-  {
-    static const std::string MY_IMPORT_TYPE_ID("ImportType");
-    return MY_IMPORT_TYPE_ID;
-  }
+ public:  
   /// attribute name of file path
   inline static const std::string& FILE_PATH_ID()
   {
@@ -69,7 +57,50 @@ class ExchangePlugin_Import : public ModelAPI_Feature
     static const std::string MY_TARGET_PARTS_LIST_ID("target_parts_list");
     return MY_TARGET_PARTS_LIST_ID;
   }
-  /// attribute name of step file path
+  /// Default constructor
+  EXCHANGEPLUGIN_EXPORT ExchangePlugin_ImportBase()= default;
+  /// Default destructor
+  EXCHANGEPLUGIN_EXPORT virtual ~ExchangePlugin_ImportBase()= default;
+
+
+  /// Request for initialization of data model of the feature: adding all attributes
+  EXCHANGEPLUGIN_EXPORT virtual void initAttributes();
+
+  /// Called on change of any argument-attribute of this object
+  /// \param theID identifier of changed attribute
+  EXCHANGEPLUGIN_EXPORT virtual void attributeChanged(const std::string& theID) = 0;
+
+  /// Computes or recomputes the results
+  EXCHANGEPLUGIN_EXPORT virtual void execute() = 0;
+
+  /// Returns true if this feature is used as macro: creates other features and then removed.
+  EXCHANGEPLUGIN_EXPORT virtual bool isMacro() const { return true; }
+
+  /// Reimplemented from ModelAPI_Feature::isPreviewNeeded(). Returns false.
+  EXCHANGEPLUGIN_EXPORT virtual bool isPreviewNeeded() const { return false; }
+
+ protected:
+
+  EXCHANGEPLUGIN_EXPORT void  updatePart(AttributeStringArrayPtr& aPartsAttr,
+                                         AttributeIntegerPtr& aTargetAttr);
+};
+
+EXCHANGEPLUGIN_EXPORT class ExchangePlugin_Import : public ExchangePlugin_ImportBase
+{
+ public:
+  /// Feature kind
+  inline static const std::string& ID()
+  {
+    static const std::string MY_IMPORT_ID("ImportMacro");
+    return MY_IMPORT_ID;
+  }
+ /// Feature kind
+  inline static const std::string& IMPORT_TYPE_ID()
+  {
+    static const std::string MY_IMPORT_TYPE_ID("ImportType");
+    return MY_IMPORT_TYPE_ID;
+  }
+ /// attribute name of step file path
   inline static const std::string& STEP_FILE_PATH_ID()
   {
     static const std::string MY_STEP_FILE_PATH_ID("step_file_path");
@@ -106,36 +137,55 @@ class ExchangePlugin_Import : public ModelAPI_Feature
     return MY_STEP_COLORS_ID;
   }
   /// Default constructor
-  EXCHANGEPLUGIN_EXPORT ExchangePlugin_Import();
+  EXCHANGEPLUGIN_EXPORT ExchangePlugin_Import() = default;
   /// Default destructor
-  EXCHANGEPLUGIN_EXPORT virtual ~ExchangePlugin_Import();
+  EXCHANGEPLUGIN_EXPORT virtual ~ExchangePlugin_Import() = default;
 
   /// Returns the unique kind of a feature
-  EXCHANGEPLUGIN_EXPORT virtual const std::string& getKind()
+  EXCHANGEPLUGIN_EXPORT virtual const std::string& getKind() override
   {
     return ExchangePlugin_Import::ID();
   }
+  /// Computes or recomputes the results
+  EXCHANGEPLUGIN_EXPORT virtual void execute() override;
 
   /// Request for initialization of data model of the feature: adding all attributes
   EXCHANGEPLUGIN_EXPORT virtual void initAttributes();
 
-  /// Called on change of any argument-attribute of this object
-  /// \param theID identifier of changed attribute
-  EXCHANGEPLUGIN_EXPORT virtual void attributeChanged(const std::string& theID);
+  // Called on change of any argument-attribute of this object
+    /// \param theID identifier of changed attribute
+  EXCHANGEPLUGIN_EXPORT virtual void attributeChanged(const std::string& theID) override;
 
-  /// Computes or recomputes the results
-  EXCHANGEPLUGIN_EXPORT virtual void execute();
+};
 
-  /// Returns true if this feature is used as macro: creates other features and then removed.
-  EXCHANGEPLUGIN_EXPORT virtual bool isMacro() const { return true; }
+EXCHANGEPLUGIN_EXPORT class ExchangePlugin_Import_Image : public ExchangePlugin_ImportBase
+{
+ public:
+  /// Feature kind
+  inline static const std::string& ID()
+  {
+    static const std::string MY_IMPORT_ID("ImportImageMacro");
+    return MY_IMPORT_ID;
+  }
 
-  /// Reimplemented from ModelAPI_Feature::isPreviewNeeded(). Returns false.
-  EXCHANGEPLUGIN_EXPORT virtual bool isPreviewNeeded() const { return false; }
+  /// Default constructor
+  EXCHANGEPLUGIN_EXPORT ExchangePlugin_Import_Image() = default;
+  /// Default destructor
+  EXCHANGEPLUGIN_EXPORT virtual ~ExchangePlugin_Import_Image() = default;
+
+  /// Returns the unique kind of a feature
+  EXCHANGEPLUGIN_EXPORT virtual const std::string& getKind() override
+  {
+    return ExchangePlugin_Import_Image::ID();
+  }
+
+  /// Computes or recomputes the results
+  EXCHANGEPLUGIN_EXPORT virtual void execute() override;
+
+  // Called on change of any argument-attribute of this object
+    /// \param theID identifier of changed attribute
+  EXCHANGEPLUGIN_EXPORT virtual void attributeChanged(const std::string& theID) override;
 
- private:
-  /// Called to update part
-  EXCHANGEPLUGIN_EXPORT
-  void updatePart(AttributeStringArrayPtr& thePartsAttr, AttributeIntegerPtr& theTargetAttr);
 };
 
 #endif /* IMPORT_IMPORTFEATURE_H_ */