]> SALOME platform Git repositories - modules/shaper.git/blob - src/ExchangeAPI/ExchangeAPI_Export.h
Salome HOME
[bos #37570] [CEA] SHAPER hdf tests are failing. Fix Sphere feature attributes order.
[modules/shaper.git] / src / ExchangeAPI / ExchangeAPI_Export.h
1 // Copyright (C) 2014-2023  CEA, EDF
2 //
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.
7 //
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.
12 //
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
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19
20 #ifndef SRC_EXCHANGEAPI_EXCHANGEAPI_EXPORT_H_
21 #define SRC_EXCHANGEAPI_EXCHANGEAPI_EXPORT_H_
22
23 //--------------------------------------------------------------------------------------
24 #include "ExchangeAPI.h"
25
26 #include <list>
27 #include <string>
28
29 #include <ModelHighAPI_Interface.h>
30 #include <ModelHighAPI_Macro.h>
31
32 #include <ExchangePlugin_ExportFeature.h>
33
34 #include <Python.h>
35
36 //--------------------------------------------------------------------------------------
37 class ModelHighAPI_Selection;
38 class ModelHighAPI_Double;
39 //--------------------------------------------------------------------------------------
40
41
42 /// \class ExchangeAPI_Export
43 /// \ingroup CPPHighAPI
44 /// \brief Interface for Export feature.
45 class ExchangeAPI_Export: public ModelHighAPI_Interface
46 {
47 public:
48   /// Constructor without values.
49   EXCHANGEAPI_EXPORT
50   explicit ExchangeAPI_Export(const std::shared_ptr<ModelAPI_Feature>& theFeature);
51
52   /// Constructor with values for XAO export.
53   EXCHANGEAPI_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
59   /// Constructor with values for STL of selected result export.
60   EXCHANGEAPI_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);
68
69   /// Constructor with values for XAO of selected result export.
70   EXCHANGEAPI_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());
76
77   /// Constructor with values for XAO of selected result export to memory buffer.
78   EXCHANGEAPI_EXPORT
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());
83
84   /// Constructor with values for export in other formats than XAO.
85   EXCHANGEAPI_EXPORT
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());
90
91   /// Destructor.
92   EXCHANGEAPI_EXPORT
93   virtual ~ExchangeAPI_Export();
94
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*/)
130
131   /// Dump wrapped feature
132   EXCHANGEAPI_EXPORT
133   virtual void dump(ModelHighAPI_Dumper& theDumper) const;
134 };
135
136 /// Pointer on Export object
137 typedef std::shared_ptr<ExchangeAPI_Export> ExportPtr;
138
139 /**\ingroup CPPHighAPI
140  * \brief Export to file
141  */
142 EXCHANGEAPI_EXPORT
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());
147
148 /**\ingroup CPPHighAPI
149  * \brief Exports to XAO file all results of the current document
150  */
151 EXCHANGEAPI_EXPORT
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());
156
157 /**\ingroup CPPHighAPI
158  * \brief Exports to STL file the result of the current document
159  */
160 EXCHANGEAPI_EXPORT
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);
168
169 /**\ingroup CPPHighAPI
170 * \brief Exports to XAO file the selected result with groups parts related to it only.
171 */
172 EXCHANGEAPI_EXPORT
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());
178
179 /**\ingroup CPPHighAPI
180 * \brief Exports to XAO format buffer the selected result with groups parts related to it only.
181 */
182 EXCHANGEAPI_EXPORT
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());
187
188
189 /** \ingroup CPPHighAPI
190  *  \brief Export selected features or the whole part to the binary file.
191  */
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>());
196
197 //--------------------------------------------------------------------------------------
198 //--------------------------------------------------------------------------------------
199 #endif /* SRC_EXCHANGEAPI_EXCHANGEAPI_EXPORT_H_ */