]> SALOME platform Git repositories - modules/shaper.git/blob - src/BuildPlugin/BuildPlugin_Plugin.cpp
Salome HOME
bos #20661 EDF 22847 - Move to the end
[modules/shaper.git] / src / BuildPlugin / BuildPlugin_Plugin.cpp
1 // Copyright (C) 2017-2020  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
18 //
19
20 #include "BuildPlugin_Plugin.h"
21
22 #include <ModelAPI_Session.h>
23 #include <ModelAPI_Validator.h>
24
25 #include <BuildPlugin_Vertex.h>
26 #include <BuildPlugin_Edge.h>
27 #include <BuildPlugin_Wire.h>
28 #include <BuildPlugin_Polyline.h>
29 #include <BuildPlugin_Interpolation.h>
30 #include <BuildPlugin_Face.h>
31 #include <BuildPlugin_Shell.h>
32 #include <BuildPlugin_Solid.h>
33 #include <BuildPlugin_CompSolid.h>
34 #include <BuildPlugin_Compound.h>
35 #include <BuildPlugin_SubShapes.h>
36 #include <BuildPlugin_Filling.h>
37 #include <BuildPlugin_Validators.h>
38
39 // the only created instance of this plugin
40 static BuildPlugin_Plugin* MY_INSTANCE = new BuildPlugin_Plugin();
41
42 //=================================================================================================
43 BuildPlugin_Plugin::BuildPlugin_Plugin()
44 {
45   // Register validators.
46   SessionPtr aMgr = ModelAPI_Session::get();
47   ModelAPI_ValidatorsFactory* aFactory = aMgr->validators();
48   aFactory->registerValidator("BuildPlugin_ValidatorBaseForBuild",
49                               new BuildPlugin_ValidatorBaseForBuild());
50   aFactory->registerValidator("BuildPlugin_ValidatorBaseForWire",
51                               new BuildPlugin_ValidatorBaseForWire());
52   aFactory->registerValidator("BuildPlugin_ValidatorBaseForFace",
53                               new BuildPlugin_ValidatorBaseForFace());
54   aFactory->registerValidator("BuildPlugin_ValidatorBaseForSolids",
55                               new BuildPlugin_ValidatorBaseForSolids());
56   aFactory->registerValidator("BuildPlugin_ValidatorSubShapesSelection",
57                               new BuildPlugin_ValidatorSubShapesSelection());
58   aFactory->registerValidator("BuildPlugin_ValidatorFillingSelection",
59                               new BuildPlugin_ValidatorFillingSelection());
60   aFactory->registerValidator("BuildPlugin_ValidatorBaseForVertex",
61                               new BuildPlugin_ValidatorBaseForVertex());
62
63   // Register this plugin.
64   ModelAPI_Session::get()->registerPlugin(this);
65 }
66
67 //=================================================================================================
68 FeaturePtr BuildPlugin_Plugin::createFeature(std::string theFeatureID)
69 {
70   if(theFeatureID == BuildPlugin_Vertex::ID()) {
71     return FeaturePtr(new BuildPlugin_Vertex());
72   } else if(theFeatureID == BuildPlugin_Edge::ID()) {
73     return FeaturePtr(new BuildPlugin_Edge());
74   } else if(theFeatureID == BuildPlugin_Wire::ID()) {
75     return FeaturePtr(new BuildPlugin_Wire());
76   } else if (theFeatureID == BuildPlugin_Polyline::ID()) {
77     return FeaturePtr(new BuildPlugin_Polyline());
78   } else if (theFeatureID == BuildPlugin_Interpolation::ID()) {
79     return FeaturePtr(new BuildPlugin_Interpolation());
80   } else if (theFeatureID == BuildPlugin_Face::ID()) {
81     return FeaturePtr(new BuildPlugin_Face());
82   } else if(theFeatureID == BuildPlugin_Shell::ID()) {
83     return FeaturePtr(new BuildPlugin_Shell());
84   } else if(theFeatureID == BuildPlugin_Solid::ID()) {
85     return FeaturePtr(new BuildPlugin_Solid());
86   } else if(theFeatureID == BuildPlugin_CompSolid::ID()) {
87     return FeaturePtr(new BuildPlugin_CompSolid());
88   } else if(theFeatureID == BuildPlugin_Compound::ID()) {
89     return FeaturePtr(new BuildPlugin_Compound());
90   } else if(theFeatureID == BuildPlugin_SubShapes::ID()) {
91     return FeaturePtr(new BuildPlugin_SubShapes());
92   } else if(theFeatureID == BuildPlugin_Filling::ID()) {
93     return FeaturePtr(new BuildPlugin_Filling());
94   }
95
96   // Feature of such kind is not found.
97   return FeaturePtr();
98 }