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