Salome HOME
Suppression of warnings, application launching problems in different cases (on Window...
[modules/shaper.git] / src / ExchangePlugin / ExchangePlugin_Import.h
index c09b3ebab9b353b758199118d8768ace211621f9..dcf9e5135b2372a8a32186f3662784badeb5240d 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2020  CEA/DEN, EDF R&D
+// Copyright (C) 2014-2021  CEA/DEN, EDF R&D
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
 
 #include <ModelAPI_CompositeFeature.h>
 #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;
-  }
   /// attribute name of file path
   inline static const std::string& FILE_PATH_ID()
   {
@@ -62,31 +58,134 @@ class ExchangePlugin_Import : public ModelAPI_Feature
     return MY_TARGET_PARTS_LIST_ID;
   }
   /// Default constructor
-  EXCHANGEPLUGIN_EXPORT ExchangePlugin_Import();
+  EXCHANGEPLUGIN_EXPORT ExchangePlugin_ImportBase()= default;
   /// Default destructor
-  EXCHANGEPLUGIN_EXPORT virtual ~ExchangePlugin_Import();
+  EXCHANGEPLUGIN_EXPORT virtual ~ExchangePlugin_ImportBase()= default;
 
-  /// Returns the unique kind of a feature
-  EXCHANGEPLUGIN_EXPORT virtual const std::string& getKind()
-  {
-    return ExchangePlugin_Import::ID();
-  }
 
   /// 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);
+  EXCHANGEPLUGIN_EXPORT virtual void attributeChanged(const std::string& theID) = 0;
 
   /// Computes or recomputes the results
-  EXCHANGEPLUGIN_EXPORT virtual void execute();
+  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);
+};
+
+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");
+    return MY_STEP_FILE_PATH_ID;
+  }
+  /// attribute name of step target part
+  inline static const std::string& STEP_TARGET_PART_ID()
+  {
+    static const std::string MY_STEP_TARGET_PART_ID("step_target_part");
+    return MY_STEP_TARGET_PART_ID;
+  }
+  /// attribute name of list ofstep target parts
+  inline static const std::string& STEP_TARGET_PARTS_LIST_ID()
+  {
+    static const std::string MY_STEP_TARGET_PARTS_LIST_ID("step_target_parts_list");
+    return MY_STEP_TARGET_PARTS_LIST_ID;
+  }
+  /// attribute name of step Scale to International System Units
+  inline static const std::string& STEP_SCALE_INTER_UNITS_ID()
+  {
+    static const std::string MY_STEP_SCALE_INTER_UNITS_ID("step_scale_inter_units");
+    return MY_STEP_SCALE_INTER_UNITS_ID;
+  }
+  /// attribute name of step materiels
+  inline static const std::string& STEP_MATERIALS_ID()
+  {
+    static const std::string MY_STEP_MATERIALS_ID("step_materials");
+    return MY_STEP_MATERIALS_ID;
+  }
+  /// attribute name of step colors
+  inline static const std::string& STEP_COLORS_ID()
+  {
+    static const std::string MY_STEP_COLORS_ID("step_colors");
+    return MY_STEP_COLORS_ID;
+  }
+  /// Default constructor
+  EXCHANGEPLUGIN_EXPORT ExchangePlugin_Import() = default;
+  /// Default destructor
+  EXCHANGEPLUGIN_EXPORT virtual ~ExchangePlugin_Import() = default;
+
+  /// Returns the unique kind of a feature
+  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) override;
+
+};
+
+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;
+  }
+
+  /// 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;
+
 };
 
 #endif /* IMPORT_IMPORTFEATURE_H_ */