Salome HOME
Merge branch 'Dev_0.6.1' of newgeom:newgeom into Dev_0.6.1
[modules/shaper.git] / src / FeaturesPlugin / FeaturesPlugin_Group.cpp
index 4a5a34bc21f8077f78054ef9108b6d7c3d63da3b..4708c6fc0f6250ac69e73772326676ae865043b9 100644 (file)
@@ -1,3 +1,5 @@
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
+
 // File:        FeaturesPlugin_Group.cpp
 // Created:     08 Oct 2014
 // Author:      Sergey BELASH
@@ -8,6 +10,9 @@
 #include <ModelAPI_Document.h>
 #include <ModelAPI_AttributeInteger.h>
 #include <ModelAPI_AttributeString.h>
+#include <ModelAPI_AttributeSelectionList.h>
+#include <ModelAPI_ResultGroup.h>
+
 
 using namespace std;
 
@@ -17,16 +22,14 @@ FeaturesPlugin_Group::FeaturesPlugin_Group()
 
 void FeaturesPlugin_Group::initAttributes()
 {
-  data()->addAttribute(FeaturesPlugin_Group::NAME_ID(), ModelAPI_AttributeString::type());
-  data()->addAttribute(FeaturesPlugin_Group::LIST_ID(), ModelAPI_AttributeString::type());
+  //data()->addAttribute(FeaturesPlugin_Group::NAME_ID(), ModelAPI_AttributeString::type());
+  data()->addAttribute(FeaturesPlugin_Group::LIST_ID(), ModelAPI_AttributeSelectionList::type());
 }
 
 void FeaturesPlugin_Group::execute()
 {
-  AttributeStringPtr aNameAttr = boost::dynamic_pointer_cast<ModelAPI_AttributeString>(
-      data()->attribute(FeaturesPlugin_Group::NAME_ID()));
-  if (!aNameAttr)
-    return;
-  std::string aName = aNameAttr->value();
-  data()->setName(aName);
+  if (results().empty()) { // just create result if not exists
+    ResultPtr aGroup = document()->createGroup(data());
+    setResult(aGroup);
+  }
 }