Salome HOME
Merge branch 'master' into cgt/devCEA
[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_Intersection.h>
10 #include <FeaturesPlugin_MultiTranslation.h>
11 #include <FeaturesPlugin_Partition.h>
12 #include <FeaturesPlugin_Pipe.h>
13 #include <FeaturesPlugin_Placement.h>
14 #include <FeaturesPlugin_Recover.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_Scale.h>
21 #include <FeaturesPlugin_Symmetry.h>
22 #include <FeaturesPlugin_Translation.h>
23 #include <FeaturesPlugin_Union.h>
24 #include <FeaturesPlugin_ValidatorTransform.h>
25 #include <FeaturesPlugin_Validators.h>
26
27 #include <ModelAPI_Session.h>
28
29 #include <string>
30
31 #include <memory>
32
33 // the only created instance of this plugin
34 static FeaturesPlugin_Plugin* MY_FEATURES_INSTANCE = new FeaturesPlugin_Plugin();
35
36 FeaturesPlugin_Plugin::FeaturesPlugin_Plugin()
37 {
38   SessionPtr aMgr = ModelAPI_Session::get();
39   ModelAPI_ValidatorsFactory* aFactory = aMgr->validators();
40   aFactory->registerValidator("FeaturesPlugin_ValidatorTransform",
41                               new FeaturesPlugin_ValidatorTransform);
42   aFactory->registerValidator("FeaturesPlugin_ValidatorCompositeLauncher",
43                               new FeaturesPlugin_ValidatorCompositeLauncher);
44   aFactory->registerValidator("FeaturesPlugin_ValidatorBaseForGeneration",
45                               new FeaturesPlugin_ValidatorBaseForGeneration);
46   aFactory->registerValidator("FeaturesPlugin_ValidatorPipeLocations",
47                               new FeaturesPlugin_ValidatorPipeLocations);
48   aFactory->registerValidator("FeaturesPlugin_ValidatorExtrusionDir",
49                               new FeaturesPlugin_ValidatorExtrusionDir);
50   aFactory->registerValidator("FeaturesPlugin_ValidatorBooleanSelection",
51                               new FeaturesPlugin_ValidatorBooleanSelection);
52   aFactory->registerValidator("FeaturesPlugin_ValidatorPartitionSelection",
53                               new FeaturesPlugin_ValidatorPartitionSelection);
54   aFactory->registerValidator("FeaturesPlugin_ValidatorRemoveSubShapesSelection",
55                               new FeaturesPlugin_ValidatorRemoveSubShapesSelection);
56   aFactory->registerValidator("FeaturesPlugin_ValidatorRemoveSubShapesResult",
57                               new FeaturesPlugin_ValidatorRemoveSubShapesResult);
58   aFactory->registerValidator("FeaturesPlugin_ValidatorPipePath",
59                               new FeaturesPlugin_ValidatorPipePath);
60   aFactory->registerValidator("FeaturesPlugin_ValidatorUnionSelection",
61                               new FeaturesPlugin_ValidatorUnionSelection);
62   aFactory->registerValidator("FeaturesPlugin_ValidatorUnionArguments",
63                               new FeaturesPlugin_ValidatorUnionArguments);
64   aFactory->registerValidator("FeaturesPlugin_ValidatorConcealedResult",
65                               new FeaturesPlugin_ValidatorConcealedResult);
66
67   // register this plugin
68   ModelAPI_Session::get()->registerPlugin(this);
69 }
70
71 FeaturePtr FeaturesPlugin_Plugin::createFeature(std::string theFeatureID)
72 {
73   if (theFeatureID == FeaturesPlugin_Extrusion::ID()) {
74     return FeaturePtr(new FeaturesPlugin_Extrusion);
75   } else if (theFeatureID == FeaturesPlugin_Revolution::ID()) {
76    return FeaturePtr(new FeaturesPlugin_Revolution);
77   } else if (theFeatureID == FeaturesPlugin_Rotation::ID()) {
78     return FeaturePtr(new FeaturesPlugin_Rotation);
79   } else if (theFeatureID == FeaturesPlugin_Translation::ID()) {
80     return FeaturePtr(new FeaturesPlugin_Translation);
81   } else if (theFeatureID == FeaturesPlugin_Boolean::ID()) {
82     return FeaturePtr(new FeaturesPlugin_Boolean);
83   } else if (theFeatureID == FeaturesPlugin_Intersection::ID()) {
84     return FeaturePtr(new FeaturesPlugin_Intersection);
85   } else if (theFeatureID == FeaturesPlugin_Partition::ID()) {
86     return FeaturePtr(new FeaturesPlugin_Partition);
87   } else if (theFeatureID == FeaturesPlugin_Pipe::ID()) {
88     return FeaturePtr(new FeaturesPlugin_Pipe);
89   } else if (theFeatureID == FeaturesPlugin_Placement::ID()) {
90     return FeaturePtr(new FeaturesPlugin_Placement);
91   } else if (theFeatureID == FeaturesPlugin_Recover::ID()) {
92     return FeaturePtr(new FeaturesPlugin_Recover);
93   } else if (theFeatureID == FeaturesPlugin_ExtrusionCut::ID()) {
94     return FeaturePtr(new FeaturesPlugin_ExtrusionCut);
95   } else if (theFeatureID == FeaturesPlugin_ExtrusionFuse::ID()) {
96     return FeaturePtr(new FeaturesPlugin_ExtrusionFuse);
97   } else if (theFeatureID == FeaturesPlugin_RevolutionCut::ID()) {
98     return FeaturePtr(new FeaturesPlugin_RevolutionCut);
99   } else if (theFeatureID == FeaturesPlugin_RevolutionFuse::ID()) {
100     return FeaturePtr(new FeaturesPlugin_RevolutionFuse);
101   } else if (theFeatureID == FeaturesPlugin_RemoveSubShapes::ID()) {
102     return FeaturePtr(new FeaturesPlugin_RemoveSubShapes);
103   } else if (theFeatureID == FeaturesPlugin_Union::ID()) {
104     return FeaturePtr(new FeaturesPlugin_Union);
105   } else if (theFeatureID == FeaturesPlugin_Symmetry::ID()) {
106     return FeaturePtr(new FeaturesPlugin_Symmetry);
107   } else if (theFeatureID == FeaturesPlugin_Scale::ID()) {
108     return FeaturePtr(new FeaturesPlugin_Scale);
109   } else if (theFeatureID == FeaturesPlugin_MultiTranslation::ID()) {
110     return FeaturePtr(new FeaturesPlugin_MultiTranslation);
111   }
112
113   // feature of such kind is not found
114   return FeaturePtr();
115 }