ModelAPI_PluginManager::get()->registerPlugin(this);
}
-std::shared_ptr<ModelAPI_Feature> PartSetPlugin_Plugin::createFeature(
- string theFeatureID, const bool theAddToDoc)
+shared_ptr<ModelAPI_Feature> PartSetPlugin_Plugin::createFeature(string theFeatureID)
{
- std::shared_ptr<ModelAPI_Feature> aCreated;
- bool isCurrent = true; // to create a feature in the current document
- std::string aGroup;
if (theFeatureID == "Part") {
- aCreated = std::shared_ptr<ModelAPI_Feature>(new PartSetPlugin_Part);
- isCurrent = false; // allways create in the root document
- aGroup = PARTS_GROUP;
- } else if (theFeatureID == "Point") {
- aCreated = std::shared_ptr<ModelAPI_Feature>(new PartSetPlugin_Point);
- aGroup = CONSTRUCTIONS_GROUP;
- }
-
- // add to a root document for the current moment
- if (aCreated && theAddToDoc) {
- shared_ptr<ModelAPI_Document> aDoc = isCurrent ?
- ModelAPI_PluginManager::get()->currentDocument() :
- ModelAPI_PluginManager::get()->rootDocument();
- aDoc->addFeature(aCreated, aGroup);
+ return shared_ptr<ModelAPI_Feature>(new PartSetPlugin_Part);
}
// feature of such kind is not found
- return aCreated;
+ return shared_ptr<ModelAPI_Feature>();
}