Salome HOME
8c025dd5405fa7748c9cd6f20c21288701ca55ad
[modules/shaper.git] / src / ConstructionPlugin / ConstructionPlugin_Plugin.cpp
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 #include "ConstructionPlugin_Plugin.h"
4 #include "ConstructionPlugin_Point.h"
5 #include "ConstructionPlugin_Axis.h"
6 #include "ConstructionPlugin_Plane.h"
7
8 #include <Config_PropManager.h>
9
10 #include <ModelAPI_Session.h>
11 #include <ModelAPI_Document.h>
12
13 using namespace std;
14
15 // the only created instance of this plugin
16 static ConstructionPlugin_Plugin* MY_CONSTRUCTION_INSTANCE = new ConstructionPlugin_Plugin();
17
18 ConstructionPlugin_Plugin::ConstructionPlugin_Plugin()
19 {
20   // register this plugin
21   ModelAPI_Session::get()->registerPlugin(this);
22
23   // register construction properties
24   Config_PropManager::registerProp("Visualization", "construction_plane_color", "Construction plane color",
25                                    Config_Prop::Color, CONSTRUCTION_PLANE_COLOR);
26
27   Config_PropManager::registerProp("Visualization", "construction_point_color", "Construction point color",
28                                    Config_Prop::Color, CONSTRUCTION_POINT_COLOR);
29   Config_PropManager::registerProp("Visualization", "construction_axis_color", "Construction axis color",
30                                    Config_Prop::Color, CONSTRUCTION_AXIS_COLOR);
31 }
32
33 FeaturePtr ConstructionPlugin_Plugin::createFeature(string theFeatureID)
34 {
35   if (theFeatureID == CONSTRUCTION_POINT_KIND) {
36     return FeaturePtr(new ConstructionPlugin_Point);
37   }
38   else if (theFeatureID == CONSTRUCTION_AXIS_KIND) {
39     return FeaturePtr(new ConstructionPlugin_Axis);
40   }
41   else if (theFeatureID == CONSTRUCTION_PLANE_KIND) {
42     return FeaturePtr(new ConstructionPlugin_Plane);
43   }
44   // feature of such kind is not found
45   return FeaturePtr();
46 }