1 // Copyright (C) 2014-2024 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(),
58 const std::string & theShapeFilePath = std::string());
60 /// Constructor with values for STL of selected result export.
62 explicit ExchangeAPI_Export(const std::shared_ptr<ModelAPI_Feature>& theFeature,
63 const std::string & theFilePath,
64 const ModelHighAPI_Selection& theSelectedShape,
65 const ModelHighAPI_Double& theDeflectionRelative ,
66 const ModelHighAPI_Double& theDeflectionAbsolute,
67 const bool theIsRelative,
68 const bool theIsASCII);
70 /// Constructor with values for XAO of selected result export.
72 explicit ExchangeAPI_Export(const std::shared_ptr<ModelAPI_Feature>& theFeature,
73 const std::string & theFilePath,
74 const ModelHighAPI_Selection& theResult,
75 const std::string & theAuthor,
76 const std::string & theGeometryName = std::string(),
77 const std::string & theShapeFilePath = std::string());
79 /// Constructor with values for XAO of selected result export to memory buffer.
81 explicit ExchangeAPI_Export(const std::shared_ptr<ModelAPI_Feature>& theFeature,
82 const ModelHighAPI_Selection& theResult,
83 const std::string & theAuthor,
84 const std::string & theGeometryName = std::string());
86 /// Constructor with values for export in other formats than XAO.
88 explicit ExchangeAPI_Export(const std::shared_ptr<ModelAPI_Feature>& theFeature,
89 const std::string & theFilePath,
90 const std::list<ModelHighAPI_Selection> & theSelectionList,
91 const std::string & theFileFormat = std::string());
95 virtual ~ExchangeAPI_Export();
97 INTERFACE_17(ExchangePlugin_ExportFeature::ID(),
98 exportType, ExchangePlugin_ExportFeature::EXPORT_TYPE_ID(),
99 ModelAPI_AttributeString, /** ExportType */,
100 filePath, ExchangePlugin_ExportFeature::FILE_PATH_ID(),
101 ModelAPI_AttributeString, /** file path */,
102 xaoFilePath, ExchangePlugin_ExportFeature::XAO_FILE_PATH_ID(),
103 ModelAPI_AttributeString, /** xao_file_path */,
104 fileFormat, ExchangePlugin_ExportFeature::FILE_FORMAT_ID(),
105 ModelAPI_AttributeString, /** file format */,
106 selectionList, ExchangePlugin_ExportFeature::SELECTION_LIST_ID(),
107 ModelAPI_AttributeString, /** selection list */,
108 xaoAuthor, ExchangePlugin_ExportFeature::XAO_AUTHOR_ID(),
109 ModelAPI_AttributeString, /** xao author */,
110 xaoGeometryName, ExchangePlugin_ExportFeature::XAO_GEOMETRY_NAME_ID(),
111 ModelAPI_AttributeString, /** xao geometry name */,
112 stlFilePath, ExchangePlugin_ExportFeature::STL_FILE_PATH_ID(),
113 ModelAPI_AttributeString, /** stl_file_path */,
114 stlobjectselected, ExchangePlugin_ExportFeature::STL_OBJECT_SELECTED(),
115 ModelAPI_AttributeSelection, /** Object selected to export in stl file*/,
116 stldeflectionType, ExchangePlugin_ExportFeature::STL_DEFLECTION_TYPE(),
117 ModelAPI_AttributeString, /** Type of the defelection */,
118 stlrelative, ExchangePlugin_ExportFeature::STL_RELATIVE(),
119 ModelAPI_AttributeDouble, /** Relative*/,
120 stlabsolute, ExchangePlugin_ExportFeature::STL_ABSOLUTE(),
121 ModelAPI_AttributeDouble, /** Absolute */,
122 stlfileType, ExchangePlugin_ExportFeature::STL_FILE_TYPE(),
123 ModelAPI_AttributeString, /** Type of the stl file*/,
124 stldeflectionTypeabsolute,
125 ExchangePlugin_ExportFeature::STL_DEFLECTION_TYPE_ABSOLUTE(),
126 ModelAPI_AttributeString, /** Type of the defelection */,
127 stldeflectionTyperelative,
128 ExchangePlugin_ExportFeature::STL_DEFLECTION_TYPE_RELATIVE(),
129 ModelAPI_AttributeString, /** Type of the defelection */,
130 memoryBuff, ExchangePlugin_ExportFeature::MEMORY_BUFFER_ID(),
131 ModelAPI_AttributeString, /** Bytes*/,
132 xaoShapeFilePath, ExchangePlugin_ExportFeature::XAO_SHAPE_FILE_PATH_ID(),
133 ModelAPI_AttributeString, /** xao shape file path */)
135 /// Dump wrapped feature
137 virtual void dump(ModelHighAPI_Dumper& theDumper) const;
140 /// Pointer on Export object
141 typedef std::shared_ptr<ExchangeAPI_Export> ExportPtr;
143 /**\ingroup CPPHighAPI
144 * \brief Export to file
147 ExportPtr exportToFile(const std::shared_ptr<ModelAPI_Document> & thePart,
148 const std::string & theFilePath,
149 const std::list<ModelHighAPI_Selection> & theSelectionList,
150 const std::string & theFileFormat = std::string());
152 /**\ingroup CPPHighAPI
153 * \brief Exports to XAO file all results of the current document
156 ExportPtr exportToXAO(const std::shared_ptr<ModelAPI_Document> & thePart,
157 const std::string & theFilePath,
158 const std::string & theAuthor = std::string(),
159 const std::string & theGeometryName = std::string(),
160 const std::string & theShapeFilePath = std::string());
162 /**\ingroup CPPHighAPI
163 * \brief Exports to STL file the result of the current document
166 ExportPtr exportToSTL(const std::shared_ptr<ModelAPI_Document> & thePart,
167 const std::string & theFilePath,
168 const ModelHighAPI_Selection& theSelectedShape,
169 const ModelHighAPI_Double& theDeflectionRelative,
170 const ModelHighAPI_Double& theDeflectionAbsolute,
171 const bool theIsRelative,
172 const bool theIsASCII);
174 /**\ingroup CPPHighAPI
175 * \brief Exports to XAO file the selected result with groups parts related to it only.
178 ExportPtr exportToXAO(const std::shared_ptr<ModelAPI_Document> & thePart,
179 const std::string & theFilePath,
180 const ModelHighAPI_Selection& theSelectedShape,
181 const std::string & theAuthor = std::string(),
182 const std::string & theGeometryName = std::string(),
183 const std::string & theShapeFilePath = std::string());
185 /**\ingroup CPPHighAPI
186 * \brief Exports to XAO format buffer the selected result with groups parts related to it only.
189 PyObject* exportToXAOMem(const std::shared_ptr<ModelAPI_Document> & thePart,
190 const ModelHighAPI_Selection& theSelectedShape,
191 const std::string & theAuthor = std::string(),
192 const std::string & theGeometryName = std::string());
195 /** \ingroup CPPHighAPI
196 * \brief Export selected features or the whole part to the binary file.
198 EXCHANGEAPI_EXPORT void exportPart(
199 const std::shared_ptr<ModelAPI_Document> & thePart,
200 const std::string & theFilePath,
201 const std::list<ModelHighAPI_Selection> & theSelected = std::list<ModelHighAPI_Selection>());
203 //--------------------------------------------------------------------------------------
204 //--------------------------------------------------------------------------------------
205 #endif /* SRC_EXCHANGEAPI_EXCHANGEAPI_EXPORT_H_ */