1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
3 #include <FeaturesPlugin_Plugin.h>
5 #include <FeaturesPlugin_Boolean.h>
6 #include <FeaturesPlugin_Extrusion.h>
7 #include <FeaturesPlugin_ExtrusionSketch.h>
8 #include <FeaturesPlugin_ExtrusionCut.h>
9 #include <FeaturesPlugin_ExtrusionFuse.h>
10 #include <FeaturesPlugin_Group.h>
11 #include <FeaturesPlugin_Intersection.h>
12 #include <FeaturesPlugin_Translation.h>
13 #include <FeaturesPlugin_Partition.h>
14 #include <FeaturesPlugin_Pipe.h>
15 #include <FeaturesPlugin_Placement.h>
16 #include <FeaturesPlugin_Revolution.h>
17 #include <FeaturesPlugin_RevolutionSketch.h>
18 #include <FeaturesPlugin_RevolutionCut.h>
19 #include <FeaturesPlugin_RevolutionFuse.h>
20 #include <FeaturesPlugin_Rotation.h>
21 #include <FeaturesPlugin_ValidatorTransform.h>
22 #include <FeaturesPlugin_Validators.h>
24 #include <ModelAPI_Session.h>
32 // the only created instance of this plugin
33 static FeaturesPlugin_Plugin* MY_FEATURES_INSTANCE = new FeaturesPlugin_Plugin();
35 FeaturesPlugin_Plugin::FeaturesPlugin_Plugin()
37 SessionPtr aMgr = ModelAPI_Session::get();
38 ModelAPI_ValidatorsFactory* aFactory = aMgr->validators();
39 aFactory->registerValidator("FeaturesPlugin_ValidatorTransform",
40 new FeaturesPlugin_ValidatorTransform);
41 aFactory->registerValidator("FeaturesPlugin_PipeLocationsValidator",
42 new FeaturesPlugin_PipeLocationsValidator);
44 // register this plugin
45 ModelAPI_Session::get()->registerPlugin(this);
48 FeaturePtr FeaturesPlugin_Plugin::createFeature(string theFeatureID)
50 if (theFeatureID == FeaturesPlugin_Extrusion::ID()) {
51 return FeaturePtr(new FeaturesPlugin_Extrusion);
52 } else if (theFeatureID == FeaturesPlugin_Revolution::ID()) {
53 return FeaturePtr(new FeaturesPlugin_Revolution);
54 } else if (theFeatureID == FeaturesPlugin_Rotation::ID()) {
55 return FeaturePtr(new FeaturesPlugin_Rotation);
56 } else if (theFeatureID == FeaturesPlugin_Translation::ID()) {
57 return FeaturePtr(new FeaturesPlugin_Translation);
58 } else if (theFeatureID == FeaturesPlugin_Boolean::ID()) {
59 return FeaturePtr(new FeaturesPlugin_Boolean);
60 } else if (theFeatureID == FeaturesPlugin_Group::ID()) {
61 return FeaturePtr(new FeaturesPlugin_Group);
62 } else if (theFeatureID == FeaturesPlugin_Intersection::ID()) {
63 return FeaturePtr(new FeaturesPlugin_Intersection);
64 } else if (theFeatureID == FeaturesPlugin_Partition::ID()) {
65 return FeaturePtr(new FeaturesPlugin_Partition);
66 } else if (theFeatureID == FeaturesPlugin_Pipe::ID()) {
67 return FeaturePtr(new FeaturesPlugin_Pipe);
68 } else if (theFeatureID == FeaturesPlugin_Placement::ID()) {
69 return FeaturePtr(new FeaturesPlugin_Placement);
70 } else if (theFeatureID == FeaturesPlugin_ExtrusionCut::ID()) {
71 return FeaturePtr(new FeaturesPlugin_ExtrusionCut);
72 } else if (theFeatureID == FeaturesPlugin_ExtrusionFuse::ID()) {
73 return FeaturePtr(new FeaturesPlugin_ExtrusionFuse);
74 } else if (theFeatureID == FeaturesPlugin_RevolutionCut::ID()) {
75 return FeaturePtr(new FeaturesPlugin_RevolutionCut);
76 } else if (theFeatureID == FeaturesPlugin_RevolutionFuse::ID()) {
77 return FeaturePtr(new FeaturesPlugin_RevolutionFuse);
78 } else if (theFeatureID == FeaturesPlugin_ExtrusionSketch::ID()) {
79 return FeaturePtr(new FeaturesPlugin_ExtrusionSketch);
80 } else if (theFeatureID == FeaturesPlugin_RevolutionSketch::ID()) {
81 return FeaturePtr(new FeaturesPlugin_RevolutionSketch);
83 // feature of such kind is not found