1 // Copyright (C) 2014-2020 CEA/DEN, EDF R&D
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>
33 //--------------------------------------------------------------------------------------
34 class ModelHighAPI_Selection;
35 //--------------------------------------------------------------------------------------
38 /// \class ExchangeAPI_Export
39 /// \ingroup CPPHighAPI
40 /// \brief Interface for Export feature.
41 class ExchangeAPI_Export: public ModelHighAPI_Interface
44 /// Constructor without values.
46 explicit ExchangeAPI_Export(const std::shared_ptr<ModelAPI_Feature>& theFeature);
48 /// Constructor with values for XAO 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());
55 /// Constructor with values for STL of selected result 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);
65 /// Constructor with values for XAO of selected result 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());
73 /// Constructor with values for export in other formats than XAO.
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());
82 virtual ~ExchangeAPI_Export();
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,
112 ExchangePlugin_ExportFeature::STL_DEFLECTION_TYPE_ABSOLUTE(),
113 ModelAPI_AttributeString, /** Type of the defelection */,
114 stldeflectionTyperelative,
115 ExchangePlugin_ExportFeature::STL_DEFLECTION_TYPE_RELATIVE(),
116 ModelAPI_AttributeString, /** Type of the defelection */)
118 /// Dump wrapped feature
120 virtual void dump(ModelHighAPI_Dumper& theDumper) const;
123 /// Pointer on Export object
124 typedef std::shared_ptr<ExchangeAPI_Export> ExportPtr;
126 /**\ingroup CPPHighAPI
127 * \brief Export to file
130 ExportPtr exportToFile(const std::shared_ptr<ModelAPI_Document> & thePart,
131 const std::string & theFilePath,
132 const std::list<ModelHighAPI_Selection> & theSelectionList,
133 const std::string & theFileFormat = std::string());
135 /**\ingroup CPPHighAPI
136 * \brief Exports to XAO file all results of the current document
139 ExportPtr exportToXAO(const std::shared_ptr<ModelAPI_Document> & thePart,
140 const std::string & theFilePath,
141 const std::string & theAuthor = std::string(),
142 const std::string & theGeometryName = std::string());
144 /**\ingroup CPPHighAPI
145 * \brief Exports to STL file the result of the current document
148 ExportPtr exportToSTL(const std::shared_ptr<ModelAPI_Document> & thePart,
149 const std::string & theFilePath,
150 const ModelHighAPI_Selection& theSelectedShape,
151 double aDeflectionRelative,
152 double aDeflectionAbsolute,
153 const bool anIsRelative,
154 const bool anIsASCII);
156 /**\ingroup CPPHighAPI
157 * \brief Exports to XAO file the selected result with groups parts related to it only.
160 ExportPtr exportToXAO(const std::shared_ptr<ModelAPI_Document> & thePart,
161 const std::string & theFilePath,
162 const ModelHighAPI_Selection& theSelectedShape,
163 const std::string & theAuthor = std::string(),
164 const std::string & theGeometryName = std::string());
167 /** \ingroup CPPHighAPI
168 * \brief Export selected features or the whole part to the binary file.
170 EXCHANGEAPI_EXPORT void exportPart(
171 const std::shared_ptr<ModelAPI_Document> & thePart,
172 const std::string & theFilePath,
173 const std::list<ModelHighAPI_Selection> & theSelected = std::list<ModelHighAPI_Selection>());
175 //--------------------------------------------------------------------------------------
176 //--------------------------------------------------------------------------------------
177 #endif /* SRC_EXCHANGEAPI_EXCHANGEAPI_EXPORT_H_ */