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_IMPORT_H_
21 #define SRC_EXCHANGEAPI_EXCHANGEAPI_IMPORT_H_
23 //--------------------------------------------------------------------------------------
24 #include "ExchangeAPI.h"
28 #include <ExchangePlugin_ImportFeature.h>
30 #include <ModelHighAPI_Interface.h>
31 #include <ModelHighAPI_Macro.h>
32 #include <ModelHighAPI_Reference.h>
33 #include <ModelHighAPI_Selection.h>
36 //--------------------------------------------------------------------------------------
38 /**\class ExchangeAPI_Import
40 * \brief Interface for Import feature
42 class ExchangeAPI_Import : public ModelHighAPI_Interface
45 /// Constructor without values
47 explicit ExchangeAPI_Import(const std::shared_ptr<ModelAPI_Feature> & theFeature);
49 /// Constructor with values
51 ExchangeAPI_Import(const std::shared_ptr<ModelAPI_Feature> & theFeature,
52 const std::string & theFilePath);
54 /// Constructor with values for XAO import from memory buffer
56 ExchangeAPI_Import(const std::shared_ptr<ModelAPI_Feature> & theFeature,
57 const std::string & theFilePath,
58 const std::string & theBuffer);
60 /// Constructor with values for Step file
62 ExchangeAPI_Import(const std::shared_ptr<ModelAPI_Feature> & theFeature,
63 const std::string & theFilePath,
64 const bool theScalInterUnits,
65 const bool theMaterials,
69 virtual ~ExchangeAPI_Import();
71 INTERFACE_7(ExchangePlugin_ImportFeature::ID(),
72 filePath, ExchangePlugin_ImportFeature::FILE_PATH_ID(),
73 ModelAPI_AttributeString, /** File path */,
74 importType, ExchangePlugin_ImportFeature::IMPORT_TYPE_ID(),
75 ModelAPI_AttributeString, /**import type */,
76 stepFilePath, ExchangePlugin_ImportFeature::STEP_FILE_PATH_ID(),
77 ModelAPI_AttributeString, /**step File path */,
78 scalInterUnits, ExchangePlugin_ImportFeature::STEP_SCALE_INTER_UNITS_ID(),
79 ModelAPI_AttributeBoolean, /** Scale internationals units */,
80 materials, ExchangePlugin_ImportFeature::STEP_MATERIALS_ID(),
81 ModelAPI_AttributeBoolean, /** Materials */,
82 colors, ExchangePlugin_ImportFeature::STEP_COLORS_ID(),
83 ModelAPI_AttributeBoolean, /** Colors */,
84 memoryBuffer, ExchangePlugin_ImportFeature::MEMORY_BUFFER_ID(),
85 ModelAPI_AttributeString, /** Bytes */
90 void setFilePath(const std::string & theFilePath);
93 void setParameters(const std::string & theFilePath,
94 const bool theScalInterUnits,
95 const bool theMaterials,
98 /// Dump wrapped feature
100 virtual void dump(ModelHighAPI_Dumper& theDumper) const;
103 //! Pointer on Import object
104 typedef std::shared_ptr<ExchangeAPI_Import> ImportPtr;
106 /**\ingroup CPPHighAPI
107 * \brief Create Import feature
110 ImportPtr addImport(const std::shared_ptr<ModelAPI_Document> & thePart,
111 const std::string & theFilePath);
113 /**\ingroup CPPHighAPI
114 * \brief Create Import feature to import XAO data from bytes buffer
117 ImportPtr addImportXAOMem(const std::shared_ptr<ModelAPI_Document> & thePart,
118 PyObject* theBuffer);
120 /**\ingroup CPPHighAPI
121 * \brief Create Import Step feature
124 ImportPtr addImportSTEP(const std::shared_ptr<ModelAPI_Document> & thePart,
125 const std::string & theFilePath,
126 const bool theScalInterUnits,
127 const bool theMaterials,
128 const bool theColor);
131 /** \ingroup CPPHighAPI
132 * \brief Import features from the file to the document after the current feature (or to the end).
134 EXCHANGEAPI_EXPORT void importPart(
135 const std::shared_ptr<ModelAPI_Document> & thePart,
136 const std::string & theFilePath,
137 const ModelHighAPI_Reference & theAfterThis = ModelHighAPI_Reference());
139 //--------------------------------------------------------------------------------------
140 //--------------------------------------------------------------------------------------
141 /**\class ExchangeAPI_Import_Image
142 * \ingroup CPPHighAPI
143 * \brief Interface for Import feature
145 class ExchangeAPI_Import_Image : public ModelHighAPI_Interface
148 /// Constructor without values
150 explicit ExchangeAPI_Import_Image(const std::shared_ptr<ModelAPI_Feature> & theFeature);
151 /// Constructor with values
153 ExchangeAPI_Import_Image(const std::shared_ptr<ModelAPI_Feature> & theFeature,
154 const std::string & theFilePath);
158 virtual ~ExchangeAPI_Import_Image() = default;
160 INTERFACE_1(ExchangePlugin_Import_ImageFeature::ID(),
161 filePath, ExchangePlugin_Import_ImageFeature::FILE_PATH_ID(),
162 ModelAPI_AttributeString, /** File path */
167 void setFilePath(const std::string & theFilePath);
169 /// Dump wrapped feature
171 virtual void dump(ModelHighAPI_Dumper& theDumper) const;
175 //! Pointer on Import object
176 typedef std::shared_ptr<ExchangeAPI_Import_Image> ImportImagePtr;
180 ImportImagePtr addImportImage(const std::shared_ptr<ModelAPI_Document> & thePart,
181 const std::string & theFilePath);
183 //--------------------------------------------------------------------------------------
184 #endif /* SRC_EXCHANGEAPI_EXCHANGEAPI_IMPORT_H_ */