]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
feat : Added manager attr + default values API_MediaList
authorNicolas RECHATIN <nicolas.rechatin@cea.fr>
Mon, 9 Oct 2023 09:04:52 +0000 (11:04 +0200)
committerNicolas RECHATIN <nicolas.rechatin@cea.fr>
Mon, 9 Oct 2023 09:04:52 +0000 (11:04 +0200)
src/ExchangeAPI/ExchangeAPI_Export.cpp
src/ExchangeAPI/ExchangeAPI_Export.h

index b1a276bf334618888198d8ceaeb27ce4cc8427d7..3fc5e53769e43ad03eef7c696a343715aa9df5c1 100644 (file)
@@ -53,17 +53,25 @@ 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 std::string & theFilePath,
-                              const ModelHighAPI_Selection & theSelectedShape)
-: ModelHighAPI_Interface(theFeature)
+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)
+    : ModelHighAPI_Interface(theFeature)
 {
   initialize();
   fillAttribute("ROOT", theFeature->string(ExchangePlugin_ExportFeature::EXPORT_TYPE_ID()));
   fillAttribute("ROOT", theFeature->string(ExchangePlugin_ExportFeature::FILE_FORMAT_ID()));
-  fillAttribute("manager_name", theFeature->string(ExchangePlugin_ExportFeature::ROOT_MANAGER_NAME_ID()));
-  fillAttribute("manager_title", theFeature->string(ExchangePlugin_ExportFeature::ROOT_MANAGER_TITLE_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(theSelectedShape, theFeature->selection(ExchangePlugin_ExportFeature::MAIN_OBJECT_ID()));
   fillAttribute(theFilePath, theFeature->string(ExchangePlugin_ExportFeature::ROOT_FILE_PATH_ID()));
@@ -273,15 +281,17 @@ ExportPtr exportToXAO(const std::shared_ptr<ModelAPI_Document> & thePart,
 }
 
 ExportPtr exportToROOT(const std::shared_ptr<ModelAPI_Document> &thePart,
-                       const std::string &theFilePath,
-                       const ModelHighAPI_Selection &theSelectedShape)
+                       const ModelHighAPI_Selection &theSelectedShape,
+                       const std::string &theFilePath = "./exportedROOT.C",
+                       const std::string &theManagerName = "manager_name",
+                       const std::string &theManagerTitle = "manager_title")
 {
   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, theFilePath, theSelectedShape));
+  return ExportPtr(new ExchangeAPI_Export(aFeature, theSelectedShape, theFilePath, theManagerName, theManagerTitle));
 }
 
 
index 0c5f68aa8fac3a9e408efa5927f0d23279d3cd8e..082284dcaeeddf0696cf9090e6ce1f475942061d 100644 (file)
@@ -56,8 +56,10 @@ public:
   /// Constructor with values for ROOT export.
   EXCHANGEAPI_EXPORT
   explicit ExchangeAPI_Export(const std::shared_ptr<ModelAPI_Feature> &theFeature,
+                              const ModelHighAPI_Selection &theSelectedShape,
                               const std::string &theFilePath,
-                              const ModelHighAPI_Selection &theSelectedShape);
+                              const std::string &theManagerName,
+                              const std::string &theManagerTitle);
 
   /// Constructor with values for STL of selected result export.
   EXCHANGEAPI_EXPORT
@@ -186,8 +188,10 @@ ExportPtr exportToXAO(const std::shared_ptr<ModelAPI_Document> & thePart,
  */
 EXCHANGEAPI_EXPORT
 ExportPtr exportToROOT(const std::shared_ptr<ModelAPI_Document> &thePart,
-                       const std::string &theFilePath,
-                       const ModelHighAPI_Selection &theSelectedShape);
+                       const ModelHighAPI_Selection &theSelectedShape,
+                       const std::string &theFilePath = "./exportedROOT.C",
+                       const std::string &theManagerName = "manager_name",
+                       const std::string &theManagerTitle = "manager_title");
 
 /** \ingroup CPPHighAPI
  *  \brief Export selected features or the whole part to the binary file.