Salome HOME
Issue #1834: Fix length of lines
[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 using namespace std;
15
16 // the only created instance of this plugin
17 static ConstructionPlugin_Plugin* MY_CONSTRUCTION_INSTANCE = new ConstructionPlugin_Plugin();
18
19 ConstructionPlugin_Plugin::ConstructionPlugin_Plugin()
20 {
21   SessionPtr aMgr = ModelAPI_Session::get();
22   ModelAPI_ValidatorsFactory* aFactory = aMgr->validators();
23   aFactory->registerValidator("ConstructionPlugin_ValidatorPointLines",
24                               new ConstructionPlugin_ValidatorPointLines());
25   aFactory->registerValidator("ConstructionPlugin_ValidatorPointLineAndPlaneNotParallel",
26                               new ConstructionPlugin_ValidatorPointLineAndPlaneNotParallel());
27   aFactory->registerValidator("ConstructionPlugin_ValidatorPlaneThreePoints",
28                               new ConstructionPlugin_ValidatorPlaneThreePoints());
29   aFactory->registerValidator("ConstructionPlugin_ValidatorPlaneLinePoint",
30                               new ConstructionPlugin_ValidatorPlaneLinePoint());
31   aFactory->registerValidator("ConstructionPlugin_ValidatorPlaneTwoParallelPlanes",
32                               new ConstructionPlugin_ValidatorPlaneTwoParallelPlanes());
33   aFactory->registerValidator("ConstructionPlugin_ValidatorAxisTwoNotParallelPlanes",
34                               new ConstructionPlugin_ValidatorAxisTwoNotParallelPlanes());
35
36   // register this plugin
37   ModelAPI_Session::get()->registerPlugin(this);
38
39   // register construction properties
40   Config_PropManager::registerProp("Visualization", "construction_plane_color",
41                                    "Construction plane color",
42                                    Config_Prop::Color, ConstructionPlugin_Plane::DEFAULT_COLOR());
43 }
44
45 FeaturePtr ConstructionPlugin_Plugin::createFeature(string theFeatureID)
46 {
47   if (theFeatureID == ConstructionPlugin_Point::ID()) {
48     return FeaturePtr(new ConstructionPlugin_Point);
49   }
50   else if (theFeatureID == ConstructionPlugin_Axis::ID()) {
51     return FeaturePtr(new ConstructionPlugin_Axis);
52   }
53   else if (theFeatureID == ConstructionPlugin_Plane::ID()) {
54     return FeaturePtr(new ConstructionPlugin_Plane);
55   }
56   // feature of such kind is not found
57   return FeaturePtr();
58 }