Salome HOME
Merge branch 'csgroup_IS2'
[modules/shaper.git] / src / ExchangePlugin / ExchangePlugin_ImportFeature.h
index 16b5c015877f9a18ee450012330d2910d037e9df..46618aba5893e100dec2f281c00c18e1db96310a 100644 (file)
  *
  * The list of supported formats is defined in the configuration file.
  */
-class ExchangePlugin_ImportFeature : public ModelAPI_CompositeFeature
+class ExchangePlugin_ImportFeatureBase : public ModelAPI_CompositeFeature
 {
- public:
-  /// Feature kind
-  inline static const std::string& ID()
-  {
-    static const std::string MY_IMPORT_ID("Import");
-    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()
   {
     static const std::string MY_FILE_PATH_ID("file_path");
     return MY_FILE_PATH_ID;
   }
-  /// attribute name of 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;
-  }
   /// All features (list of references)
   inline static const std::string& FEATURES_ID()
   {
     static const std::string MY_FEATURES_ID("Features");
     return MY_FEATURES_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()
+  /// attribute name of target part
+  inline static const std::string& TARGET_PART_ID()
   {
-    static const std::string MY_STEP_COLORS_ID("step_colors");
-    return MY_STEP_COLORS_ID;
+    static const std::string MY_TARGET_PART_ID("target_part");
+    return MY_TARGET_PART_ID;
   }
   /// Default constructor
-  EXCHANGEPLUGIN_EXPORT ExchangePlugin_ImportFeature();
+  EXCHANGEPLUGIN_EXPORT ExchangePlugin_ImportFeatureBase() = default;
   /// Default destructor
-  EXCHANGEPLUGIN_EXPORT virtual ~ExchangePlugin_ImportFeature();
+  EXCHANGEPLUGIN_EXPORT virtual ~ExchangePlugin_ImportFeatureBase() = default;
 
   /// Returns the unique kind of a feature
-  EXCHANGEPLUGIN_EXPORT virtual const std::string& getKind()
-  {
-    return ExchangePlugin_ImportFeature::ID();
-  }
+  EXCHANGEPLUGIN_EXPORT virtual const std::string& getKind() = 0;
 
   /// Request for initialization of data model of the feature: adding all attributes
   EXCHANGEPLUGIN_EXPORT virtual void initAttributes();
 
   /// Computes or recomputes the results
-  EXCHANGEPLUGIN_EXPORT virtual void execute();
+  EXCHANGEPLUGIN_EXPORT virtual void execute() = 0;
 
   /// Reimplemented from ModelAPI_Feature::isPreviewNeeded(). Returns false.
   EXCHANGEPLUGIN_EXPORT virtual bool isPreviewNeeded() const { return false; }
@@ -126,19 +93,82 @@ class ExchangePlugin_ImportFeature : public ModelAPI_CompositeFeature
 
  protected:
   /// Performs the import of the file
-  EXCHANGEPLUGIN_EXPORT void importFile(const std::string& theFileName);
-
-  /// Performs the import of XAO file
-  EXCHANGEPLUGIN_EXPORT void importXAO(const std::string& theFileName);
+  EXCHANGEPLUGIN_EXPORT virtual void importFile(const std::string& theFileName) = 0;
 
   /// Creates and prepares a result body from the shape
   std::shared_ptr<ModelAPI_ResultBody> createResultBody(
       std::shared_ptr<GeomAPI_Shape> aGeomShape);
 
-private:
   /// Loads Naming data structure to the document
   void loadNamingDS(std::shared_ptr<GeomAPI_Shape> theGeomShape,
                     std::shared_ptr<ModelAPI_ResultBody> theResultBody);
+};
+
+class ExchangePlugin_ImportFeature : public ExchangePlugin_ImportFeatureBase
+{
+public:
+  /// Feature kind
+  inline static const std::string& ID()
+  {
+    static const std::string MY_IMPORT_ID("Import");
+    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 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;
+  }
+
+  /// Default constructor
+  EXCHANGEPLUGIN_EXPORT ExchangePlugin_ImportFeature() = default;
+  /// Default destructor
+  EXCHANGEPLUGIN_EXPORT virtual ~ExchangePlugin_ImportFeature() = default;
+
+  /// 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;
+  }
+  /// Returns the unique kind of a feature
+  EXCHANGEPLUGIN_EXPORT virtual const std::string& getKind() override
+  {
+    return ExchangePlugin_ImportFeature::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();
+
+protected:
+  /// Performs the import of the file
+  EXCHANGEPLUGIN_EXPORT void importFile(const std::string& theFileName) override;
+
+  /// Performs the import of XAO file
+  EXCHANGEPLUGIN_EXPORT void importXAO(const std::string& theFileName);
+
+private:
   /// Set groups of color
   void setColorGroups(std::shared_ptr<ModelAPI_ResultBody> theResultBody);
 
@@ -153,4 +183,33 @@ private:
 
 };
 
+class ExchangePlugin_Import_ImageFeature : public ExchangePlugin_ImportFeatureBase
+{
+ public:
+  /// Feature kind
+  inline static const std::string& ID()
+  {
+    static const std::string MY_IMPORT_ID("ImportImage");
+    return MY_IMPORT_ID;
+  }
+
+  /// Default constructor
+  EXCHANGEPLUGIN_EXPORT ExchangePlugin_Import_ImageFeature() = default;
+  /// Default destructor
+  EXCHANGEPLUGIN_EXPORT virtual ~ExchangePlugin_Import_ImageFeature() = default;
+
+  /// Returns the unique kind of a feature
+  EXCHANGEPLUGIN_EXPORT virtual const std::string& getKind() override
+  {
+    return ExchangePlugin_Import_ImageFeature::ID();
+  }
+
+   /// Computes or recomputes the results
+  EXCHANGEPLUGIN_EXPORT virtual void execute() override;
+
+protected:
+  /// Performs the import of the file
+  EXCHANGEPLUGIN_EXPORT void importFile(const std::string& theFileName) override;
+
+};
 #endif /* IMPORT_IMPORTFEATURE_H_ */