From ebf12116cc92186497036ef6a374e194fcd17b90 Mon Sep 17 00:00:00 2001 From: vsv Date: Fri, 31 Oct 2014 16:23:44 +0300 Subject: [PATCH] Close context before new opening in order to clear selection modes. --- src/XGUI/XGUI_Displayer.cpp | 24 +++++++++++++++++++++++- src/XGUI/XGUI_ModuleConnector.cpp | 2 ++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/src/XGUI/XGUI_Displayer.cpp b/src/XGUI/XGUI_Displayer.cpp index 0bdf7633e..afc04003c 100644 --- a/src/XGUI/XGUI_Displayer.cpp +++ b/src/XGUI/XGUI_Displayer.cpp @@ -25,6 +25,8 @@ #include #include #include +#include +#include #include @@ -314,6 +316,20 @@ void XGUI_Displayer::openLocalContext() //aContext->OpenLocalContext(false/*use displayed objects*/, true/*allow shape decomposition*/); aContext->OpenLocalContext(); aContext->NotUseDisplayedObjects(); + + // Deactivate trihedron which can be activated in local selector + //AIS_ListOfInteractive aPrsList; + //aContext->DisplayedObjects(aPrsList, true); + + //Handle(AIS_Trihedron) aTrihedron; + //AIS_ListIteratorOfListOfInteractive aIt(aPrsList); + //for(; aIt.More(); aIt.Next()){ + // aTrihedron = Handle(AIS_Trihedron)::DownCast(aIt.Value()); + // if (!aTrihedron.IsNull()) { + // aContext->Deactivate(aTrihedron); + // break; + // } + //} } } @@ -404,7 +420,7 @@ void XGUI_Displayer::activateObjectsOutOfContext(const QIntList& theModes) ResultToAISMap::iterator aIt; Handle(AIS_InteractiveObject) anAISIO; for (aIt = myResult2AISObjectMap.begin(); aIt != myResult2AISObjectMap.end(); aIt++) { - anAISIO = (*aIt).second->impl(); + anAISIO = (*aIt).second->impl(); aContext->Load(anAISIO, -1, true); if (theModes.size() == 0) aContext->Activate(anAISIO); @@ -486,6 +502,12 @@ void XGUI_Displayer::addSelectionFilter(const Handle(SelectMgr_Filter)& theFilte Handle(AIS_InteractiveContext) aContext = AISContext(); if (aContext.IsNull()) return; + const SelectMgr_ListOfFilter& aFilters = aContext->Filters(); + SelectMgr_ListIteratorOfListOfFilter aIt(aFilters); + for (; aIt.More(); aIt.Next()) { + if (theFilter.Access() == aIt.Value().Access()) + return; + } aContext->AddFilter(theFilter); } diff --git a/src/XGUI/XGUI_ModuleConnector.cpp b/src/XGUI/XGUI_ModuleConnector.cpp index 6a3c81a9f..45f2d0ed7 100644 --- a/src/XGUI/XGUI_ModuleConnector.cpp +++ b/src/XGUI/XGUI_ModuleConnector.cpp @@ -59,6 +59,8 @@ ModuleBase_Operation* XGUI_ModuleConnector::currentOperation() const void XGUI_ModuleConnector::activateSubShapesSelection(const QIntList& theTypes) { XGUI_Displayer* aDisp = myWorkshop->displayer(); + // Close context if it was opened in order to clear stsndard selection modes + aDisp->closeLocalContexts(false); aDisp->openLocalContext(); // Convert shape types to selection types QIntList aModes; -- 2.39.2