Salome HOME
Change color action for a body object
[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_Validators.h>
10
11 #include <Config_PropManager.h>
12
13 #include <ModelAPI_Session.h>
14 #include <ModelAPI_Validator.h>
15
16 #include <memory>
17
18 using namespace std;
19
20 // the only created instance of this plugin
21 static ExchangePlugin_Plugin* MY_EXCHANGE_INSTANCE = new ExchangePlugin_Plugin();
22
23 ExchangePlugin_Plugin::ExchangePlugin_Plugin()
24 {
25   // register this plugin
26   SessionPtr aSession = ModelAPI_Session::get();
27   aSession->registerPlugin(this);
28   ModelAPI_ValidatorsFactory* aFactory = aSession->validators();
29   aFactory->registerValidator("ExchangePlugin_ImportFormat",
30                               new ExchangePlugin_ImportFormatValidator);
31
32   // register construction properties
33   Config_PropManager::registerProp("Visualization", "import_feature_color", "Imported feature color",
34                                    Config_Prop::Color, IMPORTED_FEATURE_COLOR);
35
36   // register random result color properties
37   Config_PropManager::registerProp("Visualization", "random_result_color", "Use random color for results",
38                                    Config_Prop::Bool, "false");
39 }
40
41 FeaturePtr ExchangePlugin_Plugin::createFeature(string theFeatureID)
42 {
43   if (theFeatureID == ExchangePlugin_ImportFeature::ID()) {
44     return FeaturePtr(new ExchangePlugin_ImportFeature);
45   }
46   // feature of such kind is not found
47   return FeaturePtr();
48 }