1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
3 // File: ExchangePlugin_ImportFeature.h
4 // Created: Aug 28, 2014
5 // Authors: Sergey BELASH, Sergey POKHODENKO
7 #ifndef EXCHANGEPLUGIN_IMPORTFEATURE_H_
8 #define EXCHANGEPLUGIN_IMPORTFEATURE_H_
10 #include "ExchangePlugin.h"
12 #include <ModelAPI_CompositeFeature.h>
13 #include <ModelAPI_Result.h>
18 * \class ExchangePlugin_ImportFeature
20 * \brief Feature for import shapes from the external files in CAD formats.
22 * The list of supported formats is defined in the configuration file.
24 class ExchangePlugin_ImportFeature : public ModelAPI_CompositeFeature
28 inline static const std::string& ID()
30 static const std::string MY_IMPORT_ID("Import");
33 /// attribute name of file path
34 inline static const std::string& FILE_PATH_ID()
36 static const std::string MY_FILE_PATH_ID("file_path");
37 return MY_FILE_PATH_ID;
39 /// All features (list of references)
40 inline static const std::string& FEATURES_ID()
42 static const std::string MY_FEATURES_ID("Features");
43 return MY_FEATURES_ID;
45 /// Default constructor
46 EXCHANGEPLUGIN_EXPORT ExchangePlugin_ImportFeature();
47 /// Default destructor
48 EXCHANGEPLUGIN_EXPORT virtual ~ExchangePlugin_ImportFeature();
50 /// Returns the unique kind of a feature
51 EXCHANGEPLUGIN_EXPORT virtual const std::string& getKind()
53 return ExchangePlugin_ImportFeature::ID();
56 /// Request for initialization of data model of the feature: adding all attributes
57 EXCHANGEPLUGIN_EXPORT virtual void initAttributes();
59 /// Computes or recomputes the results
60 EXCHANGEPLUGIN_EXPORT virtual void execute();
62 /// Reimplemented from ModelAPI_Feature::isPreviewNeeded(). Returns false.
63 EXCHANGEPLUGIN_EXPORT virtual bool isPreviewNeeded() const { return false; }
65 /// Reimplemented from ModelAPI_CompositeFeature::addFeature()
66 virtual std::shared_ptr<ModelAPI_Feature> addFeature(std::string theID);
68 /// Reimplemented from ModelAPI_CompositeFeature::numberOfSubs()
69 virtual int numberOfSubs(bool forTree = false) const;
71 /// Reimplemented from ModelAPI_CompositeFeature::subFeature()
72 virtual std::shared_ptr<ModelAPI_Feature> subFeature(const int theIndex, bool forTree = false);
74 /// Reimplemented from ModelAPI_CompositeFeature::subFeatureId()
75 virtual int subFeatureId(const int theIndex) const;
77 /// Reimplemented from ModelAPI_CompositeFeature::isSub()
78 virtual bool isSub(ObjectPtr theObject) const;
80 /// Reimplemented from ModelAPI_CompositeFeature::removeFeature()
81 virtual void removeFeature(std::shared_ptr<ModelAPI_Feature> theFeature);
84 /// Performs the import of the file
85 EXCHANGEPLUGIN_EXPORT void importFile(const std::string& theFileName);
87 /// Performs the import of XAO file
88 EXCHANGEPLUGIN_EXPORT void importXAO(const std::string& theFileName);
90 /// Creates and prepares a result body from the shape
91 std::shared_ptr<ModelAPI_ResultBody> createResultBody(
92 std::shared_ptr<GeomAPI_Shape> aGeomShape);
95 /// Loads Naming data structure to the document
96 void loadNamingDS(std::shared_ptr<GeomAPI_Shape> theGeomShape,
97 std::shared_ptr<ModelAPI_ResultBody> theResultBody);
100 #endif /* IMPORT_IMPORTFEATURE_H_ */