1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
3 // File: ExchangePlugin_ImportFeature.h
4 // Created: Aug 28, 2014
5 // Author: Sergey BELASH
7 #ifndef EXCHANGEPLUGIN_IMPORTFEATURE_H_
8 #define EXCHANGEPLUGIN_IMPORTFEATURE_H_
10 #include <ExchangePlugin.h>
11 #include <ModelAPI_Feature.h>
12 #include <ModelAPI_Result.h>
17 * \class ExchangePlugin_ImportFeature
19 * \brief Feature for import shapes from the external files in CAD formats.
21 * The list of supported formats is defined in the configuration file.
23 class ExchangePlugin_ImportFeature : public ModelAPI_Feature
27 inline static const std::string& ID()
29 static const std::string MY_IMPORT_ID("Import");
32 /// attribute name of file path
33 inline static const std::string& FILE_PATH_ID()
35 static const std::string MY_FILE_PATH_ID("file_path");
36 return MY_FILE_PATH_ID;
38 /// attribute name of group list
39 inline static const std::string& GROUP_LIST_ID()
41 static const std::string MY_GROUP_LIST_ID("group_list");
42 return MY_GROUP_LIST_ID;
44 /// Default constructor
45 EXCHANGEPLUGIN_EXPORT ExchangePlugin_ImportFeature();
46 /// Default destructor
47 EXCHANGEPLUGIN_EXPORT virtual ~ExchangePlugin_ImportFeature();
49 /// Returns the unique kind of a feature
50 EXCHANGEPLUGIN_EXPORT virtual const std::string& getKind()
52 return ExchangePlugin_ImportFeature::ID();
55 /// Request for initialization of data model of the feature: adding all attributes
56 EXCHANGEPLUGIN_EXPORT virtual void initAttributes();
58 /// Computes or recomputes the results
59 EXCHANGEPLUGIN_EXPORT virtual void execute();
61 /// Reimplemented from ModelAPI_Feature::isPreviewNeeded(). Returns false.
62 EXCHANGEPLUGIN_EXPORT virtual bool isPreviewNeeded() const { return false; }
65 /// Performs the import of the file
66 EXCHANGEPLUGIN_EXPORT void importFile(const std::string& theFileName);
68 /// Performs the import of XAO file
69 EXCHANGEPLUGIN_EXPORT void importXAO(const std::string& theFileName);
71 /// Creates and prepares a result body from the shape
72 std::shared_ptr<ModelAPI_ResultBody> createResultBody(
73 std::shared_ptr<GeomAPI_Shape> aGeomShape);
76 /// Loads Naming data structure to the document
77 void loadNamingDS(std::shared_ptr<GeomAPI_Shape> theGeomShape,
78 std::shared_ptr<ModelAPI_ResultBody> theResultBody);
81 #endif /* IMPORT_IMPORTFEATURE_H_ */