Salome HOME
Copyright update 2020
[modules/shaper.git] / src / ExchangePlugin / ExchangePlugin_Import.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 EXCHANGEPLUGIN_IMPORT_H_
21 #define EXCHANGEPLUGIN_IMPORT_H_
22
23 #include "ExchangePlugin.h"
24
25 #include <ModelAPI_CompositeFeature.h>
26 #include <ModelAPI_Result.h>
27
28 #include <map>
29
30 /**
31  * \class ExchangePlugin_ImportFeature
32  * \ingroup Plugins
33  * \brief Feature for import shapes from the external files in CAD formats.
34  *
35  * The list of supported formats is defined in the configuration file.
36  */
37 class ExchangePlugin_Import : public ModelAPI_Feature
38 {
39  public:
40   /// Feature kind
41   inline static const std::string& ID()
42   {
43     static const std::string MY_IMPORT_ID("ImportMacro");
44     return MY_IMPORT_ID;
45   }
46   /// attribute name of file path
47   inline static const std::string& FILE_PATH_ID()
48   {
49     static const std::string MY_FILE_PATH_ID("file_path");
50     return MY_FILE_PATH_ID;
51   }
52   /// attribute name of target part
53   inline static const std::string& TARGET_PART_ID()
54   {
55     static const std::string MY_TARGET_PART_ID("target_part");
56     return MY_TARGET_PART_ID;
57   }
58   /// attribute name of list of target parts
59   inline static const std::string& TARGET_PARTS_LIST_ID()
60   {
61     static const std::string MY_TARGET_PARTS_LIST_ID("target_parts_list");
62     return MY_TARGET_PARTS_LIST_ID;
63   }
64   /// Default constructor
65   EXCHANGEPLUGIN_EXPORT ExchangePlugin_Import();
66   /// Default destructor
67   EXCHANGEPLUGIN_EXPORT virtual ~ExchangePlugin_Import();
68
69   /// Returns the unique kind of a feature
70   EXCHANGEPLUGIN_EXPORT virtual const std::string& getKind()
71   {
72     return ExchangePlugin_Import::ID();
73   }
74
75   /// Request for initialization of data model of the feature: adding all attributes
76   EXCHANGEPLUGIN_EXPORT virtual void initAttributes();
77
78   /// Called on change of any argument-attribute of this object
79   /// \param theID identifier of changed attribute
80   EXCHANGEPLUGIN_EXPORT virtual void attributeChanged(const std::string& theID);
81
82   /// Computes or recomputes the results
83   EXCHANGEPLUGIN_EXPORT virtual void execute();
84
85   /// Returns true if this feature is used as macro: creates other features and then removed.
86   EXCHANGEPLUGIN_EXPORT virtual bool isMacro() const { return true; }
87
88   /// Reimplemented from ModelAPI_Feature::isPreviewNeeded(). Returns false.
89   EXCHANGEPLUGIN_EXPORT virtual bool isPreviewNeeded() const { return false; }
90 };
91
92 #endif /* IMPORT_IMPORTFEATURE_H_ */