Salome HOME
ExtrusionSketch and RevolutionSketch features.
[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_ExtrusionSketch.h>
8 #include <FeaturesPlugin_ExtrusionCut.h>
9 #include <FeaturesPlugin_ExtrusionFuse.h>
10 #include <FeaturesPlugin_Group.h>
11 #include <FeaturesPlugin_Translation.h>
12 #include <FeaturesPlugin_Partition.h>
13 #include <FeaturesPlugin_Placement.h>
14 #include <FeaturesPlugin_Revolution.h>
15 #include <FeaturesPlugin_RevolutionSketch.h>
16 #include <FeaturesPlugin_RevolutionCut.h>
17 #include <FeaturesPlugin_RevolutionFuse.h>
18 #include <FeaturesPlugin_Rotation.h>
19
20 #include <ModelAPI_Session.h>
21
22 #include <string>
23
24 #include <memory>
25
26 using namespace std;
27
28 // the only created instance of this plugin
29 static FeaturesPlugin_Plugin* MY_FEATURES_INSTANCE = new FeaturesPlugin_Plugin();
30
31 FeaturesPlugin_Plugin::FeaturesPlugin_Plugin()
32 {
33   // register this plugin
34   ModelAPI_Session::get()->registerPlugin(this);
35 }
36
37 FeaturePtr FeaturesPlugin_Plugin::createFeature(string theFeatureID)
38 {
39   if (theFeatureID == FeaturesPlugin_Extrusion::ID()) {
40     return FeaturePtr(new FeaturesPlugin_Extrusion);
41   } else if (theFeatureID == FeaturesPlugin_Revolution::ID()) {
42    return FeaturePtr(new FeaturesPlugin_Revolution);
43   } else if (theFeatureID == FeaturesPlugin_Rotation::ID()) {
44     return FeaturePtr(new FeaturesPlugin_Rotation);
45   } else if (theFeatureID == FeaturesPlugin_Translation::ID()) {
46     return FeaturePtr(new FeaturesPlugin_Translation);
47   } else if (theFeatureID == FeaturesPlugin_Boolean::ID()) {
48     return FeaturePtr(new FeaturesPlugin_Boolean);
49   } else if (theFeatureID == FeaturesPlugin_Group::ID()) {
50     return FeaturePtr(new FeaturesPlugin_Group);
51   } else if (theFeatureID == FeaturesPlugin_Partition::ID()) {
52     return FeaturePtr(new FeaturesPlugin_Partition);
53   } else if (theFeatureID == FeaturesPlugin_Placement::ID()) {
54     return FeaturePtr(new FeaturesPlugin_Placement);
55   } else if (theFeatureID == FeaturesPlugin_ExtrusionCut::ID()) {
56     return FeaturePtr(new FeaturesPlugin_ExtrusionCut);
57   } else if (theFeatureID == FeaturesPlugin_ExtrusionFuse::ID()) {
58     return FeaturePtr(new FeaturesPlugin_ExtrusionFuse);
59   } else if (theFeatureID == FeaturesPlugin_RevolutionCut::ID()) {
60     return FeaturePtr(new FeaturesPlugin_RevolutionCut);
61   } else if (theFeatureID == FeaturesPlugin_RevolutionFuse::ID()) {
62     return FeaturePtr(new FeaturesPlugin_RevolutionFuse);
63   } else if (theFeatureID == FeaturesPlugin_ExtrusionSketch::ID()) {
64     return FeaturePtr(new FeaturesPlugin_ExtrusionSketch);
65   } else if (theFeatureID == FeaturesPlugin_RevolutionSketch::ID()) {
66     return FeaturePtr(new FeaturesPlugin_RevolutionSketch);
67   }
68   // feature of such kind is not found
69   return FeaturePtr();
70 }