]> SALOME platform Git repositories - modules/shaper.git/blob - src/FeaturesPlugin/FeaturesPlugin_Plugin.cpp
Salome HOME
28bb28ad79b7e4ea610c8ca9e6bac5cfc2f1ce4a
[modules/shaper.git] / src / FeaturesPlugin / FeaturesPlugin_Plugin.cpp
1 // Copyright (C) 2014-2017  CEA/DEN, EDF R&D
2 //
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.
7 //
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.
12 //
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
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
18 //
19
20 #include <FeaturesPlugin_Plugin.h>
21
22 #include <FeaturesPlugin_Boolean.h>
23 #include <FeaturesPlugin_Extrusion.h>
24 #include <FeaturesPlugin_ExtrusionCut.h>
25 #include <FeaturesPlugin_ExtrusionFuse.h>
26 #include <FeaturesPlugin_Intersection.h>
27 #include <FeaturesPlugin_MultiTranslation.h>
28 #include <FeaturesPlugin_Partition.h>
29 #include <FeaturesPlugin_Pipe.h>
30 #include <FeaturesPlugin_Placement.h>
31 #include <FeaturesPlugin_Recover.h>
32 #include <FeaturesPlugin_RemoveSubShapes.h>
33 #include <FeaturesPlugin_Revolution.h>
34 #include <FeaturesPlugin_RevolutionCut.h>
35 #include <FeaturesPlugin_RevolutionFuse.h>
36 #include <FeaturesPlugin_Rotation.h>
37 #include <FeaturesPlugin_Scale.h>
38 #include <FeaturesPlugin_Symmetry.h>
39 #include <FeaturesPlugin_Translation.h>
40 #include <FeaturesPlugin_Union.h>
41 #include <FeaturesPlugin_ValidatorTransform.h>
42 #include <FeaturesPlugin_Validators.h>
43
44 #include <ModelAPI_Session.h>
45
46 #include <string>
47
48 #include <memory>
49
50 // the only created instance of this plugin
51 static FeaturesPlugin_Plugin* MY_FEATURES_INSTANCE = new FeaturesPlugin_Plugin();
52
53 FeaturesPlugin_Plugin::FeaturesPlugin_Plugin()
54 {
55   SessionPtr aMgr = ModelAPI_Session::get();
56   ModelAPI_ValidatorsFactory* aFactory = aMgr->validators();
57   aFactory->registerValidator("FeaturesPlugin_ValidatorTransform",
58                               new FeaturesPlugin_ValidatorTransform);
59   aFactory->registerValidator("FeaturesPlugin_ValidatorCompositeLauncher",
60                               new FeaturesPlugin_ValidatorCompositeLauncher);
61   aFactory->registerValidator("FeaturesPlugin_ValidatorBaseForGeneration",
62                               new FeaturesPlugin_ValidatorBaseForGeneration);
63   aFactory->registerValidator("FeaturesPlugin_ValidatorBaseForGenerationSketchOrSketchObjects",
64                               new FeaturesPlugin_ValidatorBaseForGenerationSketchOrSketchObjects);
65   aFactory->registerValidator("FeaturesPlugin_ValidatorPipeLocations",
66                               new FeaturesPlugin_ValidatorPipeLocations);
67   aFactory->registerValidator("FeaturesPlugin_ValidatorExtrusionDir",
68                               new FeaturesPlugin_ValidatorExtrusionDir);
69   aFactory->registerValidator("FeaturesPlugin_ValidatorBooleanSelection",
70                               new FeaturesPlugin_ValidatorBooleanSelection);
71   aFactory->registerValidator("FeaturesPlugin_ValidatorPartitionSelection",
72                               new FeaturesPlugin_ValidatorPartitionSelection);
73   aFactory->registerValidator("FeaturesPlugin_ValidatorRemoveSubShapesSelection",
74                               new FeaturesPlugin_ValidatorRemoveSubShapesSelection);
75   aFactory->registerValidator("FeaturesPlugin_ValidatorRemoveSubShapesResult",
76                               new FeaturesPlugin_ValidatorRemoveSubShapesResult);
77   aFactory->registerValidator("FeaturesPlugin_ValidatorPipePath",
78                               new FeaturesPlugin_ValidatorPipePath);
79   aFactory->registerValidator("FeaturesPlugin_ValidatorUnionSelection",
80                               new FeaturesPlugin_ValidatorUnionSelection);
81   aFactory->registerValidator("FeaturesPlugin_ValidatorUnionArguments",
82                               new FeaturesPlugin_ValidatorUnionArguments);
83   aFactory->registerValidator("FeaturesPlugin_ValidatorConcealedResult",
84                               new FeaturesPlugin_ValidatorConcealedResult);
85
86   // register this plugin
87   ModelAPI_Session::get()->registerPlugin(this);
88 }
89
90 FeaturePtr FeaturesPlugin_Plugin::createFeature(std::string theFeatureID)
91 {
92   if (theFeatureID == FeaturesPlugin_Extrusion::ID()) {
93     return FeaturePtr(new FeaturesPlugin_Extrusion);
94   } else if (theFeatureID == FeaturesPlugin_Revolution::ID()) {
95    return FeaturePtr(new FeaturesPlugin_Revolution);
96   } else if (theFeatureID == FeaturesPlugin_Rotation::ID()) {
97     return FeaturePtr(new FeaturesPlugin_Rotation);
98   } else if (theFeatureID == FeaturesPlugin_Translation::ID()) {
99     return FeaturePtr(new FeaturesPlugin_Translation);
100   } else if (theFeatureID == FeaturesPlugin_Boolean::ID()) {
101     return FeaturePtr(new FeaturesPlugin_Boolean);
102   } else if (theFeatureID == FeaturesPlugin_Intersection::ID()) {
103     return FeaturePtr(new FeaturesPlugin_Intersection);
104   } else if (theFeatureID == FeaturesPlugin_Partition::ID()) {
105     return FeaturePtr(new FeaturesPlugin_Partition);
106   } else if (theFeatureID == FeaturesPlugin_Pipe::ID()) {
107     return FeaturePtr(new FeaturesPlugin_Pipe);
108   } else if (theFeatureID == FeaturesPlugin_Placement::ID()) {
109     return FeaturePtr(new FeaturesPlugin_Placement);
110   } else if (theFeatureID == FeaturesPlugin_Recover::ID()) {
111     return FeaturePtr(new FeaturesPlugin_Recover);
112   } else if (theFeatureID == FeaturesPlugin_ExtrusionCut::ID()) {
113     return FeaturePtr(new FeaturesPlugin_ExtrusionCut);
114   } else if (theFeatureID == FeaturesPlugin_ExtrusionFuse::ID()) {
115     return FeaturePtr(new FeaturesPlugin_ExtrusionFuse);
116   } else if (theFeatureID == FeaturesPlugin_RevolutionCut::ID()) {
117     return FeaturePtr(new FeaturesPlugin_RevolutionCut);
118   } else if (theFeatureID == FeaturesPlugin_RevolutionFuse::ID()) {
119     return FeaturePtr(new FeaturesPlugin_RevolutionFuse);
120   } else if (theFeatureID == FeaturesPlugin_RemoveSubShapes::ID()) {
121     return FeaturePtr(new FeaturesPlugin_RemoveSubShapes);
122   } else if (theFeatureID == FeaturesPlugin_Union::ID()) {
123     return FeaturePtr(new FeaturesPlugin_Union);
124   } else if (theFeatureID == FeaturesPlugin_Symmetry::ID()) {
125     return FeaturePtr(new FeaturesPlugin_Symmetry);
126   } else if (theFeatureID == FeaturesPlugin_Scale::ID()) {
127     return FeaturePtr(new FeaturesPlugin_Scale);
128   } else if (theFeatureID == FeaturesPlugin_MultiTranslation::ID()) {
129     return FeaturePtr(new FeaturesPlugin_MultiTranslation);
130   }
131
132   // feature of such kind is not found
133   return FeaturePtr();
134 }