]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
feat : Added .root file name in export API
authorNicolas RECHATIN <nicolas.rechatin@cea.fr>
Mon, 13 Nov 2023 11:11:56 +0000 (12:11 +0100)
committerNicolas RECHATIN <nicolas.rechatin@cea.fr>
Mon, 13 Nov 2023 11:11:56 +0000 (12:11 +0100)
src/ExchangeAPI/ExchangeAPI_Export.cpp
src/ExchangeAPI/ExchangeAPI_Export.h

index 3fc5e53769e43ad03eef7c696a343715aa9df5c1..0112b643397958c70893b1138dc278397f4ccfb0 100644 (file)
@@ -53,18 +53,13 @@ ExchangeAPI_Export::ExchangeAPI_Export(const std::shared_ptr<ModelAPI_Feature>&
   apply(); // finish operation to make sure the export is done on the current state of the history
 }
 
-ExportPtr exportToROOT(const std::shared_ptr<ModelAPI_Document> &thePart,
-                       const ModelHighAPI_Selection &theSelectedShape,
-                       const std::string &theFilePath = "./exportedROOT.C",
-                       const std::string &theManagerName = "manager_name",
-                       const std::string &theManagerTitle = "manager_title");
-
 /// Constructor with values for ROOT export.
 ExchangeAPI_Export::ExchangeAPI_Export(const std::shared_ptr<ModelAPI_Feature> &theFeature,
                                        const ModelHighAPI_Selection &theSelectedShape,
                                        const std::string &theFilePath,
                                        const std::string &theManagerName,
-                                       const std::string &theManagerTitle)
+                                       const std::string &theManagerTitle,
+                                       const std::string &theExpFilePath)
     : ModelHighAPI_Interface(theFeature)
 {
   initialize();
@@ -72,7 +67,7 @@ ExchangeAPI_Export::ExchangeAPI_Export(const std::shared_ptr<ModelAPI_Feature> &
   fillAttribute("ROOT", theFeature->string(ExchangePlugin_ExportFeature::FILE_FORMAT_ID()));
   fillAttribute(theManagerName, theFeature->string(ExchangePlugin_ExportFeature::ROOT_MANAGER_NAME_ID()));
   fillAttribute(theManagerTitle, theFeature->string(ExchangePlugin_ExportFeature::ROOT_MANAGER_TITLE_ID()));
-  fillAttribute(theFilePath, theFeature->string(ExchangePlugin_ExportFeature::EXP_NAME_FILE_ID()));
+  fillAttribute(theExpFilePath, theFeature->string(ExchangePlugin_ExportFeature::EXP_NAME_FILE_ID()));
   fillAttribute(theSelectedShape, theFeature->selection(ExchangePlugin_ExportFeature::MAIN_OBJECT_ID()));
   fillAttribute(theFilePath, theFeature->string(ExchangePlugin_ExportFeature::ROOT_FILE_PATH_ID()));
   theFeature->execute();
@@ -284,14 +279,15 @@ ExportPtr exportToROOT(const std::shared_ptr<ModelAPI_Document> &thePart,
                        const ModelHighAPI_Selection &theSelectedShape,
                        const std::string &theFilePath = "./exportedROOT.C",
                        const std::string &theManagerName = "manager_name",
-                       const std::string &theManagerTitle = "manager_title")
+                       const std::string &theManagerTitle = "manager_title",
+                       const std::string &theExpFilePath = "exported.root")
 {
   apply(); // finish previous operation to make sure all previous operations are done
   std::shared_ptr<ModelAPI_Feature> aFeature =
     thePart->addFeature(ExchangePlugin_ExportFeature::ID());
   if (theFilePath.substr(theFilePath.size() - 2) != ".C")
     aFeature->setError(std::string("Error: the file seems to not have a .C extension file for ROOT. Aborting"));
-  return ExportPtr(new ExchangeAPI_Export(aFeature, theSelectedShape, theFilePath, theManagerName, theManagerTitle));
+  return ExportPtr(new ExchangeAPI_Export(aFeature, theSelectedShape, theFilePath, theManagerName, theManagerTitle, theExpFilePath));
 }
 
 
index 082284dcaeeddf0696cf9090e6ce1f475942061d..309dd9df5731f6a2b4818b0326dbdc47b850dfe4 100644 (file)
@@ -59,7 +59,8 @@ public:
                               const ModelHighAPI_Selection &theSelectedShape,
                               const std::string &theFilePath,
                               const std::string &theManagerName,
-                              const std::string &theManagerTitle);
+                              const std::string &theManagerTitle,
+                              const std::string &theExpFilePath);
 
   /// Constructor with values for STL of selected result export.
   EXCHANGEAPI_EXPORT
@@ -191,7 +192,8 @@ ExportPtr exportToROOT(const std::shared_ptr<ModelAPI_Document> &thePart,
                        const ModelHighAPI_Selection &theSelectedShape,
                        const std::string &theFilePath = "./exportedROOT.C",
                        const std::string &theManagerName = "manager_name",
-                       const std::string &theManagerTitle = "manager_title");
+                       const std::string &theManagerTitle = "manager_title",
+                       const std::string &theExpFilePath = "exported.root");
 
 /** \ingroup CPPHighAPI
  *  \brief Export selected features or the whole part to the binary file.