]> SALOME platform Git repositories - modules/shaper.git/blob - src/BuildPlugin/BuildPlugin_Plugin.cpp
Salome HOME
f11e4ba6ecc6c035687089412acb7c57651ed0e3
[modules/shaper.git] / src / BuildPlugin / BuildPlugin_Plugin.cpp
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
2
3 // File:        BuildPlugin_Plugin.cpp
4 // Created:     18 April 2016
5 // Author:      Dmitry Bobylev
6
7 #include "BuildPlugin_Plugin.h"
8
9 #include <ModelAPI_Session.h>
10 #include <ModelAPI_Validator.h>
11
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>
17
18 // the only created instance of this plugin
19 static BuildPlugin_Plugin* MY_INSTANCE = new BuildPlugin_Plugin();
20
21 //=================================================================================================
22 BuildPlugin_Plugin::BuildPlugin_Plugin()
23 {
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());
33
34   // Register this plugin.
35   ModelAPI_Session::get()->registerPlugin(this);
36 }
37
38 //=================================================================================================
39 FeaturePtr BuildPlugin_Plugin::createFeature(std::string theFeatureID)
40 {
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());
49   }
50
51   // Feature of such kind is not found.
52   return FeaturePtr();
53 }