Salome HOME
refs #30 - Sketch base GUI: create, draw lines
[modules/shaper.git] / src / ModuleBase / ModuleBase_Operation.cpp
index bb1cefec685fd659fb961e2dfc8fa1a6a28b05c5..e742c055393a02e4d1d582406fbc71b82bc2d27a 100644 (file)
@@ -1,8 +1,8 @@
 /*
  * ModuleBase_Operation.cpp
  *
- *  Created on: May 5, 2014
- *      Author: nds
+ *  Created on: Apr 2, 2014
+ *      Author: sbh
  */
 
 #include "ModuleBase_Operation.h"
@@ -66,7 +66,7 @@ void ModuleBase_Operation::storeCustomValue()
 
 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;
 }