1 // Copyright (C) 2014-2023 CEA, EDF
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>
36 //--------------------------------------------------------------------------------------
37 class ModelHighAPI_Selection;
38 class ModelHighAPI_Double;
39 //--------------------------------------------------------------------------------------
42 /// \class ExchangeAPI_Export
43 /// \ingroup CPPHighAPI
44 /// \brief Interface for Export feature.
45 class ExchangeAPI_Export: public ModelHighAPI_Interface
48 /// Constructor without values.
50 explicit ExchangeAPI_Export(const std::shared_ptr<ModelAPI_Feature>& theFeature);
52 /// Constructor with values for XAO export.
54 explicit ExchangeAPI_Export(const std::shared_ptr<ModelAPI_Feature>& theFeature,
55 const std::string & theFilePath,
56 const std::string & theAuthor = std::string(),
57 const std::string & theGeometryName = std::string());
59 /// Constructor with values for STL of selected result export.
61 explicit ExchangeAPI_Export(const std::shared_ptr<ModelAPI_Feature>& theFeature,
62 const std::string & theFilePath,
63 const ModelHighAPI_Selection& theSelectedShape,
64 const ModelHighAPI_Double& theDeflectionRelative ,
65 const ModelHighAPI_Double& theDeflectionAbsolute,
66 const bool theIsRelative,
67 const bool theIsASCII);
69 /// Constructor with values for XAO of selected result export.
71 explicit ExchangeAPI_Export(const std::shared_ptr<ModelAPI_Feature>& theFeature,
72 const std::string & theFilePath,
73 const ModelHighAPI_Selection& theResult,
74 const std::string & theAuthor,
75 const std::string & theGeometryName = std::string());
77 /// Constructor with values for XAO of selected result export to memory buffer.
79 explicit ExchangeAPI_Export(const std::shared_ptr<ModelAPI_Feature>& theFeature,
80 const ModelHighAPI_Selection& theResult,
81 const std::string & theAuthor,
82 const std::string & theGeometryName = std::string());
84 /// Constructor with values for export in other formats than XAO.
86 explicit ExchangeAPI_Export(const std::shared_ptr<ModelAPI_Feature>& theFeature,
87 const std::string & theFilePath,
88 const std::list<ModelHighAPI_Selection> & theSelectionList,
89 const std::string & theFileFormat = std::string());
93 virtual ~ExchangeAPI_Export();
95 INTERFACE_16(ExchangePlugin_ExportFeature::ID(),
96 exportType, ExchangePlugin_ExportFeature::EXPORT_TYPE_ID(),
97 ModelAPI_AttributeString, /** ExportType */,
98 filePath, ExchangePlugin_ExportFeature::FILE_PATH_ID(),
99 ModelAPI_AttributeString, /** file path */,
100 xaoFilePath, ExchangePlugin_ExportFeature::XAO_FILE_PATH_ID(),
101 ModelAPI_AttributeString, /** xao_file_path */,
102 fileFormat, ExchangePlugin_ExportFeature::FILE_FORMAT_ID(),
103 ModelAPI_AttributeString, /** file format */,
104 selectionList, ExchangePlugin_ExportFeature::SELECTION_LIST_ID(),
105 ModelAPI_AttributeString, /** selection list */,
106 xaoAuthor, ExchangePlugin_ExportFeature::XAO_AUTHOR_ID(),
107 ModelAPI_AttributeString, /** xao author */,
108 xaoGeometryName, ExchangePlugin_ExportFeature::XAO_GEOMETRY_NAME_ID(),
109 ModelAPI_AttributeString, /** xao geometry name */,
110 stlFilePath, ExchangePlugin_ExportFeature::STL_FILE_PATH_ID(),
111 ModelAPI_AttributeString, /** stl_file_path */,
112 stlobjectselected, ExchangePlugin_ExportFeature::STL_OBJECT_SELECTED(),
113 ModelAPI_AttributeSelection, /** Object selected to export in stl file*/,
114 stldeflectionType, ExchangePlugin_ExportFeature::STL_DEFLECTION_TYPE(),
115 ModelAPI_AttributeString, /** Type of the defelection */,
116 stlrelative, ExchangePlugin_ExportFeature::STL_RELATIVE(),
117 ModelAPI_AttributeDouble, /** Relative*/,
118 stlabsolute, ExchangePlugin_ExportFeature::STL_ABSOLUTE(),
119 ModelAPI_AttributeDouble, /** Absolute */,
120 stlfileType, ExchangePlugin_ExportFeature::STL_FILE_TYPE(),
121 ModelAPI_AttributeString, /** Type of the stl file*/,
122 stldeflectionTypeabsolute,
123 ExchangePlugin_ExportFeature::STL_DEFLECTION_TYPE_ABSOLUTE(),
124 ModelAPI_AttributeString, /** Type of the defelection */,
125 stldeflectionTyperelative,
126 ExchangePlugin_ExportFeature::STL_DEFLECTION_TYPE_RELATIVE(),
127 ModelAPI_AttributeString, /** Type of the defelection */,
128 memoryBuff, ExchangePlugin_ExportFeature::MEMORY_BUFFER_ID(),
129 ModelAPI_AttributeString, /** Bytes*/)
131 /// Dump wrapped feature
133 virtual void dump(ModelHighAPI_Dumper& theDumper) const;
136 /// Pointer on Export object
137 typedef std::shared_ptr<ExchangeAPI_Export> ExportPtr;
139 /**\ingroup CPPHighAPI
140 * \brief Export to file
143 ExportPtr exportToFile(const std::shared_ptr<ModelAPI_Document> & thePart,
144 const std::string & theFilePath,
145 const std::list<ModelHighAPI_Selection> & theSelectionList,
146 const std::string & theFileFormat = std::string());
148 /**\ingroup CPPHighAPI
149 * \brief Exports to XAO file all results of the current document
152 ExportPtr exportToXAO(const std::shared_ptr<ModelAPI_Document> & thePart,
153 const std::string & theFilePath,
154 const std::string & theAuthor = std::string(),
155 const std::string & theGeometryName = std::string());
157 /**\ingroup CPPHighAPI
158 * \brief Exports to STL file the result of the current document
161 ExportPtr exportToSTL(const std::shared_ptr<ModelAPI_Document> & thePart,
162 const std::string & theFilePath,
163 const ModelHighAPI_Selection& theSelectedShape,
164 const ModelHighAPI_Double& theDeflectionRelative,
165 const ModelHighAPI_Double& theDeflectionAbsolute,
166 const bool theIsRelative,
167 const bool theIsASCII);
169 /**\ingroup CPPHighAPI
170 * \brief Exports to XAO file the selected result with groups parts related to it only.
173 ExportPtr exportToXAO(const std::shared_ptr<ModelAPI_Document> & thePart,
174 const std::string & theFilePath,
175 const ModelHighAPI_Selection& theSelectedShape,
176 const std::string & theAuthor = std::string(),
177 const std::string & theGeometryName = std::string());
179 /**\ingroup CPPHighAPI
180 * \brief Exports to XAO format buffer the selected result with groups parts related to it only.
183 PyObject* exportToXAOMem(const std::shared_ptr<ModelAPI_Document> & thePart,
184 const ModelHighAPI_Selection& theSelectedShape,
185 const std::string & theAuthor = std::string(),
186 const std::string & theGeometryName = std::string());
189 /** \ingroup CPPHighAPI
190 * \brief Export selected features or the whole part to the binary file.
192 EXCHANGEAPI_EXPORT void exportPart(
193 const std::shared_ptr<ModelAPI_Document> & thePart,
194 const std::string & theFilePath,
195 const std::list<ModelHighAPI_Selection> & theSelected = std::list<ModelHighAPI_Selection>());
197 //--------------------------------------------------------------------------------------
198 //--------------------------------------------------------------------------------------
199 #endif /* SRC_EXCHANGEAPI_EXCHANGEAPI_EXPORT_H_ */