]> SALOME platform Git repositories - modules/shaper.git/blob - src/SketchPlugin/SketchPlugin_Plugin.cpp
Salome HOME
687e2cd94d0f8055ddaa4ed18a31a0d0ee90c281
[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 "SketchPlugin_Validators.h"
14 #include <ModelAPI_PluginManager.h>
15 #include <ModelAPI_Document.h>
16 #include <ModelAPI_Validator.h>
17
18 using namespace std;
19
20 // the only created instance of this plugin
21 static SketchPlugin_Plugin* MY_INSTANCE = new SketchPlugin_Plugin();
22
23 SketchPlugin_Plugin::SketchPlugin_Plugin() 
24 {
25   PluginManagerPtr aMgr = ModelAPI_PluginManager::get();
26   ModelAPI_ValidatorsFactory* aFactory = aMgr->validators();
27   aFactory->registerValidator("SketchPlugin_DistanceFeatureValidator", new SketchPlugin_DistanceFeatureValidator);
28
29   // register this plugin
30   ModelAPI_PluginManager::get()->registerPlugin(this);
31 }
32
33 FeaturePtr SketchPlugin_Plugin::createFeature(string theFeatureID)
34 {
35   if (theFeatureID == SketchPlugin_Sketch::ID()) {
36     return FeaturePtr(new SketchPlugin_Sketch);
37   }
38   else if (theFeatureID == SketchPlugin_Point::ID()) {
39     return FeaturePtr(new SketchPlugin_Point);
40   }
41   else if (theFeatureID == SketchPlugin_Line::ID()) {
42     return FeaturePtr(new SketchPlugin_Line);
43   }
44   else if (theFeatureID == SketchPlugin_Circle::ID()) {
45     return FeaturePtr(new SketchPlugin_Circle);
46   }
47   else if (theFeatureID == SketchPlugin_Arc::ID()) {
48     return FeaturePtr(new SketchPlugin_Arc);
49   }
50   else if (theFeatureID == SketchPlugin_ConstraintCoincidence::ID()) {
51     return FeaturePtr(new SketchPlugin_ConstraintCoincidence);
52   }
53   else if (theFeatureID == SketchPlugin_ConstraintDistance::ID()) {
54     return FeaturePtr(new SketchPlugin_ConstraintDistance);
55   }
56   else if (theFeatureID == SketchPlugin_ConstraintLength::ID()) {
57     return FeaturePtr(new SketchPlugin_ConstraintLength);
58   }
59   else if (theFeatureID == SketchPlugin_ConstraintParallel::ID()) {
60     return FeaturePtr(new SketchPlugin_ConstraintParallel);
61   }
62   else if (theFeatureID == SketchPlugin_ConstraintPerpendicular::ID()) {
63     return FeaturePtr(new SketchPlugin_ConstraintPerpendicular);
64   }
65   else if (theFeatureID == SketchPlugin_ConstraintRadius::ID()) {
66     return FeaturePtr(new SketchPlugin_ConstraintRadius);
67   }
68   // feature of such kind is not found
69   return FeaturePtr();
70 }