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_BooleanCut.h>
24 #include <FeaturesPlugin_BooleanFuse.h>
25 #include <FeaturesPlugin_BooleanCommon.h>
26 #include <FeaturesPlugin_BooleanSmash.h>
27 #include <FeaturesPlugin_BooleanFill.h>
28 #include <FeaturesPlugin_Extrusion.h>
29 #include <FeaturesPlugin_ExtrusionCut.h>
30 #include <FeaturesPlugin_ExtrusionFuse.h>
31 #include <FeaturesPlugin_Fillet.h>
32 #include <FeaturesPlugin_Intersection.h>
33 #include <FeaturesPlugin_Measurement.h>
34 #include <FeaturesPlugin_MultiRotation.h>
35 #include <FeaturesPlugin_MultiTranslation.h>
36 #include <FeaturesPlugin_Partition.h>
37 #include <FeaturesPlugin_Pipe.h>
38 #include <FeaturesPlugin_Placement.h>
39 #include <FeaturesPlugin_Recover.h>
40 #include <FeaturesPlugin_RemoveSubShapes.h>
41 #include <FeaturesPlugin_Revolution.h>
42 #include <FeaturesPlugin_RevolutionCut.h>
43 #include <FeaturesPlugin_RevolutionFuse.h>
44 #include <FeaturesPlugin_Rotation.h>
45 #include <FeaturesPlugin_Scale.h>
46 #include <FeaturesPlugin_Symmetry.h>
47 #include <FeaturesPlugin_Translation.h>
48 #include <FeaturesPlugin_Union.h>
49 #include <FeaturesPlugin_FusionFaces.h>
50 #include <FeaturesPlugin_ValidatorTransform.h>
51 #include <FeaturesPlugin_Validators.h>
53 #include <ModelAPI_Session.h>
59 // the only created instance of this plugin
60 static FeaturesPlugin_Plugin* MY_FEATURES_INSTANCE = new FeaturesPlugin_Plugin();
62 FeaturesPlugin_Plugin::FeaturesPlugin_Plugin()
64 SessionPtr aMgr = ModelAPI_Session::get();
65 ModelAPI_ValidatorsFactory* aFactory = aMgr->validators();
66 aFactory->registerValidator("FeaturesPlugin_ValidatorTransform",
67 new FeaturesPlugin_ValidatorTransform);
68 aFactory->registerValidator("FeaturesPlugin_ValidatorCompositeLauncher",
69 new FeaturesPlugin_ValidatorCompositeLauncher);
70 aFactory->registerValidator("FeaturesPlugin_ValidatorBaseForGeneration",
71 new FeaturesPlugin_ValidatorBaseForGeneration);
72 aFactory->registerValidator("FeaturesPlugin_ValidatorBaseForGenerationSketchOrSketchObjects",
73 new FeaturesPlugin_ValidatorBaseForGenerationSketchOrSketchObjects);
74 aFactory->registerValidator("FeaturesPlugin_ValidatorPipeLocations",
75 new FeaturesPlugin_ValidatorPipeLocations);
76 aFactory->registerValidator("FeaturesPlugin_ValidatorPipeLocationsNumber",
77 new FeaturesPlugin_ValidatorPipeLocationsNumber);
78 aFactory->registerValidator("FeaturesPlugin_ValidatorExtrusionDir",
79 new FeaturesPlugin_ValidatorExtrusionDir);
80 aFactory->registerValidator("FeaturesPlugin_ValidatorBooleanSelection",
81 new FeaturesPlugin_ValidatorBooleanSelection);
82 aFactory->registerValidator("FeaturesPlugin_ValidatorPartitionSelection",
83 new FeaturesPlugin_ValidatorPartitionSelection);
84 aFactory->registerValidator("FeaturesPlugin_ValidatorRemoveSubShapesSelection",
85 new FeaturesPlugin_ValidatorRemoveSubShapesSelection);
86 aFactory->registerValidator("FeaturesPlugin_ValidatorRemoveSubShapesResult",
87 new FeaturesPlugin_ValidatorRemoveSubShapesResult);
88 aFactory->registerValidator("FeaturesPlugin_ValidatorPipePath",
89 new FeaturesPlugin_ValidatorPipePath);
90 aFactory->registerValidator("FeaturesPlugin_ValidatorUnionSelection",
91 new FeaturesPlugin_ValidatorUnionSelection);
92 aFactory->registerValidator("FeaturesPlugin_ValidatorUnionArguments",
93 new FeaturesPlugin_ValidatorUnionArguments);
94 aFactory->registerValidator("FeaturesPlugin_ValidatorConcealedResult",
95 new FeaturesPlugin_ValidatorConcealedResult);
96 aFactory->registerValidator("FeaturesPlugin_ValidatorFilletSelection",
97 new FeaturesPlugin_ValidatorFilletSelection);
98 aFactory->registerValidator("FeaturesPlugin_ValidatorCircular",
99 new FeaturesPlugin_ValidatorCircular);
100 aFactory->registerValidator("FeaturesPlugin_ValidatorBooleanArguments",
101 new FeaturesPlugin_ValidatorBooleanArguments);
102 aFactory->registerValidator("FeaturesPlugin_ValidatorBooleanSmashSelection",
103 new FeaturesPlugin_ValidatorBooleanSmashSelection);
104 aFactory->registerValidator("FeaturesPlugin_IntersectionSelection",
105 new FeaturesPlugin_IntersectionSelection);
106 aFactory->registerValidator("FeaturesPlugin_ValidatorBooleanFuseSelection",
107 new FeaturesPlugin_ValidatorBooleanFuseSelection);
108 aFactory->registerValidator("FeaturesPlugin_ValidatorBooleanFuseArguments",
109 new FeaturesPlugin_ValidatorBooleanFuseArguments);
110 aFactory->registerValidator("FeaturesPlugin_ValidatorBooleanCommonSelection",
111 new FeaturesPlugin_ValidatorBooleanCommonSelection);
112 aFactory->registerValidator("FeaturesPlugin_ValidatorBooleanCommonArguments",
113 new FeaturesPlugin_ValidatorBooleanCommonArguments);
115 // register this plugin
116 ModelAPI_Session::get()->registerPlugin(this);
119 FeaturePtr FeaturesPlugin_Plugin::createFeature(std::string theFeatureID)
121 if (theFeatureID == FeaturesPlugin_Extrusion::ID()) {
122 return FeaturePtr(new FeaturesPlugin_Extrusion);
123 } else if (theFeatureID == FeaturesPlugin_Revolution::ID()) {
124 return FeaturePtr(new FeaturesPlugin_Revolution);
125 } else if (theFeatureID == FeaturesPlugin_Rotation::ID()) {
126 return FeaturePtr(new FeaturesPlugin_Rotation);
127 } else if (theFeatureID == FeaturesPlugin_Translation::ID()) {
128 return FeaturePtr(new FeaturesPlugin_Translation);
129 } else if (theFeatureID == FeaturesPlugin_BooleanCut::ID()) {
130 return FeaturePtr(new FeaturesPlugin_BooleanCut);
131 } else if (theFeatureID == FeaturesPlugin_BooleanFuse::ID()) {
132 return FeaturePtr(new FeaturesPlugin_BooleanFuse);
133 } else if (theFeatureID == FeaturesPlugin_BooleanCommon::ID()) {
134 return FeaturePtr(new FeaturesPlugin_BooleanCommon);
135 } else if (theFeatureID == FeaturesPlugin_BooleanSmash::ID()) {
136 return FeaturePtr(new FeaturesPlugin_BooleanSmash);
137 } else if (theFeatureID == FeaturesPlugin_BooleanFill::ID()) {
138 return FeaturePtr(new FeaturesPlugin_BooleanFill);
139 } else if (theFeatureID == FeaturesPlugin_Intersection::ID()) {
140 return FeaturePtr(new FeaturesPlugin_Intersection);
141 } else if (theFeatureID == FeaturesPlugin_Partition::ID()) {
142 return FeaturePtr(new FeaturesPlugin_Partition);
143 } else if (theFeatureID == FeaturesPlugin_Pipe::ID()) {
144 return FeaturePtr(new FeaturesPlugin_Pipe);
145 } else if (theFeatureID == FeaturesPlugin_Placement::ID()) {
146 return FeaturePtr(new FeaturesPlugin_Placement);
147 } else if (theFeatureID == FeaturesPlugin_Recover::ID()) {
148 return FeaturePtr(new FeaturesPlugin_Recover);
149 } else if (theFeatureID == FeaturesPlugin_ExtrusionCut::ID()) {
150 return FeaturePtr(new FeaturesPlugin_ExtrusionCut);
151 } else if (theFeatureID == FeaturesPlugin_ExtrusionFuse::ID()) {
152 return FeaturePtr(new FeaturesPlugin_ExtrusionFuse);
153 } else if (theFeatureID == FeaturesPlugin_RevolutionCut::ID()) {
154 return FeaturePtr(new FeaturesPlugin_RevolutionCut);
155 } else if (theFeatureID == FeaturesPlugin_RevolutionFuse::ID()) {
156 return FeaturePtr(new FeaturesPlugin_RevolutionFuse);
157 } else if (theFeatureID == FeaturesPlugin_RemoveSubShapes::ID()) {
158 return FeaturePtr(new FeaturesPlugin_RemoveSubShapes);
159 } else if (theFeatureID == FeaturesPlugin_Union::ID()) {
160 return FeaturePtr(new FeaturesPlugin_Union);
161 } else if (theFeatureID == FeaturesPlugin_FusionFaces::ID()) {
162 return FeaturePtr(new FeaturesPlugin_FusionFaces);
163 } else if (theFeatureID == FeaturesPlugin_Symmetry::ID()) {
164 return FeaturePtr(new FeaturesPlugin_Symmetry);
165 } else if (theFeatureID == FeaturesPlugin_Scale::ID()) {
166 return FeaturePtr(new FeaturesPlugin_Scale);
167 } else if (theFeatureID == FeaturesPlugin_MultiTranslation::ID()) {
168 return FeaturePtr(new FeaturesPlugin_MultiTranslation);
169 } else if (theFeatureID == FeaturesPlugin_MultiRotation::ID()) {
170 return FeaturePtr(new FeaturesPlugin_MultiRotation);
171 } else if (theFeatureID == FeaturesPlugin_Fillet::ID()) {
172 return FeaturePtr(new FeaturesPlugin_Fillet);
173 } else if (theFeatureID == FeaturesPlugin_Measurement::ID()) {
174 return FeaturePtr(new FeaturesPlugin_Measurement);
177 // feature of such kind is not found