1 // Copyright (C) 2014-2022 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 email : webmaster.salome@opencascade.com
20 #include <FeaturesPlugin_Plugin.h>
22 #include <FeaturesPlugin_BooleanCut.h>
23 #include <FeaturesPlugin_BooleanFuse.h>
24 #include <FeaturesPlugin_BooleanCommon.h>
25 #include <FeaturesPlugin_BooleanSmash.h>
26 #include <FeaturesPlugin_BooleanFill.h>
27 #include <FeaturesPlugin_BoundingBox.h>
28 #include <FeaturesPlugin_Chamfer.h>
29 #include <FeaturesPlugin_Defeaturing.h>
30 #include <FeaturesPlugin_Extrusion.h>
31 #include <FeaturesPlugin_ExtrusionCut.h>
32 #include <FeaturesPlugin_ExtrusionFuse.h>
33 #include <FeaturesPlugin_Fillet.h>
34 #include <FeaturesPlugin_Fillet1D.h>
35 #include <FeaturesPlugin_GeometryCalculation.h>
36 #include <FeaturesPlugin_GlueFaces.h>
37 #include <FeaturesPlugin_InspectBoundingBox.h>
38 #include <FeaturesPlugin_InspectNormalToFace.h>
39 #include <FeaturesPlugin_Intersection.h>
40 #include <FeaturesPlugin_Measurement.h>
41 #include <FeaturesPlugin_PointCoordinates.h>
42 #include <FeaturesPlugin_MultiRotation.h>
43 #include <FeaturesPlugin_MultiTranslation.h>
44 #include <FeaturesPlugin_NormalToFace.h>
45 #include <FeaturesPlugin_Partition.h>
46 #include <FeaturesPlugin_Pipe.h>
47 #include <FeaturesPlugin_Loft.h>
48 #include <FeaturesPlugin_Placement.h>
49 #include <FeaturesPlugin_PointCloudOnFace.h>
50 #include <FeaturesPlugin_Recover.h>
51 #include <FeaturesPlugin_RemoveSubShapes.h>
52 #include <FeaturesPlugin_Revolution.h>
53 #include <FeaturesPlugin_RevolutionCut.h>
54 #include <FeaturesPlugin_RevolutionFuse.h>
55 #include <FeaturesPlugin_Rotation.h>
56 #include <FeaturesPlugin_Scale.h>
57 #include <FeaturesPlugin_Sewing.h>
58 #include <FeaturesPlugin_Symmetry.h>
59 #include <FeaturesPlugin_Translation.h>
60 #include <FeaturesPlugin_Union.h>
61 #include <FeaturesPlugin_FusionFaces.h>
62 #include <FeaturesPlugin_RemoveResults.h>
63 #include <FeaturesPlugin_Copy.h>
64 #include <FeaturesPlugin_ImportResult.h>
65 #include <FeaturesPlugin_ValidatorTransform.h>
66 #include <FeaturesPlugin_Validators.h>
68 #include <ModelAPI_Session.h>
74 // the only created instance of this plugin
75 static FeaturesPlugin_Plugin* MY_FEATURES_INSTANCE = new FeaturesPlugin_Plugin();
77 FeaturesPlugin_Plugin::FeaturesPlugin_Plugin()
79 SessionPtr aMgr = ModelAPI_Session::get();
80 ModelAPI_ValidatorsFactory* aFactory = aMgr->validators();
81 aFactory->registerValidator("FeaturesPlugin_ValidatorTransform",
82 new FeaturesPlugin_ValidatorTransform);
83 aFactory->registerValidator("FeaturesPlugin_ValidatorCompositeLauncher",
84 new FeaturesPlugin_ValidatorCompositeLauncher);
85 aFactory->registerValidator("FeaturesPlugin_ValidatorBaseForGeneration",
86 new FeaturesPlugin_ValidatorBaseForGeneration);
87 aFactory->registerValidator("FeaturesPlugin_ValidatorBaseForGenerationSketchOrSketchObjects",
88 new FeaturesPlugin_ValidatorBaseForGenerationSketchOrSketchObjects);
89 aFactory->registerValidator("FeaturesPlugin_ValidatorPipeLocations",
90 new FeaturesPlugin_ValidatorPipeLocations);
91 aFactory->registerValidator("FeaturesPlugin_ValidatorPipeLocationsNumber",
92 new FeaturesPlugin_ValidatorPipeLocationsNumber);
93 aFactory->registerValidator("FeaturesPlugin_ValidatorLoftSameTypeShape",
94 new FeaturesPlugin_ValidatorLoftSameTypeShape);
95 aFactory->registerValidator("FeaturesPlugin_ValidatorExtrusionDir",
96 new FeaturesPlugin_ValidatorExtrusionDir);
97 aFactory->registerValidator("FeaturesPlugin_ValidatorExtrusionBoundary",
98 new FeaturesPlugin_ValidatorExtrusionBoundaryFace);
99 aFactory->registerValidator("FeaturesPlugin_ValidatorBooleanSelection",
100 new FeaturesPlugin_ValidatorBooleanSelection);
101 aFactory->registerValidator("FeaturesPlugin_ValidatorPartitionSelection",
102 new FeaturesPlugin_ValidatorPartitionSelection);
103 aFactory->registerValidator("FeaturesPlugin_ValidatorRemoveSubShapesSelection",
104 new FeaturesPlugin_ValidatorRemoveSubShapesSelection);
105 aFactory->registerValidator("FeaturesPlugin_ValidatorRemoveSubShapesResult",
106 new FeaturesPlugin_ValidatorRemoveSubShapesResult);
107 aFactory->registerValidator("FeaturesPlugin_ValidatorPipePath",
108 new FeaturesPlugin_ValidatorPipePath);
109 aFactory->registerValidator("FeaturesPlugin_ValidatorUnionSelection",
110 new FeaturesPlugin_ValidatorUnionSelection);
111 aFactory->registerValidator("FeaturesPlugin_ValidatorUnionArguments",
112 new FeaturesPlugin_ValidatorUnionArguments);
113 aFactory->registerValidator("FeaturesPlugin_ValidatorConcealedResult",
114 new FeaturesPlugin_ValidatorConcealedResult);
115 aFactory->registerValidator("FeaturesPlugin_ValidatorFilletSelection",
116 new FeaturesPlugin_ValidatorFilletSelection);
117 aFactory->registerValidator("FeaturesPlugin_ValidatorFillet1DSelection",
118 new FeaturesPlugin_ValidatorFillet1DSelection);
119 aFactory->registerValidator("FeaturesPlugin_ValidatorCircular",
120 new FeaturesPlugin_ValidatorCircular);
121 aFactory->registerValidator("FeaturesPlugin_ValidatorBooleanArguments",
122 new FeaturesPlugin_ValidatorBooleanArguments);
123 aFactory->registerValidator("FeaturesPlugin_ValidatorBooleanSmashSelection",
124 new FeaturesPlugin_ValidatorBooleanSmashSelection);
125 aFactory->registerValidator("FeaturesPlugin_IntersectionSelection",
126 new FeaturesPlugin_IntersectionSelection);
127 aFactory->registerValidator("FeaturesPlugin_ValidatorBooleanFuseSelection",
128 new FeaturesPlugin_ValidatorBooleanFuseSelection);
129 aFactory->registerValidator("FeaturesPlugin_ValidatorBooleanFuseArguments",
130 new FeaturesPlugin_ValidatorBooleanFuseArguments);
131 aFactory->registerValidator("FeaturesPlugin_ValidatorBooleanCommonSelection",
132 new FeaturesPlugin_ValidatorBooleanCommonSelection);
133 aFactory->registerValidator("FeaturesPlugin_ValidatorBooleanCommonArguments",
134 new FeaturesPlugin_ValidatorBooleanCommonArguments);
135 aFactory->registerValidator("FeaturesPlugin_ValidatorImportResults",
136 new FeaturesPlugin_ValidatorImportResults);
137 aFactory->registerValidator("FeaturesPlugin_ValidatorDefeaturingSelection",
138 new FeaturesPlugin_ValidatorDefeaturingSelection);
139 aFactory->registerValidator("FeaturesPlugin_ValidatorSewingSelection",
140 new FeaturesPlugin_ValidatorSewingSelection);
141 aFactory->registerValidator("FeaturesPlugin_ValidatorGlueFacesSelection",
142 new FeaturesPlugin_ValidatorGlueFacesSelection);
144 // register this plugin
145 ModelAPI_Session::get()->registerPlugin(this);
148 FeaturePtr FeaturesPlugin_Plugin::createFeature(std::string theFeatureID)
150 if (theFeatureID == FeaturesPlugin_Extrusion::ID()) {
151 return FeaturePtr(new FeaturesPlugin_Extrusion);
152 } else if (theFeatureID == FeaturesPlugin_Revolution::ID()) {
153 return FeaturePtr(new FeaturesPlugin_Revolution);
154 } else if (theFeatureID == FeaturesPlugin_Rotation::ID()) {
155 return FeaturePtr(new FeaturesPlugin_Rotation);
156 } else if (theFeatureID == FeaturesPlugin_Translation::ID()) {
157 return FeaturePtr(new FeaturesPlugin_Translation);
158 } else if (theFeatureID == FeaturesPlugin_BooleanCut::ID()) {
159 return FeaturePtr(new FeaturesPlugin_BooleanCut);
160 } else if (theFeatureID == FeaturesPlugin_BooleanFuse::ID()) {
161 return FeaturePtr(new FeaturesPlugin_BooleanFuse);
162 } else if (theFeatureID == FeaturesPlugin_BooleanCommon::ID()) {
163 return FeaturePtr(new FeaturesPlugin_BooleanCommon);
164 } else if (theFeatureID == FeaturesPlugin_BooleanSmash::ID()) {
165 return FeaturePtr(new FeaturesPlugin_BooleanSmash);
166 } else if (theFeatureID == FeaturesPlugin_BooleanFill::ID() || theFeatureID == "Fill") {
167 return FeaturePtr(new FeaturesPlugin_BooleanFill);
168 } else if (theFeatureID == FeaturesPlugin_Intersection::ID()) {
169 return FeaturePtr(new FeaturesPlugin_Intersection);
170 } else if (theFeatureID == FeaturesPlugin_Partition::ID()) {
171 return FeaturePtr(new FeaturesPlugin_Partition);
172 } else if (theFeatureID == FeaturesPlugin_Pipe::ID()) {
173 return FeaturePtr(new FeaturesPlugin_Pipe);
174 } else if (theFeatureID == FeaturesPlugin_Loft::ID()) {
175 return FeaturePtr(new FeaturesPlugin_Loft);
176 } else if (theFeatureID == FeaturesPlugin_Placement::ID()) {
177 return FeaturePtr(new FeaturesPlugin_Placement);
178 } else if (theFeatureID == FeaturesPlugin_Recover::ID()) {
179 return FeaturePtr(new FeaturesPlugin_Recover);
180 } else if (theFeatureID == FeaturesPlugin_ExtrusionCut::ID()) {
181 return FeaturePtr(new FeaturesPlugin_ExtrusionCut);
182 } else if (theFeatureID == FeaturesPlugin_ExtrusionFuse::ID()) {
183 return FeaturePtr(new FeaturesPlugin_ExtrusionFuse);
184 } else if (theFeatureID == FeaturesPlugin_RevolutionCut::ID()) {
185 return FeaturePtr(new FeaturesPlugin_RevolutionCut);
186 } else if (theFeatureID == FeaturesPlugin_RevolutionFuse::ID()) {
187 return FeaturePtr(new FeaturesPlugin_RevolutionFuse);
188 } else if (theFeatureID == FeaturesPlugin_RemoveSubShapes::ID()) {
189 return FeaturePtr(new FeaturesPlugin_RemoveSubShapes);
190 } else if (theFeatureID == FeaturesPlugin_Union::ID()) {
191 return FeaturePtr(new FeaturesPlugin_Union);
192 } else if (theFeatureID == FeaturesPlugin_FusionFaces::ID()) {
193 return FeaturePtr(new FeaturesPlugin_FusionFaces);
194 } else if (theFeatureID == FeaturesPlugin_Symmetry::ID()) {
195 return FeaturePtr(new FeaturesPlugin_Symmetry);
196 } else if (theFeatureID == FeaturesPlugin_Scale::ID()) {
197 return FeaturePtr(new FeaturesPlugin_Scale);
198 } else if (theFeatureID == FeaturesPlugin_Sewing::ID()) {
199 return FeaturePtr(new FeaturesPlugin_Sewing);
200 } else if (theFeatureID == FeaturesPlugin_MultiTranslation::ID()) {
201 return FeaturePtr(new FeaturesPlugin_MultiTranslation);
202 } else if (theFeatureID == FeaturesPlugin_MultiRotation::ID()) {
203 return FeaturePtr(new FeaturesPlugin_MultiRotation);
204 } else if (theFeatureID == FeaturesPlugin_Fillet::ID()) {
205 return FeaturePtr(new FeaturesPlugin_Fillet);
206 } else if (theFeatureID == FeaturesPlugin_Fillet1D::ID()) {
207 return FeaturePtr(new FeaturesPlugin_Fillet1D);
208 } else if (theFeatureID == FeaturesPlugin_Measurement::ID()) {
209 return FeaturePtr(new FeaturesPlugin_Measurement);
210 } else if (theFeatureID == FeaturesPlugin_RemoveResults::ID()) {
211 return FeaturePtr(new FeaturesPlugin_RemoveResults);
212 } else if (theFeatureID == FeaturesPlugin_Chamfer::ID()) {
213 return FeaturePtr(new FeaturesPlugin_Chamfer);
214 } else if (theFeatureID == FeaturesPlugin_Copy::ID()) {
215 return FeaturePtr(new FeaturesPlugin_Copy);
216 } else if (theFeatureID == FeaturesPlugin_GlueFaces::ID()) {
217 return FeaturePtr(new FeaturesPlugin_GlueFaces);
218 } else if (theFeatureID == FeaturesPlugin_ImportResult::ID()) {
219 return FeaturePtr(new FeaturesPlugin_ImportResult);
220 } else if (theFeatureID == FeaturesPlugin_Defeaturing::ID()) {
221 return FeaturePtr(new FeaturesPlugin_Defeaturing);
222 } else if (theFeatureID == FeaturesPlugin_PointCoordinates::ID()) {
223 return FeaturePtr(new FeaturesPlugin_PointCoordinates);
224 } else if (theFeatureID == FeaturesPlugin_GeometryCalculation::ID()) {
225 return FeaturePtr(new FeaturesPlugin_GeometryCalculation);
226 } else if (theFeatureID == FeaturesPlugin_InspectBoundingBox::ID()) {
227 return FeaturePtr(new FeaturesPlugin_InspectBoundingBox);
228 } else if (theFeatureID == FeaturesPlugin_BoundingBox::ID()) {
229 return FeaturePtr(new FeaturesPlugin_BoundingBox);
230 } else if (theFeatureID == FeaturesPlugin_InspectNormalToFace::ID()) {
231 return FeaturePtr(new FeaturesPlugin_InspectNormalToFace);
232 } else if (theFeatureID == FeaturesPlugin_NormalToFace::ID()) {
233 return FeaturePtr(new FeaturesPlugin_NormalToFace);
234 } else if (theFeatureID == FeaturesPlugin_PointCloudOnFace::ID()) {
235 return FeaturePtr(new FeaturesPlugin_PointCloudOnFace);
239 // feature of such kind is not found