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_Boolean.h>
24 #include <FeaturesPlugin_Extrusion.h>
25 #include <FeaturesPlugin_ExtrusionCut.h>
26 #include <FeaturesPlugin_ExtrusionFuse.h>
27 #include <FeaturesPlugin_Fillet.h>
28 #include <FeaturesPlugin_Intersection.h>
29 #include <FeaturesPlugin_Measurement.h>
30 #include <FeaturesPlugin_MultiRotation.h>
31 #include <FeaturesPlugin_MultiTranslation.h>
32 #include <FeaturesPlugin_Partition.h>
33 #include <FeaturesPlugin_Pipe.h>
34 #include <FeaturesPlugin_Placement.h>
35 #include <FeaturesPlugin_Recover.h>
36 #include <FeaturesPlugin_RemoveSubShapes.h>
37 #include <FeaturesPlugin_Revolution.h>
38 #include <FeaturesPlugin_RevolutionCut.h>
39 #include <FeaturesPlugin_RevolutionFuse.h>
40 #include <FeaturesPlugin_Rotation.h>
41 #include <FeaturesPlugin_Scale.h>
42 #include <FeaturesPlugin_Symmetry.h>
43 #include <FeaturesPlugin_Translation.h>
44 #include <FeaturesPlugin_Union.h>
45 #include <FeaturesPlugin_ValidatorTransform.h>
46 #include <FeaturesPlugin_Validators.h>
48 #include <ModelAPI_Session.h>
54 // the only created instance of this plugin
55 static FeaturesPlugin_Plugin* MY_FEATURES_INSTANCE = new FeaturesPlugin_Plugin();
57 FeaturesPlugin_Plugin::FeaturesPlugin_Plugin()
59 SessionPtr aMgr = ModelAPI_Session::get();
60 ModelAPI_ValidatorsFactory* aFactory = aMgr->validators();
61 aFactory->registerValidator("FeaturesPlugin_ValidatorTransform",
62 new FeaturesPlugin_ValidatorTransform);
63 aFactory->registerValidator("FeaturesPlugin_ValidatorCompositeLauncher",
64 new FeaturesPlugin_ValidatorCompositeLauncher);
65 aFactory->registerValidator("FeaturesPlugin_ValidatorBaseForGeneration",
66 new FeaturesPlugin_ValidatorBaseForGeneration);
67 aFactory->registerValidator("FeaturesPlugin_ValidatorBaseForGenerationSketchOrSketchObjects",
68 new FeaturesPlugin_ValidatorBaseForGenerationSketchOrSketchObjects);
69 aFactory->registerValidator("FeaturesPlugin_ValidatorPipeLocations",
70 new FeaturesPlugin_ValidatorPipeLocations);
71 aFactory->registerValidator("FeaturesPlugin_ValidatorExtrusionDir",
72 new FeaturesPlugin_ValidatorExtrusionDir);
73 aFactory->registerValidator("FeaturesPlugin_ValidatorBooleanSelection",
74 new FeaturesPlugin_ValidatorBooleanSelection);
75 aFactory->registerValidator("FeaturesPlugin_ValidatorPartitionSelection",
76 new FeaturesPlugin_ValidatorPartitionSelection);
77 aFactory->registerValidator("FeaturesPlugin_ValidatorRemoveSubShapesSelection",
78 new FeaturesPlugin_ValidatorRemoveSubShapesSelection);
79 aFactory->registerValidator("FeaturesPlugin_ValidatorRemoveSubShapesResult",
80 new FeaturesPlugin_ValidatorRemoveSubShapesResult);
81 aFactory->registerValidator("FeaturesPlugin_ValidatorPipePath",
82 new FeaturesPlugin_ValidatorPipePath);
83 aFactory->registerValidator("FeaturesPlugin_ValidatorUnionSelection",
84 new FeaturesPlugin_ValidatorUnionSelection);
85 aFactory->registerValidator("FeaturesPlugin_ValidatorUnionArguments",
86 new FeaturesPlugin_ValidatorUnionArguments);
87 aFactory->registerValidator("FeaturesPlugin_ValidatorConcealedResult",
88 new FeaturesPlugin_ValidatorConcealedResult);
89 aFactory->registerValidator("FeaturesPlugin_ValidatorFilletSelection",
90 new FeaturesPlugin_ValidatorFilletSelection);
91 aFactory->registerValidator("FeaturesPlugin_ValidatorCircular",
92 new FeaturesPlugin_ValidatorCircular);
94 // register this plugin
95 ModelAPI_Session::get()->registerPlugin(this);
98 FeaturePtr FeaturesPlugin_Plugin::createFeature(std::string theFeatureID)
100 if (theFeatureID == FeaturesPlugin_Extrusion::ID()) {
101 return FeaturePtr(new FeaturesPlugin_Extrusion);
102 } else if (theFeatureID == FeaturesPlugin_Revolution::ID()) {
103 return FeaturePtr(new FeaturesPlugin_Revolution);
104 } else if (theFeatureID == FeaturesPlugin_Rotation::ID()) {
105 return FeaturePtr(new FeaturesPlugin_Rotation);
106 } else if (theFeatureID == FeaturesPlugin_Translation::ID()) {
107 return FeaturePtr(new FeaturesPlugin_Translation);
108 } else if (theFeatureID == FeaturesPlugin_Boolean::ID()) {
109 return FeaturePtr(new FeaturesPlugin_Boolean);
110 } else if (theFeatureID == FeaturesPlugin_Intersection::ID()) {
111 return FeaturePtr(new FeaturesPlugin_Intersection);
112 } else if (theFeatureID == FeaturesPlugin_Partition::ID()) {
113 return FeaturePtr(new FeaturesPlugin_Partition);
114 } else if (theFeatureID == FeaturesPlugin_Pipe::ID()) {
115 return FeaturePtr(new FeaturesPlugin_Pipe);
116 } else if (theFeatureID == FeaturesPlugin_Placement::ID()) {
117 return FeaturePtr(new FeaturesPlugin_Placement);
118 } else if (theFeatureID == FeaturesPlugin_Recover::ID()) {
119 return FeaturePtr(new FeaturesPlugin_Recover);
120 } else if (theFeatureID == FeaturesPlugin_ExtrusionCut::ID()) {
121 return FeaturePtr(new FeaturesPlugin_ExtrusionCut);
122 } else if (theFeatureID == FeaturesPlugin_ExtrusionFuse::ID()) {
123 return FeaturePtr(new FeaturesPlugin_ExtrusionFuse);
124 } else if (theFeatureID == FeaturesPlugin_RevolutionCut::ID()) {
125 return FeaturePtr(new FeaturesPlugin_RevolutionCut);
126 } else if (theFeatureID == FeaturesPlugin_RevolutionFuse::ID()) {
127 return FeaturePtr(new FeaturesPlugin_RevolutionFuse);
128 } else if (theFeatureID == FeaturesPlugin_RemoveSubShapes::ID()) {
129 return FeaturePtr(new FeaturesPlugin_RemoveSubShapes);
130 } else if (theFeatureID == FeaturesPlugin_Union::ID()) {
131 return FeaturePtr(new FeaturesPlugin_Union);
132 } else if (theFeatureID == FeaturesPlugin_Symmetry::ID()) {
133 return FeaturePtr(new FeaturesPlugin_Symmetry);
134 } else if (theFeatureID == FeaturesPlugin_Scale::ID()) {
135 return FeaturePtr(new FeaturesPlugin_Scale);
136 } else if (theFeatureID == FeaturesPlugin_MultiTranslation::ID()) {
137 return FeaturePtr(new FeaturesPlugin_MultiTranslation);
138 } else if (theFeatureID == FeaturesPlugin_MultiRotation::ID()) {
139 return FeaturePtr(new FeaturesPlugin_MultiRotation);
140 } else if (theFeatureID == FeaturesPlugin_Fillet::ID()) {
141 return FeaturePtr(new FeaturesPlugin_Fillet);
142 } else if (theFeatureID == FeaturesPlugin_Measurement::ID()) {
143 return FeaturePtr(new FeaturesPlugin_Measurement);
146 // feature of such kind is not found