- if (isModified && isToFlushRedisplay)
- Events_Loop::loop()->flush(aDispEvent);
- return isModified;
-}
-
-//********************************************************************
-bool XGUI_FacesPanel::displayHiddenObjects(
- const std::set<std::shared_ptr<ModelAPI_Object> >& theObjects,
- std::set<std::shared_ptr<ModelAPI_Object> >& theHiddenObjects,
- const bool isToFlushRedisplay)
-{
- if (theObjects.empty())
- return false;
-
- bool isModified = false;
- static Events_ID aDispEvent = Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY);
-
- for (std::set<ObjectPtr>::const_iterator anIt = theObjects.begin(); anIt != theObjects.end();
- anIt++)
- {
- ObjectPtr anObject = *anIt;
- // if the object was hidden by this panel
- if (anObject->isDisplayed() || theHiddenObjects.find(anObject) == theHiddenObjects.end())
- continue;
- theHiddenObjects.erase(anObject);
- anObject->setDisplayed(true); // it means that the object is hidden by hide all faces
- ModelAPI_EventCreator::get()->sendUpdated(anObject, aDispEvent);
- isModified = true;
- }
-
- if (isModified && isToFlushRedisplay)
- Events_Loop::loop()->flush(aDispEvent);
- return isModified;
-}
-
-//********************************************************************
-bool XGUI_FacesPanel::hideEmptyObjects()
-{
- bool isModified = false;
- static Events_ID aDispEvent = Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY);
- std::map<ObjectPtr, NCollection_List<TopoDS_Shape> > anObjectToShapes;
- std::map<ObjectPtr, Handle(ModuleBase_ResultPrs) > anObjectToPrs;
-
- for (QMap<int, ModuleBase_ViewerPrsPtr>::const_iterator anIt = myItems.begin();
- anIt != myItems.end(); anIt++) {
- ModuleBase_ViewerPrsPtr aPrs = anIt.value();
- ObjectPtr anObject = aPrs->object();
- if (!anObject.get() || !anObject->isDisplayed())
- continue;
-
- Handle(ModuleBase_ResultPrs) aResultPrs = Handle(ModuleBase_ResultPrs)::DownCast(
- aPrs->interactive());
- if (aResultPrs.IsNull())
- continue;
-
- if (anObjectToShapes.find(anObject) != anObjectToShapes.end())
- anObjectToShapes.at(anObject).Append(ModuleBase_Tools::getSelectedShape(aPrs));
- else {
- NCollection_List<TopoDS_Shape> aListOfShapes;
- aListOfShapes.Append(ModuleBase_Tools::getSelectedShape(aPrs));
- anObjectToShapes[anObject] = aListOfShapes;
- anObjectToPrs[anObject] = aResultPrs;
- }
- }
- for (std::map<ObjectPtr, NCollection_List<TopoDS_Shape> >::const_iterator anIt = anObjectToShapes.begin();
- anIt != anObjectToShapes.end(); anIt++) {
- ObjectPtr anObject = anIt->first;
- if (!anObject.get() || anObjectToPrs.find(anObject) == anObjectToPrs.end())
- continue;
- Handle(ModuleBase_ResultPrs) aResultPrs = anObjectToPrs.at(anObject);
-
- if (!aResultPrs->hasSubShapeVisible(anIt->second)) {
- // erase object because it is entirely hidden
- anObject->setDisplayed(false);
- myHiddenObjects.insert(anObject);
- ModelAPI_EventCreator::get()->sendUpdated(anObject, aDispEvent);
- isModified = true;
- }
- }