Salome HOME
updated copyright message
[modules/shaper.git] / src / ExchangeAPI / ExchangeAPI_Export.h
1 // Copyright (C) 2014-2023  CEA/DEN, EDF R&D
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 class ModelHighAPI_Selection;
35 class ModelHighAPI_Double;
36 //--------------------------------------------------------------------------------------
37
38
39 /// \class ExchangeAPI_Export
40 /// \ingroup CPPHighAPI
41 /// \brief Interface for Export feature.
42 class ExchangeAPI_Export: public ModelHighAPI_Interface
43 {
44 public:
45   /// Constructor without values.
46   EXCHANGEAPI_EXPORT
47   explicit ExchangeAPI_Export(const std::shared_ptr<ModelAPI_Feature>& theFeature);
48
49   /// Constructor with values for XAO export.
50   EXCHANGEAPI_EXPORT
51   explicit ExchangeAPI_Export(const std::shared_ptr<ModelAPI_Feature>& theFeature,
52                               const std::string & theFilePath,
53                               const std::string & theAuthor = std::string(),
54                               const std::string & theGeometryName = std::string());
55
56   /// Constructor with values for STL of selected result export.
57   EXCHANGEAPI_EXPORT
58     explicit ExchangeAPI_Export(const std::shared_ptr<ModelAPI_Feature>& theFeature,
59                                 const std::string & theFilePath,
60                                 const ModelHighAPI_Selection& theSelectedShape,
61                                 const ModelHighAPI_Double&  theDeflectionRelative ,
62                                 const ModelHighAPI_Double&  theDeflectionAbsolute,
63                                 const bool theIsRelative,
64                                 const bool theIsASCII);
65
66   /// Constructor with values for XAO of selected result export.
67   EXCHANGEAPI_EXPORT
68     explicit ExchangeAPI_Export(const std::shared_ptr<ModelAPI_Feature>& theFeature,
69       const std::string & theFilePath,
70       const ModelHighAPI_Selection& theResult,
71       const std::string & theAuthor,
72       const std::string & theGeometryName = std::string());
73
74   /// Constructor with values for export in other formats than XAO.
75   EXCHANGEAPI_EXPORT
76   explicit ExchangeAPI_Export(const std::shared_ptr<ModelAPI_Feature>& theFeature,
77                               const std::string & theFilePath,
78                               const std::list<ModelHighAPI_Selection> & theSelectionList,
79                               const std::string & theFileFormat = std::string());
80
81   /// Destructor.
82   EXCHANGEAPI_EXPORT
83   virtual ~ExchangeAPI_Export();
84
85   INTERFACE_15(ExchangePlugin_ExportFeature::ID(),
86              exportType, ExchangePlugin_ExportFeature::EXPORT_TYPE_ID(),
87              ModelAPI_AttributeString, /** ExportType */,
88              filePath, ExchangePlugin_ExportFeature::FILE_PATH_ID(),
89              ModelAPI_AttributeString, /** file path */,
90              xaoFilePath, ExchangePlugin_ExportFeature::XAO_FILE_PATH_ID(),
91              ModelAPI_AttributeString, /** xao_file_path */,
92              fileFormat, ExchangePlugin_ExportFeature::FILE_FORMAT_ID(),
93              ModelAPI_AttributeString, /** file format */,
94              selectionList, ExchangePlugin_ExportFeature::SELECTION_LIST_ID(),
95              ModelAPI_AttributeString, /** selection list */,
96              xaoAuthor, ExchangePlugin_ExportFeature::XAO_AUTHOR_ID(),
97              ModelAPI_AttributeString, /** xao author */,
98              xaoGeometryName, ExchangePlugin_ExportFeature::XAO_GEOMETRY_NAME_ID(),
99              ModelAPI_AttributeString, /** xao geometry name */,
100              stlFilePath, ExchangePlugin_ExportFeature::STL_FILE_PATH_ID(),
101              ModelAPI_AttributeString, /** stl_file_path */,
102              stlobjectselected, ExchangePlugin_ExportFeature::STL_OBJECT_SELECTED(),
103              ModelAPI_AttributeSelection, /** Object selected to export in stl file*/,
104              stldeflectionType, ExchangePlugin_ExportFeature::STL_DEFLECTION_TYPE(),
105              ModelAPI_AttributeString, /** Type of the defelection */,
106              stlrelative, ExchangePlugin_ExportFeature::STL_RELATIVE(),
107              ModelAPI_AttributeDouble, /** Relative*/,
108              stlabsolute, ExchangePlugin_ExportFeature::STL_ABSOLUTE(),
109              ModelAPI_AttributeDouble, /** Absolute */,
110              stlfileType, ExchangePlugin_ExportFeature::STL_FILE_TYPE(),
111              ModelAPI_AttributeString, /** Type of the stl file*/,
112              stldeflectionTypeabsolute,
113                       ExchangePlugin_ExportFeature::STL_DEFLECTION_TYPE_ABSOLUTE(),
114              ModelAPI_AttributeString, /** Type of the defelection */,
115              stldeflectionTyperelative,
116                       ExchangePlugin_ExportFeature::STL_DEFLECTION_TYPE_RELATIVE(),
117              ModelAPI_AttributeString, /** Type of the defelection */)
118
119   /// Dump wrapped feature
120   EXCHANGEAPI_EXPORT
121   virtual void dump(ModelHighAPI_Dumper& theDumper) const;
122 };
123
124 /// Pointer on Export object
125 typedef std::shared_ptr<ExchangeAPI_Export> ExportPtr;
126
127 /**\ingroup CPPHighAPI
128  * \brief Export to file
129  */
130 EXCHANGEAPI_EXPORT
131 ExportPtr exportToFile(const std::shared_ptr<ModelAPI_Document> & thePart,
132                   const std::string & theFilePath,
133                   const std::list<ModelHighAPI_Selection> & theSelectionList,
134                   const std::string & theFileFormat = std::string());
135
136 /**\ingroup CPPHighAPI
137  * \brief Exports to XAO file all results of the current document
138  */
139 EXCHANGEAPI_EXPORT
140 ExportPtr exportToXAO(const std::shared_ptr<ModelAPI_Document> & thePart,
141                  const std::string & theFilePath,
142                  const std::string & theAuthor = std::string(),
143                  const std::string & theGeometryName = std::string());
144
145 /**\ingroup CPPHighAPI
146  * \brief Exports to STL file the result of the current document
147  */
148 EXCHANGEAPI_EXPORT
149 ExportPtr exportToSTL(const std::shared_ptr<ModelAPI_Document> & thePart,
150                       const std::string & theFilePath,
151                       const ModelHighAPI_Selection& theSelectedShape,
152                       const ModelHighAPI_Double&  theDeflectionRelative,
153                       const ModelHighAPI_Double&  theDeflectionAbsolute,
154                       const bool theIsRelative,
155                       const bool theIsASCII);
156
157 /**\ingroup CPPHighAPI
158 * \brief Exports to XAO file the selected result with groups parts related to it only.
159 */
160 EXCHANGEAPI_EXPORT
161 ExportPtr exportToXAO(const std::shared_ptr<ModelAPI_Document> & thePart,
162   const std::string & theFilePath,
163   const ModelHighAPI_Selection& theSelectedShape,
164   const std::string & theAuthor = std::string(),
165   const std::string & theGeometryName = std::string());
166
167
168 /** \ingroup CPPHighAPI
169  *  \brief Export selected features or the whole part to the binary file.
170  */
171 EXCHANGEAPI_EXPORT void exportPart(
172     const std::shared_ptr<ModelAPI_Document> & thePart,
173     const std::string & theFilePath,
174     const std::list<ModelHighAPI_Selection> & theSelected = std::list<ModelHighAPI_Selection>());
175
176 //--------------------------------------------------------------------------------------
177 //--------------------------------------------------------------------------------------
178 #endif /* SRC_EXCHANGEAPI_EXCHANGEAPI_EXPORT_H_ */