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