]> SALOME platform Git repositories - modules/shaper.git/blob - src/PartSetPlugin/PartSetPlugin_Plugin.cxx
Salome HOME
Added object, attribute and data model organization in the document.
[modules/shaper.git] / src / PartSetPlugin / PartSetPlugin_Plugin.cxx
1 #include "PartSetPlugin_Plugin.h"
2 #include "PartSetPlugin_NewPart.h"
3 #include <ModelAPI_PluginManager.h>
4 #include <ModelAPI_Document.h>
5
6 using namespace std;
7
8 // the only created instance of this plugin
9 static PartSetPlugin_Plugin* MY_INSTANCE = new PartSetPlugin_Plugin();
10
11 PartSetPlugin_Plugin::PartSetPlugin_Plugin() 
12 {
13   // register this plugin
14   ModelAPI_PluginManager::get()->registerPlugin(this);
15 }
16
17 std::shared_ptr<ModelAPI_Feature> PartSetPlugin_Plugin::createFeature(string theFeatureID)
18 {
19   std::shared_ptr<ModelAPI_Feature> aCreated;
20   if (theFeatureID == "new_part") {
21     aCreated = std::shared_ptr<ModelAPI_Feature>(new PartSetPlugin_NewPart);
22   }
23   // add to a root document for the current moment
24   if (aCreated)
25     ModelAPI_PluginManager::get()->rootDocument()->addFeature(aCreated, PARTS_GROUP);
26   // feature of such kind is not found
27   return aCreated;
28 }