Salome HOME
Merge branch 'master' into cgt/devCEA
[modules/shaper.git] / src / PrimitivesPlugin / PrimitivesPlugin_Plugin.cpp
1 // Copyright (C) 2014-2016 CEA/DEN, EDF R&D -->
2
3 // File:        PrimitivesPlugin_Plugin.hxx
4 // Created:     29 Mar 2016
5 // Author:      Clarisse Genrault (CEA)
6
7 #include <PrimitivesPlugin_Plugin.h>
8
9 #include <PrimitivesPlugin_Box.h>
10 #include <PrimitivesPlugin_Cylinder.h>
11 #include <PrimitivesPlugin_Sphere.h>
12
13 #include <ModelAPI_Session.h>
14
15 #include <string>
16 #include <memory>
17 #include <iostream>
18
19 // the only created instance of this plugin
20 static PrimitivesPlugin_Plugin* MY_PRIMITIVES_INSTANCE = new PrimitivesPlugin_Plugin();
21
22 PrimitivesPlugin_Plugin::PrimitivesPlugin_Plugin()
23 {
24   // register this plugin
25   ModelAPI_Session::get()->registerPlugin(this);
26 }
27
28 FeaturePtr PrimitivesPlugin_Plugin::createFeature(std::string theFeatureID)
29 {
30   if (theFeatureID == PrimitivesPlugin_Box::ID()) {
31     return FeaturePtr(new PrimitivesPlugin_Box);
32   } else if (theFeatureID == PrimitivesPlugin_Cylinder::ID()) {
33     return FeaturePtr(new PrimitivesPlugin_Cylinder);
34   } else if (theFeatureID == PrimitivesPlugin_Sphere::ID()) {
35     return FeaturePtr(new PrimitivesPlugin_Sphere);
36   }
37   // feature of such kind is not found
38   return FeaturePtr();
39 }