Salome HOME
94a55fd8fee0e46ad8dcdde579f0d1f11e0cd4b6
[modules/shaper.git] / src / ExchangePlugin / ExchangePlugin_Plugin.cpp
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 /*
4  *
5  */
6
7 #include <ExchangePlugin_Plugin.h>
8 #include <ExchangePlugin_ImportFeature.h>
9 #include <ExchangePlugin_ExportFeature.h>
10 #include <ExchangePlugin_Validators.h>
11
12 #include <Config_PropManager.h>
13
14 #include <ModelAPI_Session.h>
15 #include <ModelAPI_Validator.h>
16
17 #include <memory>
18
19 using namespace std;
20
21 // the only created instance of this plugin
22 static ExchangePlugin_Plugin* MY_EXCHANGE_INSTANCE = new ExchangePlugin_Plugin();
23
24 ExchangePlugin_Plugin::ExchangePlugin_Plugin()
25 {
26   // register this plugin
27   SessionPtr aSession = ModelAPI_Session::get();
28   aSession->registerPlugin(this);
29   ModelAPI_ValidatorsFactory* aFactory = aSession->validators();
30   aFactory->registerValidator("ExchangePlugin_ImportFormat",
31                               new ExchangePlugin_ImportFormatValidator);
32
33   // register construction properties
34   //Config_PropManager::registerProp("Visualization", "import_feature_color", "Imported feature color",
35   //                                 Config_Prop::Color, ExchangePlugin_ImportFeature::DEFAULT_COLOR());
36 }
37
38 FeaturePtr ExchangePlugin_Plugin::createFeature(string theFeatureID)
39 {
40   if (theFeatureID == ExchangePlugin_ImportFeature::ID()) {
41     return FeaturePtr(new ExchangePlugin_ImportFeature);
42   } else
43   if (theFeatureID == ExchangePlugin_ExportFeature::ID()) {
44     return FeaturePtr(new ExchangePlugin_ExportFeature);
45   }
46   // feature of such kind is not found
47   return FeaturePtr();
48 }