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_Placement.h>
15 #include <FeaturesPlugin_Revolution.h>
16 #include <FeaturesPlugin_RevolutionSketch.h>
17 #include <FeaturesPlugin_RevolutionCut.h>
18 #include <FeaturesPlugin_RevolutionFuse.h>
19 #include <FeaturesPlugin_Rotation.h>
20 #include <FeaturesPlugin_ValidatorTransform.h>
22 #include <ModelAPI_Session.h>
30 // the only created instance of this plugin
31 static FeaturesPlugin_Plugin* MY_FEATURES_INSTANCE = new FeaturesPlugin_Plugin();
33 FeaturesPlugin_Plugin::FeaturesPlugin_Plugin()
35 SessionPtr aMgr = ModelAPI_Session::get();
36 ModelAPI_ValidatorsFactory* aFactory = aMgr->validators();
37 aFactory->registerValidator("FeaturesPlugin_ValidatorTransform",
38 new FeaturesPlugin_ValidatorTransform);
40 // register this plugin
41 ModelAPI_Session::get()->registerPlugin(this);
44 FeaturePtr FeaturesPlugin_Plugin::createFeature(string theFeatureID)
46 if (theFeatureID == FeaturesPlugin_Extrusion::ID()) {
47 return FeaturePtr(new FeaturesPlugin_Extrusion);
48 } else if (theFeatureID == FeaturesPlugin_Revolution::ID()) {
49 return FeaturePtr(new FeaturesPlugin_Revolution);
50 } else if (theFeatureID == FeaturesPlugin_Rotation::ID()) {
51 return FeaturePtr(new FeaturesPlugin_Rotation);
52 } else if (theFeatureID == FeaturesPlugin_Translation::ID()) {
53 return FeaturePtr(new FeaturesPlugin_Translation);
54 } else if (theFeatureID == FeaturesPlugin_Boolean::ID()) {
55 return FeaturePtr(new FeaturesPlugin_Boolean);
56 } else if (theFeatureID == FeaturesPlugin_Group::ID()) {
57 return FeaturePtr(new FeaturesPlugin_Group);
58 } else if (theFeatureID == FeaturesPlugin_Intersection::ID()) {
59 return FeaturePtr(new FeaturesPlugin_Intersection);
60 } else if (theFeatureID == FeaturesPlugin_Partition::ID()) {
61 return FeaturePtr(new FeaturesPlugin_Partition);
62 } else if (theFeatureID == FeaturesPlugin_Placement::ID()) {
63 return FeaturePtr(new FeaturesPlugin_Placement);
64 } else if (theFeatureID == FeaturesPlugin_ExtrusionCut::ID()) {
65 return FeaturePtr(new FeaturesPlugin_ExtrusionCut);
66 } else if (theFeatureID == FeaturesPlugin_ExtrusionFuse::ID()) {
67 return FeaturePtr(new FeaturesPlugin_ExtrusionFuse);
68 } else if (theFeatureID == FeaturesPlugin_RevolutionCut::ID()) {
69 return FeaturePtr(new FeaturesPlugin_RevolutionCut);
70 } else if (theFeatureID == FeaturesPlugin_RevolutionFuse::ID()) {
71 return FeaturePtr(new FeaturesPlugin_RevolutionFuse);
72 } else if (theFeatureID == FeaturesPlugin_ExtrusionSketch::ID()) {
73 return FeaturePtr(new FeaturesPlugin_ExtrusionSketch);
74 } else if (theFeatureID == FeaturesPlugin_RevolutionSketch::ID()) {
75 return FeaturePtr(new FeaturesPlugin_RevolutionSketch);
77 // feature of such kind is not found