]> SALOME platform Git repositories - modules/shaper.git/blob - src/FeaturesPlugin/FeaturesPlugin_Plugin.cpp
Salome HOME
54b0021f0a8bdaf51151f27e9aec857875a20381
[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_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 using namespace std;
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
64   // register this plugin
65   ModelAPI_Session::get()->registerPlugin(this);
66 }
67
68 FeaturePtr FeaturesPlugin_Plugin::createFeature(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_Group::ID()) {
81     return FeaturePtr(new FeaturesPlugin_Group);
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_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 }