From: vsv Date: Fri, 17 Apr 2015 15:45:40 +0000 (+0300) Subject: Issue #388: Synchronize list of displayed objects on activation of module X-Git-Tag: V_1.1.0~5 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=18a83fe9a77ee80f6d06c36a492012ffd10195fb;p=modules%2Fshaper.git Issue #388: Synchronize list of displayed objects on activation of module --- diff --git a/src/NewGeom/NewGeom_Module.cpp b/src/NewGeom/NewGeom_Module.cpp index 50279350e..a569af015 100644 --- a/src/NewGeom/NewGeom_Module.cpp +++ b/src/NewGeom/NewGeom_Module.cpp @@ -33,6 +33,9 @@ #include #include +#include +#include + #include #include #include @@ -178,6 +181,33 @@ bool NewGeom_Module::activateModule(SUIT_Study* theStudy) // switch off in this module aResMgr->setValue("Study", "store_positions", false); + // Synchronize displayed objects + if (mySelector && mySelector->viewer()) { + Handle(AIS_InteractiveContext) aContext = mySelector->viewer()->getAISContext(); + XGUI_Displayer* aDisp = myWorkshop->displayer(); + QObjectPtrList aObjList = aDisp->displayedObjects(); + + AIS_ListOfInteractive aList; + aContext->DisplayedObjects(aList); + AIS_ListIteratorOfListOfInteractive aLIt; + Handle(AIS_InteractiveObject) anAISIO; + foreach (ObjectPtr aObj, aObjList) { + AISObjectPtr aPrs = aDisp->getAISObject(aObj); + Handle(AIS_InteractiveObject) aAIS = aPrs->impl(); + bool aFound = false; + for (aLIt.Initialize(aList); aLIt.More(); aLIt.Next()) { + anAISIO = aLIt.Value(); + if (anAISIO.Access() == aAIS.Access()) { + aFound = true; + break; + } + } + if (!aFound) { + aDisp->erase(aObj, false); + } + } + } + return isDone; }