From b585f1d9563d5e8335a317e8548af63c5b359b9d Mon Sep 17 00:00:00 2001 From: nds Date: Mon, 5 May 2014 19:16:20 +0400 Subject: [PATCH] refs #30 - Sketch base GUI: create, draw lines Create feature/set feature methods. --- src/ModuleBase/ModuleBase_Operation.cpp | 17 ++++++++++++----- src/ModuleBase/ModuleBase_Operation.h | 9 +++++++-- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/src/ModuleBase/ModuleBase_Operation.cpp b/src/ModuleBase/ModuleBase_Operation.cpp index 908f2f0c5..44138fd1f 100644 --- a/src/ModuleBase/ModuleBase_Operation.cpp +++ b/src/ModuleBase/ModuleBase_Operation.cpp @@ -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 ModuleBase_Operation::createFeature() { boost::shared_ptr aDoc = document(); - myFeature = aDoc->addFeature(getDescription()->operationId().toStdString()); - if (myFeature) // TODO: generate an error if feature was not created - myFeature->execute(); + boost::shared_ptr 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 theFeature) +{ + myFeature = theFeature; } diff --git a/src/ModuleBase/ModuleBase_Operation.h b/src/ModuleBase/ModuleBase_Operation.h index 4632ad455..2f2aca0fa 100644 --- a/src/ModuleBase/ModuleBase_Operation.h +++ b/src/ModuleBase/ModuleBase_Operation.h @@ -70,8 +70,13 @@ protected: /// 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 createFeature(); + + /// Returns the operation feature + /// \return the feature + void setFeature(boost::shared_ptr theFeature); private: boost::shared_ptr myFeature; /// the operation feature to be handled -- 2.39.2