Salome HOME
Merge remote-tracking branch 'remotes/origin/CEA_2020/Lot1_Export_STL' into CEA_2020_Lot1
[modules/shaper.git] / src / ExchangeAPI / ExchangeAPI_Export.h
1 // Copyright (C) 2014-2020  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 //--------------------------------------------------------------------------------------
36
37
38 /// \class ExchangeAPI_Export
39 /// \ingroup CPPHighAPI
40 /// \brief Interface for Export feature.
41 class ExchangeAPI_Export: public ModelHighAPI_Interface
42 {
43 public:
44   /// Constructor without values.
45   EXCHANGEAPI_EXPORT
46   explicit ExchangeAPI_Export(const std::shared_ptr<ModelAPI_Feature>& theFeature);
47
48   /// Constructor with values for XAO export.
49   EXCHANGEAPI_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());
54   
55   /// Constructor with values for STL of selected result export.
56   EXCHANGEAPI_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);
64
65   /// Constructor with values for XAO of selected result export.
66   EXCHANGEAPI_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());
72
73   /// Constructor with values for export in other formats than XAO.
74   EXCHANGEAPI_EXPORT
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());
79
80   /// Destructor.
81   EXCHANGEAPI_EXPORT
82   virtual ~ExchangeAPI_Export();
83
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 */)
115
116   /// Dump wrapped feature
117   EXCHANGEAPI_EXPORT
118   virtual void dump(ModelHighAPI_Dumper& theDumper) const;
119 };
120
121 /// Pointer on Export object
122 typedef std::shared_ptr<ExchangeAPI_Export> ExportPtr;
123
124 /**\ingroup CPPHighAPI
125  * \brief Export to file
126  */
127 EXCHANGEAPI_EXPORT
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());
132
133 /**\ingroup CPPHighAPI
134  * \brief Exports to XAO file all results of the current document
135  */
136 EXCHANGEAPI_EXPORT
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());
141
142 /**\ingroup CPPHighAPI
143  * \brief Exports to STL file the result of the current document
144  */
145 EXCHANGEAPI_EXPORT
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);
153
154 /**\ingroup CPPHighAPI
155 * \brief Exports to XAO file the selected result with groups parts related to it only.
156 */
157 EXCHANGEAPI_EXPORT
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());
163
164
165 /** \ingroup CPPHighAPI
166  *  \brief Export selected features or the whole part to the binary file.
167  */
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>());
172
173 //--------------------------------------------------------------------------------------
174 //--------------------------------------------------------------------------------------
175 #endif /* SRC_EXCHANGEAPI_EXCHANGEAPI_EXPORT_H_ */