]> SALOME platform Git repositories - modules/shaper.git/blob - src/ConstructionPlugin/ConstructionPlugin_Plugin.cpp
Salome HOME
Put groups to the separated plugin: Collection
[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 #include "ConstructionPlugin_Validators.h"
8
9 #include <Config_PropManager.h>
10
11 #include <ModelAPI_Session.h>
12 #include <ModelAPI_Document.h>
13
14 // the only created instance of this plugin
15 static ConstructionPlugin_Plugin* MY_CONSTRUCTION_INSTANCE = new ConstructionPlugin_Plugin();
16
17 ConstructionPlugin_Plugin::ConstructionPlugin_Plugin()
18 {
19   SessionPtr aMgr = ModelAPI_Session::get();
20   ModelAPI_ValidatorsFactory* aFactory = aMgr->validators();
21   aFactory->registerValidator("ConstructionPlugin_ValidatorPointLines",
22                               new ConstructionPlugin_ValidatorPointLines());
23   aFactory->registerValidator("ConstructionPlugin_ValidatorPointLineAndPlaneNotParallel",
24                               new ConstructionPlugin_ValidatorPointLineAndPlaneNotParallel());
25   aFactory->registerValidator("ConstructionPlugin_ValidatorPlaneThreePoints",
26                               new ConstructionPlugin_ValidatorPlaneThreePoints());
27   aFactory->registerValidator("ConstructionPlugin_ValidatorPlaneLinePoint",
28                               new ConstructionPlugin_ValidatorPlaneLinePoint());
29   aFactory->registerValidator("ConstructionPlugin_ValidatorPlaneTwoParallelPlanes",
30                               new ConstructionPlugin_ValidatorPlaneTwoParallelPlanes());
31   aFactory->registerValidator("ConstructionPlugin_ValidatorAxisTwoNotParallelPlanes",
32                               new ConstructionPlugin_ValidatorAxisTwoNotParallelPlanes());
33
34   // register this plugin
35   ModelAPI_Session::get()->registerPlugin(this);
36
37   // register construction properties
38   Config_PropManager::registerProp("Visualization", "construction_plane_color",
39                                    "Construction plane color",
40                                    Config_Prop::Color, ConstructionPlugin_Plane::DEFAULT_COLOR());
41 }
42
43 FeaturePtr ConstructionPlugin_Plugin::createFeature(std::string theFeatureID)
44 {
45   if (theFeatureID == ConstructionPlugin_Point::ID()) {
46     return FeaturePtr(new ConstructionPlugin_Point);
47   }
48   else if (theFeatureID == ConstructionPlugin_Axis::ID()) {
49     return FeaturePtr(new ConstructionPlugin_Axis);
50   }
51   else if (theFeatureID == ConstructionPlugin_Plane::ID()) {
52     return FeaturePtr(new ConstructionPlugin_Plane);
53   }
54   // feature of such kind is not found
55   return FeaturePtr();
56 }