Salome HOME
Merge branch 'master' of newgeom:newgeom
[modules/shaper.git] / src / ModuleBase / ModuleBase_Operation.cpp
index 908f2f0c5d11ce91392a4ab8ca94230900d1b49d..2dc4b8f0512af9c1e29e6bfe3bfec59298b533ac 100644 (file)
@@ -8,7 +8,7 @@
 #include "ModuleBase_Operation.h"
 
 #include "ModuleBase_OperationDescription.h"
-#include "ModuleBase_WidgetCustom.h"
+#include "ModuleBase_ModelWidget.h"
 
 #include <ModelAPI_AttributeDouble.h>
 #include <ModelAPI_Document.h>
@@ -59,14 +59,14 @@ void ModuleBase_Operation::storeCustomValue()
     return;
   }
 
-  ModuleBase_WidgetCustom* aCustom = dynamic_cast<ModuleBase_WidgetCustom*>(sender());
+  ModuleBase_ModelWidget* aCustom = dynamic_cast<ModuleBase_ModelWidget*>(sender());
   if (aCustom)
-    aCustom->store(myFeature);
+    aCustom->storeValue(myFeature);
 }
 
 void ModuleBase_Operation::startOperation()
 {
-  createFeature();
+  setFeature(createFeature());
   //emit callSlot();
   //commit();
 }
@@ -84,10 +84,17 @@ void ModuleBase_Operation::commitOperation()
   if (myFeature) myFeature->execute();
 }
 
-void ModuleBase_Operation::createFeature()
+boost::shared_ptr<ModelAPI_Feature> ModuleBase_Operation::createFeature()
 {
   boost::shared_ptr<ModelAPI_Document> aDoc = document();
-  myFeature = aDoc->addFeature(getDescription()->operationId().toStdString());
-  if (myFeature) // TODO: generate an error if feature was not created
-    myFeature->execute();
+  boost::shared_ptr<ModelAPI_Feature> aFeature = aDoc->addFeature(
+                                           getDescription()->operationId().toStdString());
+  if (aFeature) // TODO: generate an error if feature was not created
+    aFeature->execute();
+  return aFeature;
+}
+
+void ModuleBase_Operation::setFeature(boost::shared_ptr<ModelAPI_Feature> theFeature)
+{
+  myFeature = theFeature;
 }