From: vsv Date: Wed, 5 Nov 2014 07:42:24 +0000 (+0300) Subject: Set selection modes on show/hide of global objects during sketch editing. X-Git-Tag: V_0.5~40 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=770e0bd70d6b8cb78a6e82c22a6ec1eb46cc9a14;p=modules%2Fshaper.git Set selection modes on show/hide of global objects during sketch editing. --- diff --git a/src/XGUI/XGUI_Displayer.cpp b/src/XGUI/XGUI_Displayer.cpp index 819d12cc9..f20953891 100644 --- a/src/XGUI/XGUI_Displayer.cpp +++ b/src/XGUI/XGUI_Displayer.cpp @@ -33,8 +33,8 @@ const int MOUSE_SENSITIVITY_IN_PIXEL = 10; ///< defines the local context mouse selection sensitivity XGUI_Displayer::XGUI_Displayer(XGUI_Workshop* theWorkshop) + : myUseExternalObjects(false), myWorkshop(theWorkshop) { - myWorkshop = theWorkshop; } XGUI_Displayer::~XGUI_Displayer() @@ -86,6 +86,17 @@ void XGUI_Displayer::display(ObjectPtr theObject, AISObjectPtr theAIS, myResult2AISObjectMap[theObject] = theAIS; aContext->Display(anAISIO, false); aContext->SetDisplayMode(anAISIO, isShading? Shading : Wireframe, isUpdateViewer); + if (aContext->HasOpenedContext()) { + if (myUseExternalObjects) { + if (myActiveSelectionModes.size() == 0) + aContext->Activate(anAISIO); + else { + foreach(int aMode, myActiveSelectionModes) { + aContext->Activate(anAISIO, aMode); + } + } + } + } } } @@ -316,6 +327,9 @@ void XGUI_Displayer::openLocalContext() //aContext->OpenLocalContext(false/*use displayed objects*/, true/*allow shape decomposition*/); aContext->OpenLocalContext(); aContext->NotUseDisplayedObjects(); + + myUseExternalObjects = false; + myActiveSelectionModes.clear(); } } @@ -363,6 +377,8 @@ void XGUI_Displayer::closeAllContexts(const bool isUpdateViewer) ic->CloseAllContexts(false); if (isUpdateViewer) updateViewer(); + myUseExternalObjects = false; + myActiveSelectionModes.clear(); } } @@ -382,8 +398,20 @@ void XGUI_Displayer::display(AISObjectPtr theAIS, bool isUpdate) { Handle(AIS_InteractiveContext) aContext = AISContext(); Handle(AIS_InteractiveObject) anAISIO = theAIS->impl(); - if (!anAISIO.IsNull()) + if (!anAISIO.IsNull()) { aContext->Display(anAISIO, isUpdate); + if (aContext->HasOpenedContext()) { + if (myUseExternalObjects) { + if (myActiveSelectionModes.size() == 0) + aContext->Activate(anAISIO); + else { + foreach(int aMode, myActiveSelectionModes) { + aContext->Activate(anAISIO, aMode); + } + } + } + } + } } void XGUI_Displayer::erase(AISObjectPtr theAIS, const bool isUpdate) @@ -403,6 +431,8 @@ void XGUI_Displayer::activateObjectsOutOfContext(const QIntList& theModes) return; aContext->UseDisplayedObjects(); + myUseExternalObjects = true; + myActiveSelectionModes = theModes; //Deactivate trihedron which can be activated in local selector AIS_ListOfInteractive aPrsList; diff --git a/src/XGUI/XGUI_Displayer.h b/src/XGUI/XGUI_Displayer.h index 7f117fea5..3bffe38a0 100644 --- a/src/XGUI/XGUI_Displayer.h +++ b/src/XGUI/XGUI_Displayer.h @@ -187,6 +187,11 @@ class XGUI_EXPORT XGUI_Displayer typedef std::map ResultToAISMap; ResultToAISMap myResult2AISObjectMap; + + // A flag of initialization of external objects selection + bool myUseExternalObjects; + // Selection modes installed for external objects in local context + QIntList myActiveSelectionModes; }; #endif