Salome HOME
Issue #1366: Remove Sub-Shapes feature added.
[modules/shaper.git] / src / FeaturesPlugin / FeaturesPlugin_Plugin.cpp
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
2
3 #include <FeaturesPlugin_Plugin.h>
4
5 #include <FeaturesPlugin_Boolean.h>
6 #include <FeaturesPlugin_Extrusion.h>
7 #include <FeaturesPlugin_ExtrusionCut.h>
8 #include <FeaturesPlugin_ExtrusionFuse.h>
9 #include <FeaturesPlugin_Group.h>
10 #include <FeaturesPlugin_Intersection.h>
11 #include <FeaturesPlugin_Translation.h>
12 #include <FeaturesPlugin_Partition.h>
13 #include <FeaturesPlugin_Pipe.h>
14 #include <FeaturesPlugin_Placement.h>
15 #include <FeaturesPlugin_RemoveSubShapes.h>
16 #include <FeaturesPlugin_Revolution.h>
17 #include <FeaturesPlugin_RevolutionCut.h>
18 #include <FeaturesPlugin_RevolutionFuse.h>
19 #include <FeaturesPlugin_Rotation.h>
20 #include <FeaturesPlugin_ValidatorTransform.h>
21 #include <FeaturesPlugin_Validators.h>
22
23 #include <ModelAPI_Session.h>
24
25 #include <string>
26
27 #include <memory>
28
29 using namespace std;
30
31 // the only created instance of this plugin
32 static FeaturesPlugin_Plugin* MY_FEATURES_INSTANCE = new FeaturesPlugin_Plugin();
33
34 FeaturesPlugin_Plugin::FeaturesPlugin_Plugin()
35 {
36   SessionPtr aMgr = ModelAPI_Session::get();
37   ModelAPI_ValidatorsFactory* aFactory = aMgr->validators();
38   aFactory->registerValidator("FeaturesPlugin_ValidatorTransform",
39                               new FeaturesPlugin_ValidatorTransform);
40   aFactory->registerValidator("FeaturesPlugin_ValidatorCompositeLauncher",
41                               new FeaturesPlugin_ValidatorCompositeLauncher);
42   aFactory->registerValidator("FeaturesPlugin_ValidatorBaseForGeneration",
43                               new FeaturesPlugin_ValidatorBaseForGeneration);
44   aFactory->registerValidator("FeaturesPlugin_ValidatorPipeLocations",
45                               new FeaturesPlugin_ValidatorPipeLocations);
46   aFactory->registerValidator("FeaturesPlugin_ValidatorCanBeEmpty",
47                               new FeaturesPlugin_ValidatorCanBeEmpty);
48   aFactory->registerValidator("FeaturesPlugin_ValidatorBooleanSelection",
49                               new FeaturesPlugin_ValidatorBooleanSelection);
50   aFactory->registerValidator("FeaturesPlugin_ValidatorPartitionSelection",
51                               new FeaturesPlugin_ValidatorPartitionSelection);
52   aFactory->registerValidator("FeaturesPlugin_ValidatorRemoveSubShapesSelection",
53                               new FeaturesPlugin_ValidatorRemoveSubShapesSelection);
54   aFactory->registerValidator("FeaturesPlugin_ValidatorRemoveSubShapesResult",
55                               new FeaturesPlugin_ValidatorRemoveSubShapesResult);
56
57   // register this plugin
58   ModelAPI_Session::get()->registerPlugin(this);
59 }
60
61 FeaturePtr FeaturesPlugin_Plugin::createFeature(string theFeatureID)
62 {
63   if (theFeatureID == FeaturesPlugin_Extrusion::ID()) {
64     return FeaturePtr(new FeaturesPlugin_Extrusion);
65   } else if (theFeatureID == FeaturesPlugin_Revolution::ID()) {
66    return FeaturePtr(new FeaturesPlugin_Revolution);
67   } else if (theFeatureID == FeaturesPlugin_Rotation::ID()) {
68     return FeaturePtr(new FeaturesPlugin_Rotation);
69   } else if (theFeatureID == FeaturesPlugin_Translation::ID()) {
70     return FeaturePtr(new FeaturesPlugin_Translation);
71   } else if (theFeatureID == FeaturesPlugin_Boolean::ID()) {
72     return FeaturePtr(new FeaturesPlugin_Boolean);
73   } else if (theFeatureID == FeaturesPlugin_Group::ID()) {
74     return FeaturePtr(new FeaturesPlugin_Group);
75   } else if (theFeatureID == FeaturesPlugin_Intersection::ID()) {
76     return FeaturePtr(new FeaturesPlugin_Intersection);
77   } else if (theFeatureID == FeaturesPlugin_Partition::ID()) {
78     return FeaturePtr(new FeaturesPlugin_Partition);
79   } else if (theFeatureID == FeaturesPlugin_Pipe::ID()) {
80     return FeaturePtr(new FeaturesPlugin_Pipe);
81   } else if (theFeatureID == FeaturesPlugin_Placement::ID()) {
82     return FeaturePtr(new FeaturesPlugin_Placement);
83   } else if (theFeatureID == FeaturesPlugin_ExtrusionCut::ID()) {
84     return FeaturePtr(new FeaturesPlugin_ExtrusionCut);
85   } else if (theFeatureID == FeaturesPlugin_ExtrusionFuse::ID()) {
86     return FeaturePtr(new FeaturesPlugin_ExtrusionFuse);
87   } else if (theFeatureID == FeaturesPlugin_RevolutionCut::ID()) {
88     return FeaturePtr(new FeaturesPlugin_RevolutionCut);
89   } else if (theFeatureID == FeaturesPlugin_RevolutionFuse::ID()) {
90     return FeaturePtr(new FeaturesPlugin_RevolutionFuse);
91   } else if (theFeatureID == FeaturesPlugin_RemoveSubShapes::ID()) {
92     return FeaturePtr(new FeaturesPlugin_RemoveSubShapes);
93   }
94
95   // feature of such kind is not found
96   return FeaturePtr();
97 }