Salome HOME
updated copyright message
[modules/shaper.git] / src / ExchangeAPI / ExchangeAPI_Import.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_IMPORT_H_
21 #define SRC_EXCHANGEAPI_EXCHANGEAPI_IMPORT_H_
22
23 //--------------------------------------------------------------------------------------
24 #include "ExchangeAPI.h"
25
26 #include <string>
27
28 #include <ExchangePlugin_ImportFeature.h>
29
30 #include <ModelHighAPI_Interface.h>
31 #include <ModelHighAPI_Macro.h>
32 #include <ModelHighAPI_Reference.h>
33 #include <ModelHighAPI_Selection.h>
34 //--------------------------------------------------------------------------------------
35 /**\class ExchangeAPI_Import
36  * \ingroup CPPHighAPI
37  * \brief Interface for Import feature
38  */
39 class ExchangeAPI_Import : public ModelHighAPI_Interface
40 {
41 public:
42   /// Constructor without values
43   EXCHANGEAPI_EXPORT
44   explicit ExchangeAPI_Import(const std::shared_ptr<ModelAPI_Feature> & theFeature);
45   /// Constructor with values
46   EXCHANGEAPI_EXPORT
47   ExchangeAPI_Import(const std::shared_ptr<ModelAPI_Feature> & theFeature,
48                      const std::string & theFilePath);
49
50   /// Constructor with values for Step file
51   EXCHANGEAPI_EXPORT
52   ExchangeAPI_Import(const std::shared_ptr<ModelAPI_Feature> & theFeature,
53                      const std::string & theFilePath,
54                      const bool  theScalInterUnits,
55                      const bool  theMaterials,
56                      const bool  theColor);
57   /// Destructor
58   EXCHANGEAPI_EXPORT
59   virtual ~ExchangeAPI_Import();
60
61   INTERFACE_6(ExchangePlugin_ImportFeature::ID(),
62               filePath, ExchangePlugin_ImportFeature::FILE_PATH_ID(),
63               ModelAPI_AttributeString, /** File path */,
64               importType, ExchangePlugin_ImportFeature::IMPORT_TYPE_ID(),
65               ModelAPI_AttributeString, /**import type */,
66               stepFilePath, ExchangePlugin_ImportFeature::STEP_FILE_PATH_ID(),
67               ModelAPI_AttributeString, /**step File path */,
68               scalInterUnits, ExchangePlugin_ImportFeature::STEP_SCALE_INTER_UNITS_ID(),
69               ModelAPI_AttributeBoolean, /** Scale internationals units */,
70               materials, ExchangePlugin_ImportFeature::STEP_MATERIALS_ID(),
71               ModelAPI_AttributeBoolean, /** Materials */,
72               colors, ExchangePlugin_ImportFeature::STEP_COLORS_ID(),
73               ModelAPI_AttributeBoolean, /** Colors */
74   )
75
76   /// Set point values
77   EXCHANGEAPI_EXPORT
78   void setFilePath(const std::string & theFilePath);
79
80   EXCHANGEAPI_EXPORT
81   void setParameters(const std::string & theFilePath,
82                      const bool theScalInterUnits,
83                      const bool theMaterials,
84                      const bool theColor);
85
86   /// Dump wrapped feature
87   EXCHANGEAPI_EXPORT
88   virtual void dump(ModelHighAPI_Dumper& theDumper) const;
89 };
90
91 //! Pointer on Import object
92 typedef std::shared_ptr<ExchangeAPI_Import> ImportPtr;
93
94 /**\ingroup CPPHighAPI
95  * \brief Create Import feature
96  */
97 EXCHANGEAPI_EXPORT
98 ImportPtr addImport(const std::shared_ptr<ModelAPI_Document> & thePart,
99                     const std::string & theFilePath);
100
101 /**\ingroup CPPHighAPI
102  * \brief Create Import Step feature
103  */
104 EXCHANGEAPI_EXPORT
105 ImportPtr addImportSTEP(const std::shared_ptr<ModelAPI_Document> & thePart,
106                         const std::string & theFilePath,
107                         const bool theScalInterUnits,
108                         const bool theMaterials,
109                         const bool theColor);
110
111
112 /** \ingroup CPPHighAPI
113  *  \brief Import features from the file to the document after the current feature (or to the end).
114  */
115 EXCHANGEAPI_EXPORT void importPart(
116     const std::shared_ptr<ModelAPI_Document> & thePart,
117     const std::string & theFilePath,
118     const ModelHighAPI_Reference & theAfterThis = ModelHighAPI_Reference());
119
120 //--------------------------------------------------------------------------------------
121 //--------------------------------------------------------------------------------------
122 /**\class ExchangeAPI_Import_Image
123  * \ingroup CPPHighAPI
124  * \brief Interface for Import feature
125  */
126 class ExchangeAPI_Import_Image : public ModelHighAPI_Interface
127 {
128 public:
129   /// Constructor without values
130   EXCHANGEAPI_EXPORT
131   explicit ExchangeAPI_Import_Image(const std::shared_ptr<ModelAPI_Feature> & theFeature);
132   /// Constructor with values
133   EXCHANGEAPI_EXPORT
134   ExchangeAPI_Import_Image(const std::shared_ptr<ModelAPI_Feature> & theFeature,
135                      const std::string & theFilePath);
136
137   /// Destructor
138   EXCHANGEAPI_EXPORT
139   virtual ~ExchangeAPI_Import_Image() = default;
140
141   INTERFACE_1(ExchangePlugin_Import_ImageFeature::ID(),
142               filePath, ExchangePlugin_Import_ImageFeature::FILE_PATH_ID(),
143               ModelAPI_AttributeString, /** File path */
144   )
145
146   /// Set point values
147   EXCHANGEAPI_EXPORT
148   void setFilePath(const std::string & theFilePath);
149
150   /// Dump wrapped feature
151   EXCHANGEAPI_EXPORT
152   virtual void dump(ModelHighAPI_Dumper& theDumper) const;
153
154 };
155
156 //! Pointer on Import object
157 typedef std::shared_ptr<ExchangeAPI_Import_Image> ImportImagePtr;
158
159
160 EXCHANGEAPI_EXPORT
161 ImportImagePtr addImportImage(const std::shared_ptr<ModelAPI_Document> & thePart,
162                     const std::string & theFilePath);
163
164 //--------------------------------------------------------------------------------------
165 #endif /* SRC_EXCHANGEAPI_EXCHANGEAPI_IMPORT_H_ */