Salome HOME
bef72b89daba45c662e0d7ba3e670cb0ecc9b5c1
[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_ConstraintCoincidence.h"
5 #include <ModelAPI_PluginManager.h>
6 #include <ModelAPI_Document.h>
7
8 using namespace std;
9
10 // the only created instance of this plugin
11 static SketchPlugin_Plugin* MY_INSTANCE = new SketchPlugin_Plugin();
12
13 SketchPlugin_Plugin::SketchPlugin_Plugin() 
14 {
15   // register this plugin
16   ModelAPI_PluginManager::get()->registerPlugin(this);
17 }
18
19 boost::shared_ptr<ModelAPI_Feature> SketchPlugin_Plugin::createFeature(string theFeatureID)
20 {
21   if (theFeatureID == "Sketch") {
22     return boost::shared_ptr<ModelAPI_Feature>(new SketchPlugin_Sketch);
23   }
24   else if (theFeatureID == "SketchLine") {
25     return boost::shared_ptr<ModelAPI_Feature>(new SketchPlugin_Line);
26   }
27   else if (theFeatureID == "SketchConstraintCoincidence") {
28     return boost::shared_ptr<ModelAPI_Feature>(new SketchPlugin_ConstraintCoincidence);
29   }
30   // feature of such kind is not found
31   return boost::shared_ptr<ModelAPI_Feature>();
32 }