1 // Copyright (C) 2014-2017 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or
18 // email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
21 #include <FeaturesPlugin_Plugin.h>
23 #include <FeaturesPlugin_Boolean.h>
24 #include <FeaturesPlugin_Extrusion.h>
25 #include <FeaturesPlugin_ExtrusionCut.h>
26 #include <FeaturesPlugin_ExtrusionFuse.h>
27 #include <FeaturesPlugin_Intersection.h>
28 #include <FeaturesPlugin_MultiTranslation.h>
29 #include <FeaturesPlugin_Partition.h>
30 #include <FeaturesPlugin_Pipe.h>
31 #include <FeaturesPlugin_Placement.h>
32 #include <FeaturesPlugin_Recover.h>
33 #include <FeaturesPlugin_RemoveSubShapes.h>
34 #include <FeaturesPlugin_Revolution.h>
35 #include <FeaturesPlugin_RevolutionCut.h>
36 #include <FeaturesPlugin_RevolutionFuse.h>
37 #include <FeaturesPlugin_Rotation.h>
38 #include <FeaturesPlugin_Scale.h>
39 #include <FeaturesPlugin_Symmetry.h>
40 #include <FeaturesPlugin_Translation.h>
41 #include <FeaturesPlugin_Union.h>
42 #include <FeaturesPlugin_ValidatorTransform.h>
43 #include <FeaturesPlugin_Validators.h>
45 #include <ModelAPI_Session.h>
51 // the only created instance of this plugin
52 static FeaturesPlugin_Plugin* MY_FEATURES_INSTANCE = new FeaturesPlugin_Plugin();
54 FeaturesPlugin_Plugin::FeaturesPlugin_Plugin()
56 SessionPtr aMgr = ModelAPI_Session::get();
57 ModelAPI_ValidatorsFactory* aFactory = aMgr->validators();
58 aFactory->registerValidator("FeaturesPlugin_ValidatorTransform",
59 new FeaturesPlugin_ValidatorTransform);
60 aFactory->registerValidator("FeaturesPlugin_ValidatorCompositeLauncher",
61 new FeaturesPlugin_ValidatorCompositeLauncher);
62 aFactory->registerValidator("FeaturesPlugin_ValidatorBaseForGeneration",
63 new FeaturesPlugin_ValidatorBaseForGeneration);
64 aFactory->registerValidator("FeaturesPlugin_ValidatorBaseForGenerationSketchOrSketchObjects",
65 new FeaturesPlugin_ValidatorBaseForGenerationSketchOrSketchObjects);
66 aFactory->registerValidator("FeaturesPlugin_ValidatorPipeLocations",
67 new FeaturesPlugin_ValidatorPipeLocations);
68 aFactory->registerValidator("FeaturesPlugin_ValidatorExtrusionDir",
69 new FeaturesPlugin_ValidatorExtrusionDir);
70 aFactory->registerValidator("FeaturesPlugin_ValidatorBooleanSelection",
71 new FeaturesPlugin_ValidatorBooleanSelection);
72 aFactory->registerValidator("FeaturesPlugin_ValidatorPartitionSelection",
73 new FeaturesPlugin_ValidatorPartitionSelection);
74 aFactory->registerValidator("FeaturesPlugin_ValidatorRemoveSubShapesSelection",
75 new FeaturesPlugin_ValidatorRemoveSubShapesSelection);
76 aFactory->registerValidator("FeaturesPlugin_ValidatorRemoveSubShapesResult",
77 new FeaturesPlugin_ValidatorRemoveSubShapesResult);
78 aFactory->registerValidator("FeaturesPlugin_ValidatorPipePath",
79 new FeaturesPlugin_ValidatorPipePath);
80 aFactory->registerValidator("FeaturesPlugin_ValidatorUnionSelection",
81 new FeaturesPlugin_ValidatorUnionSelection);
82 aFactory->registerValidator("FeaturesPlugin_ValidatorUnionArguments",
83 new FeaturesPlugin_ValidatorUnionArguments);
84 aFactory->registerValidator("FeaturesPlugin_ValidatorConcealedResult",
85 new FeaturesPlugin_ValidatorConcealedResult);
87 // register this plugin
88 ModelAPI_Session::get()->registerPlugin(this);
91 FeaturePtr FeaturesPlugin_Plugin::createFeature(std::string theFeatureID)
93 if (theFeatureID == FeaturesPlugin_Extrusion::ID()) {
94 return FeaturePtr(new FeaturesPlugin_Extrusion);
95 } else if (theFeatureID == FeaturesPlugin_Revolution::ID()) {
96 return FeaturePtr(new FeaturesPlugin_Revolution);
97 } else if (theFeatureID == FeaturesPlugin_Rotation::ID()) {
98 return FeaturePtr(new FeaturesPlugin_Rotation);
99 } else if (theFeatureID == FeaturesPlugin_Translation::ID()) {
100 return FeaturePtr(new FeaturesPlugin_Translation);
101 } else if (theFeatureID == FeaturesPlugin_Boolean::ID()) {
102 return FeaturePtr(new FeaturesPlugin_Boolean);
103 } else if (theFeatureID == FeaturesPlugin_Intersection::ID()) {
104 return FeaturePtr(new FeaturesPlugin_Intersection);
105 } else if (theFeatureID == FeaturesPlugin_Partition::ID()) {
106 return FeaturePtr(new FeaturesPlugin_Partition);
107 } else if (theFeatureID == FeaturesPlugin_Pipe::ID()) {
108 return FeaturePtr(new FeaturesPlugin_Pipe);
109 } else if (theFeatureID == FeaturesPlugin_Placement::ID()) {
110 return FeaturePtr(new FeaturesPlugin_Placement);
111 } else if (theFeatureID == FeaturesPlugin_Recover::ID()) {
112 return FeaturePtr(new FeaturesPlugin_Recover);
113 } else if (theFeatureID == FeaturesPlugin_ExtrusionCut::ID()) {
114 return FeaturePtr(new FeaturesPlugin_ExtrusionCut);
115 } else if (theFeatureID == FeaturesPlugin_ExtrusionFuse::ID()) {
116 return FeaturePtr(new FeaturesPlugin_ExtrusionFuse);
117 } else if (theFeatureID == FeaturesPlugin_RevolutionCut::ID()) {
118 return FeaturePtr(new FeaturesPlugin_RevolutionCut);
119 } else if (theFeatureID == FeaturesPlugin_RevolutionFuse::ID()) {
120 return FeaturePtr(new FeaturesPlugin_RevolutionFuse);
121 } else if (theFeatureID == FeaturesPlugin_RemoveSubShapes::ID()) {
122 return FeaturePtr(new FeaturesPlugin_RemoveSubShapes);
123 } else if (theFeatureID == FeaturesPlugin_Union::ID()) {
124 return FeaturePtr(new FeaturesPlugin_Union);
125 } else if (theFeatureID == FeaturesPlugin_Symmetry::ID()) {
126 return FeaturePtr(new FeaturesPlugin_Symmetry);
127 } else if (theFeatureID == FeaturesPlugin_Scale::ID()) {
128 return FeaturePtr(new FeaturesPlugin_Scale);
129 } else if (theFeatureID == FeaturesPlugin_MultiTranslation::ID()) {
130 return FeaturePtr(new FeaturesPlugin_MultiTranslation);
133 // feature of such kind is not found