Salome HOME
[bos #40620] [CEA] XAO export for SHAPER: Allow export of brep in a separate file
[modules/shaper.git] / src / ExchangePlugin / ExchangePlugin_ExportFeature.h
index f0866181c1e63d5c22a2b05ae1f5965a91a4419f..295aa7618f4a5e3fed26c73c4c395c629319fb97 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2017  CEA/DEN, EDF R&D
+// Copyright (C) 2014-2024  CEA, EDF
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
 //
 // You should have received a copy of the GNU Lesser General Public
 // License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 //
-// See http://www.salome-platform.org/ or
-// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 
 #ifndef EXCHANGEPLUGIN_EXPORTFEATURE_H_
@@ -61,6 +60,66 @@ public:
     static const std::string MY_XAO_FILE_PATH_ID("xao_file_path");
     return MY_XAO_FILE_PATH_ID;
   }
+  /// attribute name of stl file path
+  inline static const std::string& STL_FILE_PATH_ID()
+  {
+    static const std::string MY_STL_FILE_PATH_ID("stl_file_path");
+    return MY_STL_FILE_PATH_ID;
+  }
+  /// Attribute name for selected object to export in stl file path.
+  inline static const std::string& STL_OBJECT_SELECTED()
+  {
+    static const std::string ATTR_ID("stl_object_selected");
+    return ATTR_ID;
+  }
+  /// Attribute name for deflection type.
+  inline static const std::string& STL_DEFLECTION_TYPE()
+  {
+    static const std::string ATTR_ID("stl_deflection_type");
+    return ATTR_ID;
+  }
+  /// Attribute name for deflection type relative.
+  inline static const std::string& STL_DEFLECTION_TYPE_RELATIVE()
+  {
+    static const std::string ATTR_ID("stl_deflection_type_relative");
+    return ATTR_ID;
+  }
+  /// Attribute name for deflection type absolute.
+  inline static const std::string& STL_DEFLECTION_TYPE_ABSOLUTE()
+  {
+    static const std::string ATTR_ID("stl_deflection_type_absolute");
+    return ATTR_ID;
+  }
+  /// Attribute name for relative.
+  inline static const std::string& STL_RELATIVE()
+  {
+    static const std::string ATTR_ID("stl_relative");
+    return ATTR_ID;
+  }
+  /// Attribute name for absolute.
+  inline static const std::string& STL_ABSOLUTE()
+  {
+    static const std::string ATTR_ID("stl_absolute");
+    return ATTR_ID;
+  }
+  /// Attribute name for stl file type.
+  inline static const std::string& STL_FILE_TYPE()
+  {
+    static const std::string ATTR_ID("stl_file_type");
+    return ATTR_ID;
+  }
+  /// Attribute name for stl file type ascii.
+  inline static const std::string& STL_FILE_TYPE_ASCII()
+  {
+    static const std::string ATTR_ID("stl_file_type_acii");
+    return ATTR_ID;
+  }
+  /// Attribute name for stl file type binary.
+  inline static const std::string& STL_FILE_TYPE_BINARY()
+  {
+    static const std::string ATTR_ID("stl_file_type_binary");
+    return ATTR_ID;
+  }
   /// attribute name of file format
   inline static const std::string& FILE_FORMAT_ID()
   {
@@ -73,6 +132,12 @@ public:
     static const std::string MY_SELECTION_LIST_ID("selection_list");
     return MY_SELECTION_LIST_ID;
   }
+  /// attribute name of xao selection list
+  inline static const std::string& XAO_SELECTION_LIST_ID()
+  {
+    static const std::string MY_SELECTION_LIST_ID("xao_selection_list");
+    return MY_SELECTION_LIST_ID;
+  }
   /// attribute name of author for XAO format
   inline static const std::string& XAO_AUTHOR_ID()
   {
@@ -85,6 +150,26 @@ public:
     static const std::string MY_XAO_GEOMETRY_NAME_ID("xao_geometry_name");
     return MY_XAO_GEOMETRY_NAME_ID;
   }
+  /// attribute name of xao shape file path
+  inline static const std::string& XAO_SHAPE_FILE_PATH_ID()
+  {
+    static const std::string MY_XAO_SHAPE_FILE_PATH_ID("xao_shape_file_path");
+    return MY_XAO_SHAPE_FILE_PATH_ID;
+  }
+  /// attribute flag to export shape in a separate file during xao export,
+  /// name of shape file will be xao_file_path + .brep
+  inline static const std::string& XAO_SHAPE_FILE_SEPARATE_ID()
+  {
+    static const std::string MY_XAO_SHAPE_FILE_SEPARATE_ID("xao_shape_file_separate");
+    return MY_XAO_SHAPE_FILE_SEPARATE_ID;
+  }
+  /// attribute string memory buffer
+  inline static const std::string& MEMORY_BUFFER_ID()
+  {
+    static const std::string MY_MEMORY_BUFFER_ID("memory_buffer");
+    return MY_MEMORY_BUFFER_ID;
+  }
+
   /// Default constructor
   EXCHANGEPLUGIN_EXPORT ExchangePlugin_ExportFeature();
   /// Default destructor
@@ -106,8 +191,9 @@ public:
   EXCHANGEPLUGIN_EXPORT virtual void execute();
 
   /// Reimplemented from ModelAPI_Feature::isMacro(). Returns false.
-  // Not a macro. Otherwise, the feature will be deleted after being executed
-  EXCHANGEPLUGIN_EXPORT virtual bool isMacro() const { return false; }
+  // It is macro for not-XAO export. For XAO the feature is kept invisible in the tree
+  // for the export to GEOM functionality correct working.
+  EXCHANGEPLUGIN_EXPORT virtual bool isMacro() const;
 
   /// Reimplemented from ModelAPI_Feature::isPreviewNeeded(). Returns false.
   EXCHANGEPLUGIN_EXPORT virtual bool isPreviewNeeded() const { return false; }
@@ -119,10 +205,15 @@ public:
 protected:
   /// Performs export of the file
   EXCHANGEPLUGIN_EXPORT void exportFile(const std::string& theFileName,
-                                        const std::string& theFormat);
+                                        const std::string& theFormat,
+                                        const bool         isMemoryExport);
 
   /// Performs export to XAO file
-  EXCHANGEPLUGIN_EXPORT void exportXAO(const std::string& theFileName);
+  EXCHANGEPLUGIN_EXPORT void exportXAO(const std::string& theFileName,
+                                       const bool         isMemoryExport);
+
+  /// Performs export to STL file
+  EXCHANGEPLUGIN_EXPORT void exportSTL(const std::string& theFileName);
 };
 
 #endif /* EXPORT_EXPORTFEATURE_H_ */