${PROJECT_SOURCE_DIR}/src/GeomAPI
${PROJECT_SOURCE_DIR}/src/GeomAlgoAPI
${PROJECT_SOURCE_DIR}/src/XAO
+ ${PROJECT_SOURCE_DIR}/src/PrimitivesPlugin
+ ${PROJECT_SOURCE_DIR}/src/CollectionPlugin
)
SET(PROJECT_HEADERS
ExchangePlugin_Validators.h
ExchangePlugin_Tools.h
ExchangePlugin_Dump.h
+ ExchangePlugin_ExportRoot.h
)
SET(PROJECT_SOURCES
ExchangePlugin_Validators.cpp
ExchangePlugin_Tools.cpp
ExchangePlugin_Dump.cpp
+ ExchangePlugin_ExportRoot.cpp
)
SET(XML_RESOURCES
#include <iostream>
#include <ostream>
#endif
+#include <iostream>
#include <Config_Common.h>
#include <Config_PropManager.h>
#include <GeomAlgoAPI_BREPExport.h>
#include <GeomAlgoAPI_CompoundBuilder.h>
#include <GeomAlgoAPI_IGESExport.h>
+#include <GeomAlgoAPI_ROOTExport.h>
#include <GeomAlgoAPI_STEPExport.h>
#include <GeomAlgoAPI_Tools.h>
#include <GeomAlgoAPI_XAOExport.h>
#include <GeomAPI_ShapeExplorer.h>
#include <GeomAPI_Trsf.h>
+#include <ModelAPI_AttributeDouble.h>
#include <ModelAPI_AttributeSelectionList.h>
#include <ModelAPI_AttributeString.h>
#include <ModelAPI_AttributeStringArray.h>
#include <XAO_Xao.hxx>
#include <XAO_Geometry.hxx>
+#include <ExchangePlugin_ExportRoot.h>
#include <ExchangePlugin_Tools.h>
+#include <PrimitivesPlugin_Box.h>
+
+#ifdef WIN32
+# define _separator_ '\\'
+#else
+# define _separator_ '/'
+#endif
+
ExchangePlugin_ExportFeature::ExchangePlugin_ExportFeature()
{
}
ModelAPI_AttributeString::typeId());
data()->addAttribute(ExchangePlugin_ExportFeature::XAO_FILE_PATH_ID(),
ModelAPI_AttributeString::typeId());
+ data()->addAttribute(ExchangePlugin_ExportFeature::ROOT_FILE_PATH_ID(),
+ ModelAPI_AttributeString::typeId());
data()->addAttribute(ExchangePlugin_ExportFeature::FILE_FORMAT_ID(),
ModelAPI_AttributeString::typeId());
data()->addAttribute(ExchangePlugin_ExportFeature::SELECTION_LIST_ID(),
ModelAPI_AttributeString::typeId());
data()->addAttribute(ExchangePlugin_ExportFeature::XAO_GEOMETRY_NAME_ID(),
ModelAPI_AttributeString::typeId());
+ data()->addAttribute(ExchangePlugin_ExportFeature::ROOT_MANAGER_NAME_ID(),
+ ModelAPI_AttributeString::typeId());
+ data()->addAttribute(ExchangePlugin_ExportFeature::ROOT_MANAGER_TITLE_ID(),
+ ModelAPI_AttributeString::typeId());
+ data()->addAttribute(ExchangePlugin_ExportFeature::MAT_FILE_ID(),
+ ModelAPI_AttributeString::typeId());
ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(),
ExchangePlugin_ExportFeature::XAO_FILE_PATH_ID());
if (theID == XAO_FILE_PATH_ID()) {
string(ExchangePlugin_ExportFeature::FILE_PATH_ID())->setValue(
string(ExchangePlugin_ExportFeature::XAO_FILE_PATH_ID())->value());
+ } else if (theID == ROOT_FILE_PATH_ID()) {
+ string(ExchangePlugin_ExportFeature::FILE_PATH_ID())->setValue(
+ string(ExchangePlugin_ExportFeature::ROOT_FILE_PATH_ID())->value());
}
}
AttributeStringPtr aFormatAttr =
this->string(ExchangePlugin_ExportFeature::FILE_FORMAT_ID());
std::string aFormat = aFormatAttr->value();
+ std::cout<<"FORMAT"<<std::endl;
+ std::cout<<aFormat<<std::endl;
AttributeStringPtr aFilePathAttr =
this->string(ExchangePlugin_ExportFeature::FILE_PATH_ID());
std::string aFilePath = aFilePathAttr->value();
+ std::cout<<"FILE"<<std::endl;
+ std::cout<<aFilePath<<std::endl;
if (aFilePath.empty())
return;
aFormatName = "STEP";
} else if (anExtension == "IGES" || anExtension == "IGS") {
aFormatName = "IGES-5.1";
+ } else if (anExtension == "C") {
+ aFormatName = "ROOT";
} else {
aFormatName = anExtension;
}
}
+ std::cout<<"PASSAGE1"<<std::endl;
+ std::cout<<aFormatName<<std::endl;
+
if (aFormatName == "XAO") {
exportXAO(theFileName);
return;
}
+
+ if (aFormatName == "ROOT") {
+ exportROOT(theFileName);
+ return;
+ }
+
// make shape for export from selected shapes
AttributeSelectionListPtr aSelectionListAttr =
this->selectionList(ExchangePlugin_ExportFeature::SELECTION_LIST_ID());
// LCOV_EXCL_STOP
}
+
+void ExchangePlugin_ExportFeature::exportROOT(const std::string& theFileName)
+{
+ std::cout<<"EXPORT ROOT ==> debut"<<std::endl;
+ std::string aName = string(ExchangePlugin_ExportFeature::ROOT_MANAGER_NAME_ID())->value();
+ std::string aTitle = string(ExchangePlugin_ExportFeature::ROOT_MANAGER_TITLE_ID())->value();
+ std::string aFileMat = string(ExchangePlugin_ExportFeature::MAT_FILE_ID())->value();
+
+ std::shared_ptr<GeomAlgoAPI_ROOTExport> anAlgo(new GeomAlgoAPI_ROOTExport(theFileName));
+
+ std::list<std::string> listNames = ExchangePlugin_Tools::split(theFileName, _separator_);
+ listNames = ExchangePlugin_Tools::split(listNames.back(), '.');
+
+ // Create the head of file
+ anAlgo->buildHead(listNames.front(), aName, aTitle);
+
+ // Materials and medias
+ std::map<std::string, std::vector<std::string> > aMat;
+ std::map<std::string, std::vector<std::string> > aMedium;
+ ExchangePlugin_ExportRoot::readFileMat(aFileMat, aMat, aMedium);
+ std::cout<<"Size "<<aMat.size()<<std::endl;
+ std::cout<<"Size "<<aMedium.size()<<std::endl;
+
+ anAlgo->buildMatAndMedium(aMat, aMedium);
+
+ // Add feature in the file
+ std::list<FeaturePtr> theExport = document()->allFeatures();
+ std::list<FeaturePtr>::iterator itExport = theExport.begin();
+ std::vector<std::string> aListNamesOfFeatures;
+ for (; itExport != theExport.end(); ++itExport)
+ {
+ FeaturePtr aCurFeature = *itExport;
+ if (aCurFeature->getKind() == "Box") {
+ double anOx, anOy, anOz, aDx, aDy, aDz;
+ ExchangePlugin_ExportRoot::computeBox(aCurFeature, anOx, anOy, anOz, aDx, aDy, aDz);
+ //std::cout<<"BOX EN COURS (Feature) :: "<<aCurFeature->data()->name()<<std::endl;
+ //std::cout<<"BOX EN COURS (Result) :: "<<aCurFeature->firstResult()->data()->name()<<std::endl;
+ std::string anObjectName = aCurFeature->firstResult()->data()->name();
+ anAlgo->buildBox(anObjectName, anOx, anOy, anOz, aDx, aDy, aDz);
+ aListNamesOfFeatures.push_back(anObjectName);
+ aListNamesOfFeatures.push_back(aCurFeature->data()->name());
+ }
+ }
+
+ std::cout<<"Nb of elements :: " << aListNamesOfFeatures.size() << std::endl;
+
+ // Add all groups in the file
+ itExport = theExport.begin();
+ for (; itExport != theExport.end(); ++itExport)
+ {
+ FeaturePtr aCurFeature = *itExport;
+ if (aCurFeature->getKind() == "Group") {
+ std::vector<std::string> aListNames;
+ std::string anObjectName = aCurFeature->firstResult()->data()->name();
+ ExchangePlugin_ExportRoot::computeGroup(aCurFeature, aListNames);
+
+ //for (std::vector<int>::iterator it = myvector.begin() ; it != myvector.end(); ++it)
+ for (std::vector<std::string>::iterator it = aListNames.begin(); it != aListNames.end(); it++) {
+ std::string aName = anObjectName + "_" + *it;
+ anAlgo->BuildVolume(aName, *it, anObjectName);
+ }
+ }
+ }
+
+ anAlgo->buildEnd();
+
+ // Create the file with the content
+ anAlgo->write();
+}
+
bool ExchangePlugin_ExportFeature::isMacro() const
{
if (!data().get() || !data()->isValid())
static const std::string MY_XAO_GEOMETRY_NAME_ID("xao_geometry_name");
return MY_XAO_GEOMETRY_NAME_ID;
}
+
+ /// attribute name of root file path
+ inline static const std::string& ROOT_FILE_PATH_ID()
+ {
+ static const std::string MY_ROOT_FILE_PATH_ID("root_file_path");
+ return MY_ROOT_FILE_PATH_ID;
+ }
+ /// attribute name of author for XAO format
+ inline static const std::string& ROOT_MANAGER_NAME_ID()
+ {
+ static const std::string MY_ROOT_MANAGER_NAME_ID("root_manager_name");
+ return MY_ROOT_MANAGER_NAME_ID;
+ }
+ /// attribute name of geometry name for XAO format
+ inline static const std::string& ROOT_MANAGER_TITLE_ID()
+ {
+ static const std::string MY_ROOT_MANAGER_TITLE_ID("root_manager_title");
+ return MY_ROOT_MANAGER_TITLE_ID;
+ }
+ /// attribute name of materials file
+ inline static const std::string& MAT_FILE_ID()
+ {
+ static const std::string MY_MAT_FILE_ID("mat_file");
+ return MY_MAT_FILE_ID;
+ }
+
/// Default constructor
EXCHANGEPLUGIN_EXPORT ExchangePlugin_ExportFeature();
/// Default destructor
/// Performs export to XAO file
EXCHANGEPLUGIN_EXPORT void exportXAO(const std::string& theFileName);
+
+ /// Performs export to XAO file
+ EXCHANGEPLUGIN_EXPORT void exportROOT(const std::string& theFileName);
};
#endif /* EXPORT_EXPORTFEATURE_H_ */
--- /dev/null
+// Copyright (C) 2014-2019 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
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// 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
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#include <ExchangePlugin_ExportRoot.h>
+
+#include <ModelAPI_AttributeDouble.h>
+#include <ModelAPI_AttributeSelectionList.h>
+#include <ModelAPI_AttributeString.h>
+
+#include <CollectionPlugin_Group.h>
+#include <ExchangePlugin_Tools.h>
+#include <PrimitivesPlugin_Box.h>
+
+#include <fstream>
+#include <iostream>
+
+void ExchangePlugin_ExportRoot::readFileMat(const std::string theFileMat,
+ std::map<std::string, std::vector<std::string> >& aMat,
+ std::map<std::string, std::vector<std::string> >& aMedias)
+{
+ std::string aLine;
+ std::ifstream aFile (theFileMat);
+ if (aFile.is_open())
+ {
+ while ( getline (aFile,aLine) )
+ {
+ std::list<std::string> aList = ExchangePlugin_Tools::split(aLine, ' ');
+ std::list<std::string>::iterator itList = aList.begin();
+
+ bool isFirst = true;
+ std::string aName;
+ std::vector<std::string> aData;
+ for (; itList != aList.end(); ++itList)
+ {
+ std::string anElem = *itList;
+ if (isFirst) {
+ aName = anElem;
+ isFirst = false;
+ } else {
+ aData.push_back(anElem);
+ }
+ }
+ std::cout<<"aType :: "<<aName<<std::endl;
+ std::cout<<"aName :: "<<aData[0]<<std::endl;
+ if (aName == "mat") {
+ aMat[aData[0]] = aData;
+ } else if (aName == "medium") {
+ aMedias[aData[0]] = aData;
+ } else {
+ std::cout<<"ERROR : ToDo"<<std::endl;
+ }
+ }
+
+ aFile.close();
+ }
+ std::cout<<"Size of aMat :: "<<aMat.size()<<std::endl;
+ std::cout<<"Size of aMedias :: "<<aMedias.size()<<std::endl;
+}
+
+void ExchangePlugin_ExportRoot::computeBox(FeaturePtr theCurFeature,
+ double& OX, double& OY, double& OZ,
+ double& DX, double& DY, double& DZ)
+{
+ std::string aMethodName = theCurFeature->data()->string(PrimitivesPlugin_Box::CREATION_METHOD())->value();
+ if (aMethodName == "BoxByDimensions") {
+ DX = (theCurFeature->data()->real(PrimitivesPlugin_Box::DX_ID())->value())/2;
+ DY = (theCurFeature->data()->real(PrimitivesPlugin_Box::DY_ID())->value())/2;
+ DZ = (theCurFeature->data()->real(PrimitivesPlugin_Box::DZ_ID())->value())/2;
+ OX = DX;
+ OY = DY;
+ OZ = DZ;
+ } else if (aMethodName == "BoxByTwoPoints") {
+ // A completer
+ } else if (aMethodName == "BoxByOnePointAndDims") {
+ DX = theCurFeature->data()->real(PrimitivesPlugin_Box::HALF_DX_ID())->value();
+ DY = theCurFeature->data()->real(PrimitivesPlugin_Box::HALF_DY_ID())->value();
+ DY = theCurFeature->data()->real(PrimitivesPlugin_Box::HALF_DZ_ID())->value();
+ OX = theCurFeature->data()->real(PrimitivesPlugin_Box::OX_ID())->value();
+ OY = theCurFeature->data()->real(PrimitivesPlugin_Box::OY_ID())->value();
+ OZ = theCurFeature->data()->real(PrimitivesPlugin_Box::OZ_ID())->value();
+ }
+}
+
+void ExchangePlugin_ExportRoot::computeGroup(FeaturePtr theCurFeature,
+ std::vector<std::string>& theListNames)
+{
+ std::cout<<"COMPUTE GROUP"<<std::endl;
+ AttributeSelectionListPtr anObjectsSelList =
+ theCurFeature->data()->selectionList(CollectionPlugin_Group::LIST_ID());
+
+ for(int anObjectsIndex = 0; anObjectsIndex < anObjectsSelList->size(); anObjectsIndex++) {
+ std::shared_ptr<ModelAPI_AttributeSelection> anObjectAttr =
+ anObjectsSelList->value(anObjectsIndex);
+ ObjectPtr anObject = anObjectAttr->contextObject();
+ std::string aName = anObject->data()->name();
+ std::cout<<"NAME :: "<<aName<<std::endl;
+ theListNames.push_back(aName);
+ }
+}
--- /dev/null
+// Copyright (C) 2014-2019 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
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// 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
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#ifndef EXCHANGEPLUGIN_EXPORTROOT_H_
+#define EXCHANGEPLUGIN_EXPORTROOT_H_
+
+#include <ExchangePlugin.h>
+#include <ModelAPI_Feature.h>
+
+#include <map>
+
+/**
+ * \class ExchangePlugin_Tools
+ * \brief Internal tools for the ExchangePlugin.
+ */
+class EXCHANGEPLUGIN_EXPORT ExchangePlugin_ExportRoot {
+public:
+ /// Compute the list of materials and medias
+ static void readFileMat(const std::string theFileMat,
+ std::map<std::string, std::vector<std::string> >& aMat,
+ std::map<std::string, std::vector<std::string> >& aMedias);
+
+ /// Compute ....
+ static void computeBox(FeaturePtr theCurFeature,
+ double& OX, double& OY, double& OZ, double& DX, double& DY, double& DZ);
+
+ /// Compute ....
+ static void computeGroup(FeaturePtr theCurFeature, std::vector<std::string>& theListNames);
+};
+
+#endif /* EXCHANGEPLUGIN_EXPORTROOT_H_ */
placeholder="Please input the geometry name">
</stringvalue>
</case>
+ <case id="ROOT" title="ROOT">
+ <export_file_selector id="root_file_path"
+ type="save"
+ title="Export file"
+ path="">
+ <validator id="ExchangePlugin_ExportFormat"
+ parameters="C:root" />
+ </export_file_selector>
+ <stringvalue id="root_manager_name"
+ label="Manager name"
+ placeholder="Please input the name of the manager">
+ </stringvalue>
+ <stringvalue id="root_manager_title"
+ label="Manager title"
+ placeholder="Please input the title of the manager">
+ </stringvalue>
+ <file_selector id="mat_file" title="Materials file" path="">
+ </file_selector>
+ </case>
</switch>
</source>
GeomAlgoAPI_SolidClassifier.h
GeomAlgoAPI_MapShapesAndAncestors.h
GeomAlgoAPI_Chamfer.h
+ GeomAlgoAPI_ROOTExport.h
)
SET(PROJECT_SOURCES
GeomAlgoAPI_MapShapesAndAncestors.cpp
GeomAlgoAPI_Projection.cpp
GeomAlgoAPI_Chamfer.cpp
+ GeomAlgoAPI_ROOTExport.cpp
)
SET(PROJECT_LIBRARIES
--- /dev/null
+// Copyright (C) 2014-2019 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
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// 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
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#include <GeomAlgoAPI_ROOTExport.h>
+
+#include <OSD_OpenFile.hxx>
+
+#include <fstream>
+
+//=================================================================================================
+GeomAlgoAPI_ROOTExport::GeomAlgoAPI_ROOTExport(const std::string& theFileName)
+{
+ myFileName = theFileName;
+ myContent = "";
+}
+
+//=================================================================================================
+void GeomAlgoAPI_ROOTExport::buildHead(const std::string& theMethodName,
+ const std::string& theName,
+ const std::string& theTitle)
+{
+ std::string tmp = "void " + theMethodName + "() {\n";
+ myContent += tmp;
+ tmp = "gSystem->Load(\"libGeom\");\n";
+ myContent += tmp;
+ tmp = "TGeoManager *geom = new TGeoManager(\"" + theName + "\",\"" + theTitle +"\");\n";
+ myContent += tmp;
+}
+
+//=================================================================================================
+void GeomAlgoAPI_ROOTExport::buildBox(const std::string& theObjectName,
+ const double theOX, const double theOY, const double theOZ,
+ const double theDX, const double theDY, const double theDZ)
+{
+ std::cout<<"buildBox"<<std::endl;
+ char anOX[50], anOY[50], anOZ[50], aDX[50], aDY[50], aDZ[50];
+ sprintf(anOX, "%.f", theOX);
+ sprintf(anOY, "%.f", theOY);
+ sprintf(anOZ, "%.f", theOZ);
+ sprintf(aDX, "%.f", theDX);
+ sprintf(aDY, "%.f", theDY);
+ sprintf(aDZ, "%.f", theDZ);
+ myContent += "Double_t point_"+theObjectName+"[3] = {"+std::string(anOX)+",";
+ myContent += std::string(anOY)+","+std::string(anOZ)+"};\n";
+ myContent += "TGeoBBox* " + theObjectName + "= new TGeoBBox(\"" +theObjectName + "\",";
+ myContent += std::string(aDX)+","+std::string(aDY)+","+std::string(aDZ)+",point_";
+ myContent += theObjectName + ");\n";
+}
+
+
+//=================================================================================================
+void GeomAlgoAPI_ROOTExport::buildMatAndMedium(
+ const std::map<std::string,std::vector<std::string> > theMat,
+ const std::map<std::string, std::vector<std::string> > theMedium)
+{
+ std::map<std::string, std::vector<std::string> >::const_iterator anIt = theMat.begin(),
+ aLast = theMat.end();
+ for (; anIt != aLast; anIt++) {
+ std::vector<std::string> aValues = anIt->second;
+ myContent += "TGeoMaterial *" + anIt->first + " = new TGeoMaterial(\"";
+ myContent += aValues[1] + "\"," + aValues[2] + "," + aValues[3] + "," + aValues[4] + ") ;\n";
+ }
+
+ std::map<std::string, std::vector<std::string> >::const_iterator anIt2 = theMedium.begin(),
+ aLast2 = theMedium.end();
+ for (; anIt2 != aLast2; anIt2++) {
+ std::vector<std::string> aValues = anIt2->second;
+ myContent += "TGeoMedium *" + anIt2->first + " = new TGeoMedium(\"";
+ myContent += aValues[1] + "\"," + aValues[2] + "," + aValues[3] + ") ;\n";
+ }
+}
+
+//=================================================================================================
+void GeomAlgoAPI_ROOTExport::BuildVolume(const std::string theName,
+ const std::string theGeometryName,
+ const std::string theMediumName)
+{
+ myContent += "TGeoVolume *" + theName + " = new TGeoVolume(\"" + theName;
+ myContent += "\"," + theGeometryName + "," + theMediumName + ");\n";
+}
+
+//=================================================================================================
+void GeomAlgoAPI_ROOTExport::buildEnd()
+{
+ myContent += "}";
+}
+
+//=================================================================================================
+bool GeomAlgoAPI_ROOTExport::write()
+{
+ std::ofstream aFile;
+ std::cout<<myFileName.c_str()<<std::endl;
+ OSD_OpenStream(aFile, myFileName.c_str(), std::ofstream::out);
+ if (!aFile.is_open())
+ return false;
+
+ aFile << myContent << std::endl;
+ aFile.close();
+ return true;
+}
--- /dev/null
+// Copyright (C) 2014-2020 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
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// 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
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#ifndef GEOMALGOAPI_ROOTEXPORT_H_
+#define GEOMALGOAPI_ROOTEXPORT_H_
+
+#include <GeomAlgoAPI.h>
+
+#include <map>
+#include <string>
+#include <vector>
+
+/**\class GeomAlgoAPI_ROOTExport
+ * \ingroup DataAlgo
+ * \brief Allows to export results to a root file
+ */
+class GeomAlgoAPI_ROOTExport
+{
+public:
+ GEOMALGOAPI_EXPORT GeomAlgoAPI_ROOTExport(const std::string& theFileName);
+
+ /// Build the head of file
+ GEOMALGOAPI_EXPORT void buildHead(const std::string& theMethodName, const std::string& theName,
+ const std::string& theTitle);
+
+ /// Build box
+ GEOMALGOAPI_EXPORT void buildBox(const std::string& theObjectName,
+ const double theOX, const double theOY, const double theOZ,
+ const double theDX, const double theDY, const double theDZ);
+
+ /// Build mat and medium
+ GEOMALGOAPI_EXPORT void buildMatAndMedium(
+ const std::map<std::string,std::vector<std::string> > theMat,
+ const std::map<std::string, std::vector<std::string> > theMedium);
+
+ ///
+ GEOMALGOAPI_EXPORT void BuildVolume(const std::string theName,
+ const std::string theGeometryName,
+ const std::string theMediumName);
+
+ /// Build the end of file
+ GEOMALGOAPI_EXPORT void buildEnd();
+
+ /// Write the file
+ GEOMALGOAPI_EXPORT bool write();
+
+private:
+ std::string myFileName;
+ std::string myContent;
+};
+
+#endif /* GEOMALGOAPI_ROOTEXPORT_H_ */