From 283654f14ebe1f8496fed07a8364b7555e15415d Mon Sep 17 00:00:00 2001 From: nds Date: Thu, 24 Apr 2014 11:16:39 +0400 Subject: [PATCH] refs #30 - Sketch base GUI: create, draw lines Add comments for some code --- src/PartSet/PartSet_Module.cpp | 36 +++++++++++++++------------------- src/PartSet/PartSet_Module.h | 6 ++++++ 2 files changed, 22 insertions(+), 20 deletions(-) diff --git a/src/PartSet/PartSet_Module.cpp b/src/PartSet/PartSet_Module.cpp index 452b546e2..12cf4971a 100644 --- a/src/PartSet/PartSet_Module.cpp +++ b/src/PartSet/PartSet_Module.cpp @@ -92,26 +92,6 @@ void PartSet_Module::onFeatureTriggered() Event_Loop::loop()->send(aMessage); } -/** - * Slot that is called by the operation requiring of preview display or erase - * \param isDisplay the display or erase state -*/ -void PartSet_Module::visualizePreview(bool isDisplay) -{ - ModuleBase_Operation* anOperation = myWorkshop->operationMgr()->currentOperation(); - if (!anOperation) - return; - - PartSet_OperationSketchBase* aPreviewOp = dynamic_cast(anOperation); - if (!aPreviewOp) - return; - - if (isDisplay) - myWorkshop->displayer()->Display(anOperation->feature(), aPreviewOp->preview()); - else - myWorkshop->displayer()->Erase(anOperation->feature(), aPreviewOp->preview()); -} - void PartSet_Module::onOperationStarted() { ModuleBase_Operation* anOperation = myWorkshop->operationMgr()->currentOperation(); @@ -137,3 +117,19 @@ void PartSet_Module::onOperationStopped(ModuleBase_Operation* theOperation) visualizePreview(false); } } + +void PartSet_Module::visualizePreview(bool isDisplay) +{ + ModuleBase_Operation* anOperation = myWorkshop->operationMgr()->currentOperation(); + if (!anOperation) + return; + + PartSet_OperationSketchBase* aPreviewOp = dynamic_cast(anOperation); + if (!aPreviewOp) + return; + + if (isDisplay) + myWorkshop->displayer()->Display(anOperation->feature(), aPreviewOp->preview()); + else + myWorkshop->displayer()->Erase(anOperation->feature(), aPreviewOp->preview()); +} diff --git a/src/PartSet/PartSet_Module.h b/src/PartSet/PartSet_Module.h index 64f03d59c..60f78835c 100644 --- a/src/PartSet/PartSet_Module.h +++ b/src/PartSet/PartSet_Module.h @@ -22,10 +22,16 @@ public: public slots: void onFeatureTriggered(); + /// SLOT, that is called after the operation is started. Perform some specific for module + /// actions, e.g. connect the sketch feature to the viewer selection and show the sketch preview. void onOperationStarted(); + /// SLOT, that is called after the operation is stopped. Disconnect the sketch feature + /// from the viewer selection and show the sketch preview. void onOperationStopped(ModuleBase_Operation* theOperation); private: + /// Displays or erase the current operation preview, if it has it. + /// \param isDisplay the state whether the presentation should be displayed or erased void visualizePreview(bool isDisplay); private: -- 2.39.2