]> SALOME platform Git repositories - modules/shaper.git/blob - src/SketchPlugin/SketchPlugin_Plugin.cpp
Salome HOME
Merge branch 'master' of newgeom:newgeom
[modules/shaper.git] / src / SketchPlugin / SketchPlugin_Plugin.cpp
1 #include "SketchPlugin_Plugin.h"
2 #include "SketchPlugin_Sketch.h"
3 #include "SketchPlugin_Line.h"
4 #include "SketchPlugin_Point.h"
5 #include "SketchPlugin_Circle.h"
6 #include "SketchPlugin_Arc.h"
7 #include "SketchPlugin_ConstraintCoincidence.h"
8 #include "SketchPlugin_ConstraintDistance.h"
9 #include "SketchPlugin_ConstraintDiameter.h"
10 #include "SketchPlugin_ConstraintParallel.h"
11 #include "SketchPlugin_ConstraintPerpendicular.h"
12 #include <ModelAPI_PluginManager.h>
13 #include <ModelAPI_Document.h>
14
15 using namespace std;
16
17 // the only created instance of this plugin
18 static SketchPlugin_Plugin* MY_INSTANCE = new SketchPlugin_Plugin();
19
20 SketchPlugin_Plugin::SketchPlugin_Plugin() 
21 {
22   // register this plugin
23   ModelAPI_PluginManager::get()->registerPlugin(this);
24 }
25
26 boost::shared_ptr<ModelAPI_Feature> SketchPlugin_Plugin::createFeature(string theFeatureID)
27 {
28   if (theFeatureID == "Sketch") {
29     return boost::shared_ptr<ModelAPI_Feature>(new SketchPlugin_Sketch);
30   }
31   else if (theFeatureID == "SketchPoint") {
32     return boost::shared_ptr<ModelAPI_Feature>(new SketchPlugin_Point);
33   }
34   else if (theFeatureID == "SketchLine") {
35     return boost::shared_ptr<ModelAPI_Feature>(new SketchPlugin_Line);
36   }
37   else if (theFeatureID == "SketchCircle") {
38     return boost::shared_ptr<ModelAPI_Feature>(new SketchPlugin_Circle);
39   }
40   else if (theFeatureID == "SketchConstraintCoincidence") {
41     return boost::shared_ptr<ModelAPI_Feature>(new SketchPlugin_ConstraintCoincidence);
42   }
43   else if (theFeatureID == "SketchConstraintDistance") {
44     return boost::shared_ptr<ModelAPI_Feature>(new SketchPlugin_ConstraintDistance);
45   }
46   else if (theFeatureID == "SketchConstraintDiameter") {
47     return boost::shared_ptr<ModelAPI_Feature>(new SketchPlugin_ConstraintDiameter);
48   }
49   else if (theFeatureID == "SketchConstraintParallel") {
50     return boost::shared_ptr<ModelAPI_Feature>(new SketchPlugin_ConstraintParallel);
51   }
52   else if (theFeatureID == "SketchConstraintPerpendicular") {
53     return boost::shared_ptr<ModelAPI_Feature>(new SketchPlugin_ConstraintPerpendicular);
54   }
55   // feature of such kind is not found
56   return boost::shared_ptr<ModelAPI_Feature>();
57 }