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