1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
3 // File: BuildPlugin_Plugin.cpp
4 // Created: 18 April 2016
5 // Author: Dmitry Bobylev
7 #include "BuildPlugin_Plugin.h"
9 #include <ModelAPI_Session.h>
10 #include <ModelAPI_Validator.h>
12 #include <BuildPlugin_Vertex.h>
13 #include <BuildPlugin_Edge.h>
14 #include <BuildPlugin_Wire.h>
15 #include <BuildPlugin_Face.h>
16 #include <BuildPlugin_Validators.h>
18 // the only created instance of this plugin
19 static BuildPlugin_Plugin* MY_INSTANCE = new BuildPlugin_Plugin();
21 //=================================================================================================
22 BuildPlugin_Plugin::BuildPlugin_Plugin()
24 // Register validators.
25 SessionPtr aMgr = ModelAPI_Session::get();
26 ModelAPI_ValidatorsFactory* aFactory = aMgr->validators();
27 aFactory->registerValidator("BuildPlugin_ValidatorBaseForBuild",
28 new BuildPlugin_ValidatorBaseForBuild());
29 aFactory->registerValidator("BuildPlugin_ValidatorBaseForWire",
30 new BuildPlugin_ValidatorBaseForWire());
31 aFactory->registerValidator("BuildPlugin_ValidatorBaseForFace",
32 new BuildPlugin_ValidatorBaseForFace());
34 // Register this plugin.
35 ModelAPI_Session::get()->registerPlugin(this);
38 //=================================================================================================
39 FeaturePtr BuildPlugin_Plugin::createFeature(std::string theFeatureID)
41 if(theFeatureID == BuildPlugin_Vertex::ID()) {
42 return FeaturePtr(new BuildPlugin_Vertex());
43 } else if(theFeatureID == BuildPlugin_Edge::ID()) {
44 return FeaturePtr(new BuildPlugin_Edge());
45 } else if(theFeatureID == BuildPlugin_Wire::ID()) {
46 return FeaturePtr(new BuildPlugin_Wire());
47 } else if(theFeatureID == BuildPlugin_Face::ID()) {
48 return FeaturePtr(new BuildPlugin_Face());
51 // Feature of such kind is not found.