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