1 // Copyright (C) 2014-2019 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_Chamfer.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_RemoveResults.h>
51 #include <FeaturesPlugin_ValidatorTransform.h>
52 #include <FeaturesPlugin_Validators.h>
54 #include <ModelAPI_Session.h>
60 // the only created instance of this plugin
61 static FeaturesPlugin_Plugin* MY_FEATURES_INSTANCE = new FeaturesPlugin_Plugin();
63 FeaturesPlugin_Plugin::FeaturesPlugin_Plugin()
65 SessionPtr aMgr = ModelAPI_Session::get();
66 ModelAPI_ValidatorsFactory* aFactory = aMgr->validators();
67 aFactory->registerValidator("FeaturesPlugin_ValidatorTransform",
68 new FeaturesPlugin_ValidatorTransform);
69 aFactory->registerValidator("FeaturesPlugin_ValidatorCompositeLauncher",
70 new FeaturesPlugin_ValidatorCompositeLauncher);
71 aFactory->registerValidator("FeaturesPlugin_ValidatorBaseForGeneration",
72 new FeaturesPlugin_ValidatorBaseForGeneration);
73 aFactory->registerValidator("FeaturesPlugin_ValidatorBaseForGenerationSketchOrSketchObjects",
74 new FeaturesPlugin_ValidatorBaseForGenerationSketchOrSketchObjects);
75 aFactory->registerValidator("FeaturesPlugin_ValidatorPipeLocations",
76 new FeaturesPlugin_ValidatorPipeLocations);
77 aFactory->registerValidator("FeaturesPlugin_ValidatorPipeLocationsNumber",
78 new FeaturesPlugin_ValidatorPipeLocationsNumber);
79 aFactory->registerValidator("FeaturesPlugin_ValidatorExtrusionDir",
80 new FeaturesPlugin_ValidatorExtrusionDir);
81 aFactory->registerValidator("FeaturesPlugin_ValidatorExtrusionBoundary",
82 new FeaturesPlugin_ValidatorExtrusionBoundaryFace);
83 aFactory->registerValidator("FeaturesPlugin_ValidatorBooleanSelection",
84 new FeaturesPlugin_ValidatorBooleanSelection);
85 aFactory->registerValidator("FeaturesPlugin_ValidatorPartitionSelection",
86 new FeaturesPlugin_ValidatorPartitionSelection);
87 aFactory->registerValidator("FeaturesPlugin_ValidatorRemoveSubShapesSelection",
88 new FeaturesPlugin_ValidatorRemoveSubShapesSelection);
89 aFactory->registerValidator("FeaturesPlugin_ValidatorRemoveSubShapesResult",
90 new FeaturesPlugin_ValidatorRemoveSubShapesResult);
91 aFactory->registerValidator("FeaturesPlugin_ValidatorPipePath",
92 new FeaturesPlugin_ValidatorPipePath);
93 aFactory->registerValidator("FeaturesPlugin_ValidatorUnionSelection",
94 new FeaturesPlugin_ValidatorUnionSelection);
95 aFactory->registerValidator("FeaturesPlugin_ValidatorUnionArguments",
96 new FeaturesPlugin_ValidatorUnionArguments);
97 aFactory->registerValidator("FeaturesPlugin_ValidatorConcealedResult",
98 new FeaturesPlugin_ValidatorConcealedResult);
99 aFactory->registerValidator("FeaturesPlugin_ValidatorFilletSelection",
100 new FeaturesPlugin_ValidatorFilletSelection);
101 aFactory->registerValidator("FeaturesPlugin_ValidatorCircular",
102 new FeaturesPlugin_ValidatorCircular);
103 aFactory->registerValidator("FeaturesPlugin_ValidatorBooleanArguments",
104 new FeaturesPlugin_ValidatorBooleanArguments);
105 aFactory->registerValidator("FeaturesPlugin_ValidatorBooleanSmashSelection",
106 new FeaturesPlugin_ValidatorBooleanSmashSelection);
107 aFactory->registerValidator("FeaturesPlugin_IntersectionSelection",
108 new FeaturesPlugin_IntersectionSelection);
109 aFactory->registerValidator("FeaturesPlugin_ValidatorBooleanFuseSelection",
110 new FeaturesPlugin_ValidatorBooleanFuseSelection);
111 aFactory->registerValidator("FeaturesPlugin_ValidatorBooleanFuseArguments",
112 new FeaturesPlugin_ValidatorBooleanFuseArguments);
113 aFactory->registerValidator("FeaturesPlugin_ValidatorBooleanCommonSelection",
114 new FeaturesPlugin_ValidatorBooleanCommonSelection);
115 aFactory->registerValidator("FeaturesPlugin_ValidatorBooleanCommonArguments",
116 new FeaturesPlugin_ValidatorBooleanCommonArguments);
118 // register this plugin
119 ModelAPI_Session::get()->registerPlugin(this);
122 FeaturePtr FeaturesPlugin_Plugin::createFeature(std::string theFeatureID)
124 if (theFeatureID == FeaturesPlugin_Extrusion::ID()) {
125 return FeaturePtr(new FeaturesPlugin_Extrusion);
126 } else if (theFeatureID == FeaturesPlugin_Revolution::ID()) {
127 return FeaturePtr(new FeaturesPlugin_Revolution);
128 } else if (theFeatureID == FeaturesPlugin_Rotation::ID()) {
129 return FeaturePtr(new FeaturesPlugin_Rotation);
130 } else if (theFeatureID == FeaturesPlugin_Translation::ID()) {
131 return FeaturePtr(new FeaturesPlugin_Translation);
132 } else if (theFeatureID == FeaturesPlugin_BooleanCut::ID()) {
133 return FeaturePtr(new FeaturesPlugin_BooleanCut);
134 } else if (theFeatureID == FeaturesPlugin_BooleanFuse::ID()) {
135 return FeaturePtr(new FeaturesPlugin_BooleanFuse);
136 } else if (theFeatureID == FeaturesPlugin_BooleanCommon::ID()) {
137 return FeaturePtr(new FeaturesPlugin_BooleanCommon);
138 } else if (theFeatureID == FeaturesPlugin_BooleanSmash::ID()) {
139 return FeaturePtr(new FeaturesPlugin_BooleanSmash);
140 } else if (theFeatureID == FeaturesPlugin_BooleanFill::ID() || theFeatureID == "Fill") {
141 return FeaturePtr(new FeaturesPlugin_BooleanFill);
142 } else if (theFeatureID == FeaturesPlugin_Intersection::ID()) {
143 return FeaturePtr(new FeaturesPlugin_Intersection);
144 } else if (theFeatureID == FeaturesPlugin_Partition::ID()) {
145 return FeaturePtr(new FeaturesPlugin_Partition);
146 } else if (theFeatureID == FeaturesPlugin_Pipe::ID()) {
147 return FeaturePtr(new FeaturesPlugin_Pipe);
148 } else if (theFeatureID == FeaturesPlugin_Placement::ID()) {
149 return FeaturePtr(new FeaturesPlugin_Placement);
150 } else if (theFeatureID == FeaturesPlugin_Recover::ID()) {
151 return FeaturePtr(new FeaturesPlugin_Recover);
152 } else if (theFeatureID == FeaturesPlugin_ExtrusionCut::ID()) {
153 return FeaturePtr(new FeaturesPlugin_ExtrusionCut);
154 } else if (theFeatureID == FeaturesPlugin_ExtrusionFuse::ID()) {
155 return FeaturePtr(new FeaturesPlugin_ExtrusionFuse);
156 } else if (theFeatureID == FeaturesPlugin_RevolutionCut::ID()) {
157 return FeaturePtr(new FeaturesPlugin_RevolutionCut);
158 } else if (theFeatureID == FeaturesPlugin_RevolutionFuse::ID()) {
159 return FeaturePtr(new FeaturesPlugin_RevolutionFuse);
160 } else if (theFeatureID == FeaturesPlugin_RemoveSubShapes::ID()) {
161 return FeaturePtr(new FeaturesPlugin_RemoveSubShapes);
162 } else if (theFeatureID == FeaturesPlugin_Union::ID()) {
163 return FeaturePtr(new FeaturesPlugin_Union);
164 } else if (theFeatureID == FeaturesPlugin_FusionFaces::ID()) {
165 return FeaturePtr(new FeaturesPlugin_FusionFaces);
166 } else if (theFeatureID == FeaturesPlugin_Symmetry::ID()) {
167 return FeaturePtr(new FeaturesPlugin_Symmetry);
168 } else if (theFeatureID == FeaturesPlugin_Scale::ID()) {
169 return FeaturePtr(new FeaturesPlugin_Scale);
170 } else if (theFeatureID == FeaturesPlugin_MultiTranslation::ID()) {
171 return FeaturePtr(new FeaturesPlugin_MultiTranslation);
172 } else if (theFeatureID == FeaturesPlugin_MultiRotation::ID()) {
173 return FeaturePtr(new FeaturesPlugin_MultiRotation);
174 } else if (theFeatureID == FeaturesPlugin_Fillet::ID()) {
175 return FeaturePtr(new FeaturesPlugin_Fillet);
176 } else if (theFeatureID == FeaturesPlugin_Measurement::ID()) {
177 return FeaturePtr(new FeaturesPlugin_Measurement);
178 } else if (theFeatureID == FeaturesPlugin_RemoveResults::ID()) {
179 return FeaturePtr(new FeaturesPlugin_RemoveResults);
180 } else if (theFeatureID == FeaturesPlugin_Chamfer::ID()) {
181 return FeaturePtr(new FeaturesPlugin_Chamfer);
184 // feature of such kind is not found