Salome HOME
It replaces direct names of constraints to the specific kind.
[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_ConstraintLength.h"
10 #include "SketchPlugin_ConstraintParallel.h"
11 #include "SketchPlugin_ConstraintPerpendicular.h"
12 #include "SketchPlugin_ConstraintRadius.h"
13 #include <ModelAPI_PluginManager.h>
14 #include <ModelAPI_Document.h>
15
16 using namespace std;
17
18 // the only created instance of this plugin
19 static SketchPlugin_Plugin* MY_INSTANCE = new SketchPlugin_Plugin();
20
21 SketchPlugin_Plugin::SketchPlugin_Plugin() 
22 {
23   // register this plugin
24   ModelAPI_PluginManager::get()->registerPlugin(this);
25 }
26
27 boost::shared_ptr<ModelAPI_Feature> SketchPlugin_Plugin::createFeature(string theFeatureID)
28 {
29   if (theFeatureID == SKETCH_KIND) {
30     return boost::shared_ptr<ModelAPI_Feature>(new SketchPlugin_Sketch);
31   }
32   else if (theFeatureID == SKETCH_POINT_KIND) {
33     return boost::shared_ptr<ModelAPI_Feature>(new SketchPlugin_Point);
34   }
35   else if (theFeatureID == SKETCH_LINE_KIND) {
36     return boost::shared_ptr<ModelAPI_Feature>(new SketchPlugin_Line);
37   }
38   else if (theFeatureID == SKETCH_CIRCLE_KIND) {
39     return boost::shared_ptr<ModelAPI_Feature>(new SketchPlugin_Circle);
40   }
41   else if (theFeatureID == SKETCH_CONSTRAINT_COINCIDENCE_KIND) {
42     return boost::shared_ptr<ModelAPI_Feature>(new SketchPlugin_ConstraintCoincidence);
43   }
44   else if (theFeatureID == SKETCH_CONSTRAINT_DISTANCE_KIND) {
45     return boost::shared_ptr<ModelAPI_Feature>(new SketchPlugin_ConstraintDistance);
46   }
47   else if (theFeatureID == SKETCH_CONSTRAINT_LENGTH_KIND) {
48     return boost::shared_ptr<ModelAPI_Feature>(new SketchPlugin_ConstraintLength);
49   }
50   else if (theFeatureID == SKETCH_CONSTRAINT_PARALLEL_KIND) {
51     return boost::shared_ptr<ModelAPI_Feature>(new SketchPlugin_ConstraintParallel);
52   }
53   else if (theFeatureID == SKETCH_CONSTRAINT_PERPENDICULAR_KIND) {
54     return boost::shared_ptr<ModelAPI_Feature>(new SketchPlugin_ConstraintPerpendicular);
55   }
56   else if (theFeatureID == SKETCH_CONSTRAINT_RADIUS_KIND) {
57     return boost::shared_ptr<ModelAPI_Feature>(new SketchPlugin_ConstraintRadius);
58   }
59   // feature of such kind is not found
60   return boost::shared_ptr<ModelAPI_Feature>();
61 }