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