1 // Copyright (C) 2014-2020 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #ifndef SRC_EXCHANGEAPI_EXCHANGEAPI_EXPORT_H_
21 #define SRC_EXCHANGEAPI_EXCHANGEAPI_EXPORT_H_
23 //--------------------------------------------------------------------------------------
24 #include "ExchangeAPI.h"
29 #include <ModelHighAPI_Interface.h>
30 #include <ModelHighAPI_Macro.h>
32 #include <ExchangePlugin_ExportFeature.h>
33 //--------------------------------------------------------------------------------------
34 class ModelHighAPI_Selection;
35 //--------------------------------------------------------------------------------------
38 /// \class ExchangeAPI_Export
39 /// \ingroup CPPHighAPI
40 /// \brief Interface for Export feature.
41 class ExchangeAPI_Export: public ModelHighAPI_Interface
44 /// Constructor without values.
46 explicit ExchangeAPI_Export(const std::shared_ptr<ModelAPI_Feature>& theFeature);
48 /// Constructor with values for XAO export.
50 explicit ExchangeAPI_Export(const std::shared_ptr<ModelAPI_Feature>& theFeature,
51 const std::string & theFilePath,
52 const std::string & theAuthor = std::string(),
53 const std::string & theGeometryName = std::string());
55 /// Constructor with values for STL of selected result export.
57 explicit ExchangeAPI_Export(const std::shared_ptr<ModelAPI_Feature>& theFeature,
58 const std::string & theFilePath,
59 const ModelHighAPI_Selection& theSelectedShape,
60 double aDeflectionRelative ,
61 double aDeflectionAbsolute,
62 const bool anIsRelative,
63 const bool anIsASCII);
65 /// Constructor with values for XAO of selected result export.
67 explicit ExchangeAPI_Export(const std::shared_ptr<ModelAPI_Feature>& theFeature,
68 const std::string & theFilePath,
69 const ModelHighAPI_Selection& theResult,
70 const std::string & theAuthor,
71 const std::string & theGeometryName = std::string());
73 /// Constructor with values for export in other formats than XAO.
75 explicit ExchangeAPI_Export(const std::shared_ptr<ModelAPI_Feature>& theFeature,
76 const std::string & theFilePath,
77 const std::list<ModelHighAPI_Selection> & theSelectionList,
78 const std::string & theFileFormat = std::string());
82 virtual ~ExchangeAPI_Export();
84 INTERFACE_15(ExchangePlugin_ExportFeature::ID(),
85 exportType, ExchangePlugin_ExportFeature::EXPORT_TYPE_ID(),
86 ModelAPI_AttributeString, /** ExportType */,
87 filePath, ExchangePlugin_ExportFeature::FILE_PATH_ID(),
88 ModelAPI_AttributeString, /** file path */,
89 xaoFilePath, ExchangePlugin_ExportFeature::XAO_FILE_PATH_ID(),
90 ModelAPI_AttributeString, /** xao_file_path */,
91 fileFormat, ExchangePlugin_ExportFeature::FILE_FORMAT_ID(),
92 ModelAPI_AttributeString, /** file format */,
93 selectionList, ExchangePlugin_ExportFeature::SELECTION_LIST_ID(),
94 ModelAPI_AttributeString, /** selection list */,
95 xaoAuthor, ExchangePlugin_ExportFeature::XAO_AUTHOR_ID(),
96 ModelAPI_AttributeString, /** xao author */,
97 xaoGeometryName, ExchangePlugin_ExportFeature::XAO_GEOMETRY_NAME_ID(),
98 ModelAPI_AttributeString, /** xao geometry name */,
99 stlFilePath, ExchangePlugin_ExportFeature::STL_FILE_PATH_ID(),
100 ModelAPI_AttributeString, /** stl_file_path */,
101 stlobjectselected, ExchangePlugin_ExportFeature::STL_OBJECT_SELECTED(),
102 ModelAPI_AttributeSelection, /** Object selected to export in stl file*/,
103 stldeflectionType, ExchangePlugin_ExportFeature::STL_DEFLECTION_TYPE(),
104 ModelAPI_AttributeString, /** Type of the defelection */,
105 stlrelative, ExchangePlugin_ExportFeature::STL_RELATIVE(),
106 ModelAPI_AttributeDouble, /** Relative*/,
107 stlabsolute, ExchangePlugin_ExportFeature::STL_ABSOLUTE(),
108 ModelAPI_AttributeDouble, /** Absolute */,
109 stlfileType, ExchangePlugin_ExportFeature::STL_FILE_TYPE(),
110 ModelAPI_AttributeString, /** Type of the stl file*/,
111 stldeflectionTypeabsolute, ExchangePlugin_ExportFeature::STL_DEFLECTION_TYPE_ABSOLUTE(),
112 ModelAPI_AttributeString, /** Type of the defelection */,
113 stldeflectionTyperelative, ExchangePlugin_ExportFeature::STL_DEFLECTION_TYPE_RELATIVE(),
114 ModelAPI_AttributeString, /** Type of the defelection */)
116 /// Dump wrapped feature
118 virtual void dump(ModelHighAPI_Dumper& theDumper) const;
121 /// Pointer on Export object
122 typedef std::shared_ptr<ExchangeAPI_Export> ExportPtr;
124 /**\ingroup CPPHighAPI
125 * \brief Export to file
128 ExportPtr exportToFile(const std::shared_ptr<ModelAPI_Document> & thePart,
129 const std::string & theFilePath,
130 const std::list<ModelHighAPI_Selection> & theSelectionList,
131 const std::string & theFileFormat = std::string());
133 /**\ingroup CPPHighAPI
134 * \brief Exports to XAO file all results of the current document
137 ExportPtr exportToXAO(const std::shared_ptr<ModelAPI_Document> & thePart,
138 const std::string & theFilePath,
139 const std::string & theAuthor = std::string(),
140 const std::string & theGeometryName = std::string());
142 /**\ingroup CPPHighAPI
143 * \brief Exports to STL file the result of the current document
146 ExportPtr exportToSTL(const std::shared_ptr<ModelAPI_Document> & thePart,
147 const std::string & theFilePath,
148 const ModelHighAPI_Selection& theSelectedShape,
149 double aDeflectionRelative,
150 double aDeflectionAbsolute,
151 const bool anIsRelative,
152 const bool anIsASCII);
154 /**\ingroup CPPHighAPI
155 * \brief Exports to XAO file the selected result with groups parts related to it only.
158 ExportPtr exportToXAO(const std::shared_ptr<ModelAPI_Document> & thePart,
159 const std::string & theFilePath,
160 const ModelHighAPI_Selection& theSelectedShape,
161 const std::string & theAuthor = std::string(),
162 const std::string & theGeometryName = std::string());
165 /** \ingroup CPPHighAPI
166 * \brief Export selected features or the whole part to the binary file.
168 EXCHANGEAPI_EXPORT void exportPart(
169 const std::shared_ptr<ModelAPI_Document> & thePart,
170 const std::string & theFilePath,
171 const std::list<ModelHighAPI_Selection> & theSelected = std::list<ModelHighAPI_Selection>());
173 //--------------------------------------------------------------------------------------
174 //--------------------------------------------------------------------------------------
175 #endif /* SRC_EXCHANGEAPI_EXCHANGEAPI_EXPORT_H_ */