Salome HOME
Issue #1343: Architecture changes. Composite features now derived from extrusion...
[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_Revolution.h>
16 #include <FeaturesPlugin_RevolutionCut.h>
17 #include <FeaturesPlugin_RevolutionFuse.h>
18 #include <FeaturesPlugin_Rotation.h>
19 #include <FeaturesPlugin_ValidatorTransform.h>
20 #include <FeaturesPlugin_ValidatorExtrusionBase.h>
21 #include <FeaturesPlugin_Validators.h>
22
23 #include <ModelAPI_Session.h>
24
25 #include <string>
26
27 #include <memory>
28
29 using namespace std;
30
31 // the only created instance of this plugin
32 static FeaturesPlugin_Plugin* MY_FEATURES_INSTANCE = new FeaturesPlugin_Plugin();
33
34 FeaturesPlugin_Plugin::FeaturesPlugin_Plugin()
35 {
36   SessionPtr aMgr = ModelAPI_Session::get();
37   ModelAPI_ValidatorsFactory* aFactory = aMgr->validators();
38   aFactory->registerValidator("FeaturesPlugin_ValidatorTransform",
39                               new FeaturesPlugin_ValidatorTransform);
40   aFactory->registerValidator("FeaturesPlugin_ValidatorExtrusionBase",
41                               new FeaturesPlugin_ValidatorExtrusionBase);
42   aFactory->registerValidator("FeaturesPlugin_ValidatorBaseForGeneration",
43                               new FeaturesPlugin_ValidatorBaseForGeneration);
44   aFactory->registerValidator("FeaturesPlugin_PipeLocationsValidator",
45                               new FeaturesPlugin_PipeLocationsValidator);
46
47   // register this plugin
48   ModelAPI_Session::get()->registerPlugin(this);
49 }
50
51 FeaturePtr FeaturesPlugin_Plugin::createFeature(string theFeatureID)
52 {
53   if (theFeatureID == FeaturesPlugin_Extrusion::ID()) {
54     return FeaturePtr(new FeaturesPlugin_Extrusion);
55   } else if (theFeatureID == FeaturesPlugin_Revolution::ID()) {
56    return FeaturePtr(new FeaturesPlugin_Revolution);
57   } else if (theFeatureID == FeaturesPlugin_Rotation::ID()) {
58     return FeaturePtr(new FeaturesPlugin_Rotation);
59   } else if (theFeatureID == FeaturesPlugin_Translation::ID()) {
60     return FeaturePtr(new FeaturesPlugin_Translation);
61   } else if (theFeatureID == FeaturesPlugin_Boolean::ID()) {
62     return FeaturePtr(new FeaturesPlugin_Boolean);
63   } else if (theFeatureID == FeaturesPlugin_Group::ID()) {
64     return FeaturePtr(new FeaturesPlugin_Group);
65   } else if (theFeatureID == FeaturesPlugin_Intersection::ID()) {
66     return FeaturePtr(new FeaturesPlugin_Intersection);
67   } else if (theFeatureID == FeaturesPlugin_Partition::ID()) {
68     return FeaturePtr(new FeaturesPlugin_Partition);
69   } else if (theFeatureID == FeaturesPlugin_Pipe::ID()) {
70     return FeaturePtr(new FeaturesPlugin_Pipe);
71   } else if (theFeatureID == FeaturesPlugin_Placement::ID()) {
72     return FeaturePtr(new FeaturesPlugin_Placement);
73   } else if (theFeatureID == FeaturesPlugin_ExtrusionCut::ID()) {
74     return FeaturePtr(new FeaturesPlugin_ExtrusionCut);
75   } else if (theFeatureID == FeaturesPlugin_ExtrusionFuse::ID()) {
76     return FeaturePtr(new FeaturesPlugin_ExtrusionFuse);
77   } else if (theFeatureID == FeaturesPlugin_RevolutionCut::ID()) {
78     return FeaturePtr(new FeaturesPlugin_RevolutionCut);
79   } else if (theFeatureID == FeaturesPlugin_RevolutionFuse::ID()) {
80     return FeaturePtr(new FeaturesPlugin_RevolutionFuse);
81   }
82   // feature of such kind is not found
83   return FeaturePtr();
84 }