Salome HOME
Issue #355 Delete: elements of sketch and constraints
[modules/shaper.git] / src / FeaturesPlugin / FeaturesPlugin_Group.cpp
index ae5d82771e3331402a607199249aedac24813317..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
@@ -9,6 +11,7 @@
 #include <ModelAPI_AttributeInteger.h>
 #include <ModelAPI_AttributeString.h>
 #include <ModelAPI_AttributeSelectionList.h>
+#include <ModelAPI_ResultGroup.h>
 
 
 using namespace std;
@@ -19,16 +22,14 @@ FeaturesPlugin_Group::FeaturesPlugin_Group()
 
 void FeaturesPlugin_Group::initAttributes()
 {
-  data()->addAttribute(FeaturesPlugin_Group::NAME_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);
+  }
 }