From 54809222802fcf67530e6a2009d4b5d334bf738d Mon Sep 17 00:00:00 2001 From: nds Date: Wed, 30 Apr 2014 09:50:50 +0400 Subject: [PATCH] refs #30 - Sketch base GUI: create, draw lines Renames method to work through local context --- src/PartSet/PartSet_Module.cpp | 8 +++----- src/XGUI/XGUI_Displayer.cpp | 18 +++++++++--------- src/XGUI/XGUI_Displayer.h | 14 ++++++++------ 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/PartSet/PartSet_Module.cpp b/src/PartSet/PartSet_Module.cpp index 0724e6de1..167d9f0ea 100644 --- a/src/PartSet/PartSet_Module.cpp +++ b/src/PartSet/PartSet_Module.cpp @@ -224,9 +224,7 @@ void PartSet_Module::onPlaneSelected(double theX, double theY, double theZ) PartSet_OperationSketchBase* aPreviewOp = dynamic_cast(anOperation); if (aPreviewOp) { aPreviewOp->setEditMode(true); - // the preview should be shown in another local context visualizePreview(false); - visualizePreview(true); } } @@ -247,12 +245,12 @@ void PartSet_Module::visualizePreview(bool isDisplay) if (isDisplay) { boost::shared_ptr aPreview = aPreviewOp->preview(); if (aPreview) { - aDisplayer->LocalSelection(anOperation->feature(), - aPreview->impl(), aPreviewOp->getSelectionMode()); + aDisplayer->DisplayInLocalContext(anOperation->feature(), aPreview->impl(), + aPreviewOp->getSelectionMode()); } } else { - aDisplayer->GlobalSelection(false); + aDisplayer->CloseLocalContexts(false); aDisplayer->Erase(anOperation->feature()); } } diff --git a/src/XGUI/XGUI_Displayer.cpp b/src/XGUI/XGUI_Displayer.cpp index 41c912f1a..4803c578d 100644 --- a/src/XGUI/XGUI_Displayer.cpp +++ b/src/XGUI/XGUI_Displayer.cpp @@ -73,9 +73,9 @@ void XGUI_Displayer::Erase(boost::shared_ptr theFeature, aContext->UpdateCurrentViewer(); } -void XGUI_Displayer::LocalSelection(boost::shared_ptr theFeature, - const TopoDS_Shape& theShape, - const int theMode, const bool isUpdateViewer) +void XGUI_Displayer::DisplayInLocalContext(boost::shared_ptr theFeature, + const TopoDS_Shape& theShape, + const int theMode, const bool isUpdateViewer) { Handle(AIS_InteractiveContext) aContext = AISContext(); @@ -94,16 +94,16 @@ void XGUI_Displayer::LocalSelection(boost::shared_ptr theFeatu AIS_ListOfInteractive anAISList; anAISList.Append(anAIS); - setLocalSelection(anAISList, theMode, true); + activateInLocalContext(anAISList, theMode, true); } -void XGUI_Displayer::GlobalSelection(const bool isUpdateViewer) +void XGUI_Displayer::CloseLocalContexts(const bool isUpdateViewer) { - setGlobalSelection(true); + closeAllContexts(true); } -void XGUI_Displayer::setLocalSelection(const AIS_ListOfInteractive& theAISObjects, const int theMode, - const bool isUpdateViewer) +void XGUI_Displayer::activateInLocalContext(const AIS_ListOfInteractive& theAISObjects, const int theMode, + const bool isUpdateViewer) { Handle(AIS_InteractiveContext) ic = AISContext(); @@ -133,7 +133,7 @@ void XGUI_Displayer::setLocalSelection(const AIS_ListOfInteractive& theAISObject ic->UpdateCurrentViewer(); } -void XGUI_Displayer::setGlobalSelection(const bool isUpdateViewer) +void XGUI_Displayer::closeAllContexts(const bool isUpdateViewer) { Handle(AIS_InteractiveContext) ic = AISContext(); if (!ic.IsNull()) { diff --git a/src/XGUI/XGUI_Displayer.h b/src/XGUI/XGUI_Displayer.h index b6967a2ab..3b1b54f60 100644 --- a/src/XGUI/XGUI_Displayer.h +++ b/src/XGUI/XGUI_Displayer.h @@ -59,8 +59,9 @@ public: /// \param theShape a shape /// \param theMode a local selection mode /// \param isUpdateViewer the parameter whether the viewer should be update immediatelly - void LocalSelection(boost::shared_ptr theFeature, const TopoDS_Shape& theShape, - const int theMode, const bool isUpdateViewer = true); + void DisplayInLocalContext(boost::shared_ptr theFeature, + const TopoDS_Shape& theShape, + const int theMode, const bool isUpdateViewer = true); /// Erase the feature and a shape. /// \param theFeature a feature instance @@ -69,17 +70,18 @@ public: /// Deactivates selection of sub-shapes /// \param isUpdateViewer the parameter whether the viewer should be update immediatelly - void GlobalSelection(const bool isUpdateViewer = true); + void CloseLocalContexts(const bool isUpdateViewer = true); +protected: /// Activate local selection /// \param theAIS the list of objects /// \param theMode the selection mode /// \param isUpdateViewer the state wether the viewer should be updated immediatelly - void setLocalSelection(const AIS_ListOfInteractive& theAISObjects, const int theMode, - const bool isUpdateViewer); + void activateInLocalContext(const AIS_ListOfInteractive& theAISObjects, const int theMode, + const bool isUpdateViewer); /// Deactivate local selection /// \param isUpdateViewer the state wether the viewer should be updated immediatelly - void setGlobalSelection(const bool isUpdateViewer); + void closeAllContexts(const bool isUpdateViewer); /// Returns currently installed AIS_InteractiveContext Handle(AIS_InteractiveContext) AISContext() const { return myAISContext; } -- 2.39.2