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>
17 // the only created instance of this plugin
18 static SketchPlugin_Plugin* MY_INSTANCE = new SketchPlugin_Plugin();
20 SketchPlugin_Plugin::SketchPlugin_Plugin()
22 // register this plugin
23 ModelAPI_PluginManager::get()->registerPlugin(this);
26 boost::shared_ptr<ModelAPI_Feature> SketchPlugin_Plugin::createFeature(string theFeatureID)
28 if (theFeatureID == "Sketch") {
29 return boost::shared_ptr<ModelAPI_Feature>(new SketchPlugin_Sketch);
31 else if (theFeatureID == "SketchPoint") {
32 return boost::shared_ptr<ModelAPI_Feature>(new SketchPlugin_Point);
34 else if (theFeatureID == "SketchLine") {
35 return boost::shared_ptr<ModelAPI_Feature>(new SketchPlugin_Line);
37 else if (theFeatureID == "SketchCircle") {
38 return boost::shared_ptr<ModelAPI_Feature>(new SketchPlugin_Circle);
40 else if (theFeatureID == "SketchConstraintCoincidence") {
41 return boost::shared_ptr<ModelAPI_Feature>(new SketchPlugin_ConstraintCoincidence);
43 else if (theFeatureID == "SketchConstraintDistance") {
44 return boost::shared_ptr<ModelAPI_Feature>(new SketchPlugin_ConstraintDistance);
46 else if (theFeatureID == "SketchConstraintDiameter") {
47 return boost::shared_ptr<ModelAPI_Feature>(new SketchPlugin_ConstraintDiameter);
49 else if (theFeatureID == "SketchConstraintParallel") {
50 return boost::shared_ptr<ModelAPI_Feature>(new SketchPlugin_ConstraintParallel);
52 else if (theFeatureID == "SketchConstraintPerpendicular") {
53 return boost::shared_ptr<ModelAPI_Feature>(new SketchPlugin_ConstraintPerpendicular);
55 // feature of such kind is not found
56 return boost::shared_ptr<ModelAPI_Feature>();