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_ExtrusionCut.h>
8 #include <FeaturesPlugin_ExtrusionFuse.h>
9 #include <FeaturesPlugin_Group.h>
10 #include <FeaturesPlugin_Intersection.h>
11 #include <FeaturesPlugin_Translation.h>
12 #include <FeaturesPlugin_Partition.h>
13 #include <FeaturesPlugin_Pipe.h>
14 #include <FeaturesPlugin_Placement.h>
15 #include <FeaturesPlugin_Revolution.h>
16 #include <FeaturesPlugin_RevolutionCut.h>
17 #include <FeaturesPlugin_RevolutionFuse.h>
18 #include <FeaturesPlugin_Rotation.h>
19 #include <FeaturesPlugin_ValidatorTransform.h>
20 #include <FeaturesPlugin_Validators.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);
39 aFactory->registerValidator("FeaturesPlugin_ValidatorCompositeLauncher",
40 new FeaturesPlugin_ValidatorCompositeLauncher);
41 aFactory->registerValidator("FeaturesPlugin_ValidatorBaseForGeneration",
42 new FeaturesPlugin_ValidatorBaseForGeneration);
43 aFactory->registerValidator("FeaturesPlugin_ValidatorPipeLocations",
44 new FeaturesPlugin_ValidatorPipeLocations);
45 aFactory->registerValidator("FeaturesPlugin_ValidatorCanBeEmpty",
46 new FeaturesPlugin_ValidatorCanBeEmpty);
48 // register this plugin
49 ModelAPI_Session::get()->registerPlugin(this);
52 FeaturePtr FeaturesPlugin_Plugin::createFeature(string theFeatureID)
54 if (theFeatureID == FeaturesPlugin_Extrusion::ID()) {
55 return FeaturePtr(new FeaturesPlugin_Extrusion);
56 } else if (theFeatureID == FeaturesPlugin_Revolution::ID()) {
57 return FeaturePtr(new FeaturesPlugin_Revolution);
58 } else if (theFeatureID == FeaturesPlugin_Rotation::ID()) {
59 return FeaturePtr(new FeaturesPlugin_Rotation);
60 } else if (theFeatureID == FeaturesPlugin_Translation::ID()) {
61 return FeaturePtr(new FeaturesPlugin_Translation);
62 } else if (theFeatureID == FeaturesPlugin_Boolean::ID()) {
63 return FeaturePtr(new FeaturesPlugin_Boolean);
64 } else if (theFeatureID == FeaturesPlugin_Group::ID()) {
65 return FeaturePtr(new FeaturesPlugin_Group);
66 } else if (theFeatureID == FeaturesPlugin_Intersection::ID()) {
67 return FeaturePtr(new FeaturesPlugin_Intersection);
68 } else if (theFeatureID == FeaturesPlugin_Partition::ID()) {
69 return FeaturePtr(new FeaturesPlugin_Partition);
70 } else if (theFeatureID == FeaturesPlugin_Pipe::ID()) {
71 return FeaturePtr(new FeaturesPlugin_Pipe);
72 } else if (theFeatureID == FeaturesPlugin_Placement::ID()) {
73 return FeaturePtr(new FeaturesPlugin_Placement);
74 } else if (theFeatureID == FeaturesPlugin_ExtrusionCut::ID()) {
75 return FeaturePtr(new FeaturesPlugin_ExtrusionCut);
76 } else if (theFeatureID == FeaturesPlugin_ExtrusionFuse::ID()) {
77 return FeaturePtr(new FeaturesPlugin_ExtrusionFuse);
78 } else if (theFeatureID == FeaturesPlugin_RevolutionCut::ID()) {
79 return FeaturePtr(new FeaturesPlugin_RevolutionCut);
80 } else if (theFeatureID == FeaturesPlugin_RevolutionFuse::ID()) {
81 return FeaturePtr(new FeaturesPlugin_RevolutionFuse);
83 // feature of such kind is not found