void ModuleBase_Operation::startOperation()
{
- createFeature();
+ setFeature(createFeature());
//emit callSlot();
//commit();
}
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;
}
/// Virtual method called when operation committed (see commit() method for more description)
virtual void commitOperation();
- /// Creates a new feature and save it in the operation internal field
- virtual void createFeature();
+ /// Creates an operation new feature
+ /// \returns the created feature
+ virtual boost::shared_ptr<ModelAPI_Feature> createFeature();
+
+ /// Returns the operation feature
+ /// \return the feature
+ void setFeature(boost::shared_ptr<ModelAPI_Feature> theFeature);
private:
boost::shared_ptr<ModelAPI_Feature> myFeature; /// the operation feature to be handled