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 email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
20 #include "BuildPlugin_Plugin.h"
22 #include <ModelAPI_Session.h>
23 #include <ModelAPI_Validator.h>
25 #include <BuildPlugin_Vertex.h>
26 #include <BuildPlugin_Edge.h>
27 #include <BuildPlugin_Wire.h>
28 #include <BuildPlugin_Face.h>
29 #include <BuildPlugin_Shell.h>
30 #include <BuildPlugin_SubShapes.h>
31 #include <BuildPlugin_Validators.h>
33 // the only created instance of this plugin
34 static BuildPlugin_Plugin* MY_INSTANCE = new BuildPlugin_Plugin();
36 //=================================================================================================
37 BuildPlugin_Plugin::BuildPlugin_Plugin()
39 // Register validators.
40 SessionPtr aMgr = ModelAPI_Session::get();
41 ModelAPI_ValidatorsFactory* aFactory = aMgr->validators();
42 aFactory->registerValidator("BuildPlugin_ValidatorBaseForBuild",
43 new BuildPlugin_ValidatorBaseForBuild());
44 aFactory->registerValidator("BuildPlugin_ValidatorBaseForWire",
45 new BuildPlugin_ValidatorBaseForWire());
46 aFactory->registerValidator("BuildPlugin_ValidatorBaseForFace",
47 new BuildPlugin_ValidatorBaseForFace());
48 aFactory->registerValidator("BuildPlugin_ValidatorSubShapesSelection",
49 new BuildPlugin_ValidatorSubShapesSelection());
51 // Register this plugin.
52 ModelAPI_Session::get()->registerPlugin(this);
55 //=================================================================================================
56 FeaturePtr BuildPlugin_Plugin::createFeature(std::string theFeatureID)
58 if(theFeatureID == BuildPlugin_Vertex::ID()) {
59 return FeaturePtr(new BuildPlugin_Vertex());
60 } else if(theFeatureID == BuildPlugin_Edge::ID()) {
61 return FeaturePtr(new BuildPlugin_Edge());
62 } else if(theFeatureID == BuildPlugin_Wire::ID()) {
63 return FeaturePtr(new BuildPlugin_Wire());
64 } else if(theFeatureID == BuildPlugin_Face::ID()) {
65 return FeaturePtr(new BuildPlugin_Face());
66 } else if(theFeatureID == BuildPlugin_Shell::ID()) {
67 return FeaturePtr(new BuildPlugin_Shell());
68 } else if(theFeatureID == BuildPlugin_SubShapes::ID()) {
69 return FeaturePtr(new BuildPlugin_SubShapes());
72 // Feature of such kind is not found.