Salome HOME
Issue #3106: Do not process selection of non-faces group
[modules/shaper.git] / src / XGUI / XGUI_FacesPanel.cpp
1 // Copyright (C) 2014-2019  CEA/DEN, EDF R&D
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19
20 #include "XGUI_FacesPanel.h"
21 #include "XGUI_ObjectsBrowser.h"
22 #include "XGUI_SelectionMgr.h"
23 #include "XGUI_Selection.h"
24 #include "XGUI_Tools.h"
25 #include "XGUI_Workshop.h"
26 #include "XGUI_Displayer.h"
27 #include "XGUI_ViewerProxy.h"
28
29 #include <ModuleBase_IModule.h>
30 #include <ModuleBase_ISelection.h>
31 #include <ModuleBase_IWorkshop.h>
32 #include <ModuleBase_IViewer.h>
33 #include <ModuleBase_ListView.h>
34 #include <ModuleBase_ResultPrs.h>
35 #include <ModuleBase_Tools.h>
36 #include <ModuleBase_ViewerPrs.h>
37 #include <ModuleBase_SelectionFilterType.h>
38
39 #include <Config_PropManager.h>
40 #include <Events_Loop.h>
41 #include <GeomAlgoAPI_CompoundBuilder.h>
42 #include <GeomAPI_Shape.h>
43
44 #include <ModelAPI_Events.h>
45 #include <ModelAPI_ResultGroup.h>
46 #include <ModelAPI_AttributeSelectionList.h>
47
48 #include <QAction>
49 #include <QCheckBox>
50 #include <QFocusEvent>
51 #include <QGridLayout>
52 #include <QListWidget>
53 #include <QMainWindow>
54
55 static const int LayoutMargin = 3;
56
57 //********************************************************************
58 XGUI_FacesPanel::XGUI_FacesPanel(QWidget* theParent, XGUI_Workshop* theWorkshop)
59   : QDockWidget(theParent), myIsActive(false), myWorkshop(theWorkshop)
60 {
61   setWindowTitle(tr("Hide Faces"));
62   QAction* aViewAct = toggleViewAction();
63   setStyleSheet("::title { position: relative; padding-left: 5px; text-align: left center }");
64
65   QWidget* aContent = new QWidget(this);
66   QGridLayout* aMainLayout = new QGridLayout(aContent);
67   aMainLayout->setContentsMargins(LayoutMargin, LayoutMargin, LayoutMargin, LayoutMargin);
68   setWidget(aContent);
69
70   myHiddenOrTransparent = new QCheckBox(tr("Transparent"), aContent);
71   connect(myHiddenOrTransparent, SIGNAL(toggled(bool)), SLOT(onTransparencyChanged()));
72
73   myListView = new ModuleBase_ListView(aContent, "", "Hidden/transparent faces in 3D view");
74   connect(myListView, SIGNAL(deleteActionClicked()), SLOT(onDeleteItem()));
75
76   aMainLayout->addWidget(myHiddenOrTransparent, 0, 0);
77   aMainLayout->addWidget(myListView->getControl(), 1, 0);
78
79   myListView->getControl()->setFocusPolicy(Qt::StrongFocus);
80   myListView->getControl()->viewport()->installEventFilter(this);
81 }
82
83 //********************************************************************
84 void XGUI_FacesPanel::reset(const bool isToFlushRedisplay)
85 {
86   if (myLastItemIndex == 0) // do nothing because there was no activity in the pane after reset
87     return;
88
89   std::map<ObjectPtr, TopoDS_ListOfShape> anObjectToShapes;
90   std::map<ObjectPtr, Handle(ModuleBase_ResultPrs) > anObjectToPrs;
91   QMap<int, std::shared_ptr<ModuleBase_ViewerPrs> >::const_iterator aIt;
92   for (aIt = myItems.cbegin(); aIt != myItems.cend(); aIt++) {
93     getObjectsMapFromPrs(aIt.value(), anObjectToShapes, anObjectToPrs);
94   }
95
96   std::set<ObjectPtr> aObjects;
97   TopoDS_ListOfShape anEmpty;
98   std::map<ObjectPtr, Handle(ModuleBase_ResultPrs)>::const_iterator aPrsIt;
99   for (aPrsIt = anObjectToPrs.cbegin(); aPrsIt != anObjectToPrs.cend(); aPrsIt++) {
100     aObjects.insert(aPrsIt->first);
101     aPrsIt->second->setSubShapeHidden(anEmpty);
102   }
103   std::set<std::shared_ptr<ModelAPI_Object> >::const_iterator aGrpIt;
104   for (aGrpIt = myHiddenGroups.cbegin(); aGrpIt != myHiddenGroups.cend(); aGrpIt++)
105     (*aGrpIt)->setDisplayed(true);
106   myHiddenGroups.clear();
107
108   if (redisplayObjects(aObjects))
109     flushRedisplay();
110
111   // clear internal containers
112   myListView->getControl()->clear();
113   myItems.clear();
114   updateProcessedObjects(myItems, myItemObjects);
115   myLastItemIndex = 0; // it should be after redisplay as flag used in customize
116   myHiddenObjects.clear();
117 }
118
119 //********************************************************************
120 bool XGUI_FacesPanel::isEmpty() const
121 {
122   return myItems.size() == 0;
123 }
124
125 //********************************************************************
126 void XGUI_FacesPanel::selectionModes(QIntList& theModes)
127 {
128   theModes.append(TopAbs_FACE);
129 }
130
131 //********************************************************************
132 void XGUI_FacesPanel::selectionFilters(SelectMgr_ListOfFilter& theSelectionFilters)
133 {
134   ModuleBase_IModule* aModule = myWorkshop->module();
135   QIntList aModuleSelectionFilters = myWorkshop->module()->selectionFilters();
136
137   // The global filter makes problem for groups selection when any operation is launched
138   // theSelectionFilters.Append(aModule->selectionFilter(SF_GlobalFilter));
139   theSelectionFilters.Append(aModule->selectionFilter(SF_FilterInfinite));
140   theSelectionFilters.Append(aModule->selectionFilter(SF_ResultGroupNameFilter));
141 }
142
143 //********************************************************************
144 bool XGUI_FacesPanel::eventFilter(QObject* theObject, QEvent *theEvent)
145 {
146   QWidget* aWidget = qobject_cast<QWidget*>(theObject);
147   if (theEvent->type() == QEvent::MouseButtonRelease)
148   {
149     if (myListView->getControl()->viewport() == aWidget)
150       setActivePanel(true);
151   }
152   // pass the event on to the parent class
153   return QObject::eventFilter(theObject, theEvent);
154 }
155
156 //********************************************************************
157 void XGUI_FacesPanel::setActivePanel(const bool theIsActive)
158 {
159   if (myIsActive == theIsActive)
160     return;
161
162   ModuleBase_Tools::setShadowEffect(myListView->getControl(), theIsActive);
163   myIsActive = theIsActive;
164
165   if (myIsActive) {
166     emit activated();
167     // selection should be cleared after emit of signal to do not process selection change
168     // event by the previous selector
169     // the selection is cleared by activating selection control
170     myWorkshop->selector()->clearSelection();
171   }
172   else
173     emit deactivated();
174 }
175
176 //********************************************************************
177 bool XGUI_FacesPanel::useTransparency() const
178 {
179   return myHiddenOrTransparent->isChecked();
180 }
181
182 //********************************************************************
183 double XGUI_FacesPanel::transparency() const
184 {
185   return useTransparency() ?
186     Config_PropManager::real("Visualization", "hidden_face_transparency") : 1;
187 }
188
189
190 //********************************************************************
191 void XGUI_FacesPanel::restoreObjects(const std::set<ObjectPtr>& theHiddenObjects)
192 {
193   std::set<int> anIndicesToBeRemoved;
194   for (QMap<int, ModuleBase_ViewerPrsPtr>::const_iterator anItemsIt = myItems.begin();
195     anItemsIt != myItems.end(); anItemsIt++)
196   {
197     ModuleBase_ViewerPrsPtr aPrs = anItemsIt.value();
198     ObjectPtr anObject = aPrs->object();
199     if (theHiddenObjects.find(anObject) == theHiddenObjects.end()) // not found
200       continue;
201     anIndicesToBeRemoved.insert(anItemsIt.key());
202   }
203
204   // remove from myItes container
205   for (std::set<int>::const_iterator aToBeRemovedIt = anIndicesToBeRemoved.begin();
206     aToBeRemovedIt != anIndicesToBeRemoved.end(); aToBeRemovedIt++)
207   {
208     myItems.remove(*aToBeRemovedIt);
209   }
210   if (!anIndicesToBeRemoved.empty()) // means that myItems has been changed
211     updateProcessedObjects(myItems, myItemObjects);
212   myListView->removeItems(anIndicesToBeRemoved);
213
214   // remove from container of hidden objects
215   for (std::set<ObjectPtr>::const_iterator aHiddenIt = theHiddenObjects.begin();
216     aHiddenIt != theHiddenObjects.end(); aHiddenIt++)
217   {
218     if (myHiddenObjects.find(*aHiddenIt) != myHiddenObjects.end()) /// found objects
219       myHiddenObjects.erase(*aHiddenIt);
220   }
221 }
222
223 //********************************************************************
224 bool XGUI_FacesPanel::processAction(ModuleBase_ActionType theActionType)
225 {
226   switch (theActionType) {
227     //case ActionEnter:
228     //  return processEnter();
229     case ActionEscape:
230       setActivePanel(false);
231       return true;
232     case ActionDelete:
233       return processDelete();
234     //case ActionUndo:
235     //case ActionRedo:
236     default:
237       return false;
238   }
239 }
240
241 //********************************************************************
242 void XGUI_FacesPanel::getObjectsMapFromPrs(ModuleBase_ViewerPrsPtr thePrs,
243   std::map<ObjectPtr, TopoDS_ListOfShape>& theObjectToShapes,
244   std::map<ObjectPtr, Handle(ModuleBase_ResultPrs) >& theObjectToPrs)
245 {
246   ObjectPtr anObject = thePrs->object();
247   if (!anObject.get())
248     return;
249
250   XGUI_Displayer* aDisplayer = myWorkshop->displayer();
251   ResultGroupPtr aResGroup = std::dynamic_pointer_cast<ModelAPI_ResultGroup>(anObject);
252   if (aResGroup.get()) {
253     // Process a grouip result
254     FeaturePtr aGroupFeature = ModelAPI_Feature::feature(aResGroup);
255     AttributeSelectionListPtr aSelectionList = aGroupFeature->selectionList("group_list");
256     AISObjectPtr aPrs;
257     for (int i = 0; i < aSelectionList->size(); i++) {
258       AttributeSelectionPtr aSelection = aSelectionList->value(i);
259       ResultPtr aRes = aSelection->context();
260       aPrs = aDisplayer->getAISObject(aRes);
261       if (aPrs.get()) {
262         Handle(ModuleBase_ResultPrs) aResultPrs = Handle(ModuleBase_ResultPrs)::DownCast(
263           aPrs->impl<Handle(AIS_InteractiveObject)>());
264         if (!aResultPrs.IsNull()) {
265           GeomShapePtr aShape = aSelection->value();
266           if (theObjectToShapes.find(aRes) != theObjectToShapes.end())
267             theObjectToShapes.at(aRes).Append(aShape->impl<TopoDS_Shape>());
268           else {
269             TopoDS_ListOfShape aListOfShapes;
270             aListOfShapes.Append(aShape->impl<TopoDS_Shape>());
271             theObjectToShapes[aRes] = aListOfShapes;
272             theObjectToPrs[aRes] = aResultPrs;
273           }
274         }
275       }
276     }
277   }
278   else {
279     // Process bodies
280     Handle(ModuleBase_ResultPrs) aResultPrs = Handle(ModuleBase_ResultPrs)::DownCast(
281       thePrs->interactive());
282     if (aResultPrs.IsNull())
283       return;
284
285     if (theObjectToShapes.find(anObject) != theObjectToShapes.end())
286       theObjectToShapes.at(anObject).Append(ModuleBase_Tools::getSelectedShape(thePrs));
287     else {
288       TopoDS_ListOfShape aListOfShapes;
289       aListOfShapes.Append(ModuleBase_Tools::getSelectedShape(thePrs));
290       theObjectToShapes[anObject] = aListOfShapes;
291       theObjectToPrs[anObject] = aResultPrs;
292     }
293   }
294 }
295
296 //********************************************************************
297 void XGUI_FacesPanel::processSelection()
298 {
299   QList<ModuleBase_ViewerPrsPtr> aSelected =
300     myWorkshop->selector()->selection()->getSelected(ModuleBase_ISelection::Viewer);
301
302   if (aSelected.size() == 0)
303     return;
304
305   bool isModified = false;
306   static Events_ID aDispEvent = Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY);
307
308   std::map<ObjectPtr, TopoDS_ListOfShape> anObjectToShapes;
309   std::map<ObjectPtr, Handle(ModuleBase_ResultPrs) > anObjectToPrs;
310   std::set<int> aToRemove;
311
312   for (int i = 0; i < aSelected.size(); i++) {
313     ModuleBase_ViewerPrsPtr aPrs = aSelected[i];
314     ObjectPtr anObject = aPrs->object();
315     if (!anObject.get())
316       continue;
317
318     ResultGroupPtr aResGroup = std::dynamic_pointer_cast<ModelAPI_ResultGroup>(anObject);
319     if (aResGroup.get()) {
320       FeaturePtr aFeature = ModelAPI_Feature::feature(aResGroup);
321       if (aFeature.get()) {
322         AttributeSelectionListPtr aSelectionListAttr = aFeature->data()->selectionList("group_list");
323         std::string aType = aSelectionListAttr->selectionType();
324         if (aType != "Faces")
325           continue;
326       }
327     }
328     else {
329       GeomShapePtr aShapePtr = aPrs->shape();
330       if (!aShapePtr.get() || !aShapePtr->isFace())
331         continue;
332     }
333
334     QString aItemName = aResGroup.get()?
335       aResGroup->data()->name().c_str() : XGUI_Tools::generateName(aPrs);
336     if (myListView->hasItem(aItemName))
337       continue;
338
339     getObjectsMapFromPrs(aPrs, anObjectToShapes, anObjectToPrs);
340     if (aResGroup.get() && aResGroup->isDisplayed()) {
341       aResGroup->setDisplayed(false);
342       myHiddenGroups.insert(aResGroup);
343     }
344
345     // The code is dedicated to remove already selected items if they are selected twice
346     // It can happen in case of groups selection
347     QMap<int, ModuleBase_ViewerPrsPtr>::const_iterator aIt;
348     for (aIt = myItems.cbegin(); aIt != myItems.cend(); aIt++) {
349       ModuleBase_ViewerPrsPtr aPrs = aIt.value();
350       ObjectPtr aObject = aPrs->object();
351       ResultGroupPtr aResGroup = std::dynamic_pointer_cast<ModelAPI_ResultGroup>(aObject);
352       if (aResGroup.get())
353         continue;
354       if (anObjectToShapes.find(aObject) != anObjectToShapes.end()) {
355         TopoDS_ListOfShape aShapes = anObjectToShapes[aObject];
356         GeomShapePtr aShapePtr = aPrs->shape();
357         if (aShapes.Contains(aShapePtr->impl<TopoDS_Shape>())) {
358           aToRemove.insert(aIt.key());
359         }
360       }
361     }
362
363     myItems.insert(myLastItemIndex, aPrs);
364     myListView->addItem(aItemName, myLastItemIndex);
365     myLastItemIndex++;
366     isModified = true;
367   }
368
369   // Hide fully hidden shapes
370   std::map<ObjectPtr, TopoDS_ListOfShape>::const_iterator anIt;
371   for (anIt = anObjectToShapes.begin(); anIt != anObjectToShapes.end(); anIt++) {
372     ObjectPtr anObject = anIt->first;
373     if (!anObject.get() || anObjectToPrs.find(anObject) == anObjectToPrs.end())
374       continue;
375     Handle(ModuleBase_ResultPrs) aResultPrs = anObjectToPrs.at(anObject);
376
377     if (!aResultPrs->hasSubShapeVisible(anIt->second)) { // redisplay
378       // erase object because it is entirely hidden
379       anObject->setDisplayed(false);
380       myHiddenObjects.insert(anObject);
381     }
382     ModelAPI_EventCreator::get()->sendUpdated(anObject, aDispEvent);
383   }
384
385   // Process selected presentations
386   double aTransp = transparency();
387   std::map<ObjectPtr, Handle(ModuleBase_ResultPrs)>::iterator aPrsIt;
388   for (aPrsIt = anObjectToPrs.begin(); aPrsIt != anObjectToPrs.end(); aPrsIt++) {
389     ObjectPtr anObject = aPrsIt->first;
390     Handle(ModuleBase_ResultPrs) aPrs = aPrsIt->second;
391     TopoDS_ListOfShape aAlreadyHidden = aPrs->hiddenSubShapes();
392     TopoDS_ListOfShape aListOfShapes = anObjectToShapes[anObject];
393     TopoDS_ListOfShape::Iterator aShapesIt(aListOfShapes);
394     for (; aShapesIt.More(); aShapesIt.Next()) {
395       if (!aAlreadyHidden.Contains(aShapesIt.Value()))
396         aAlreadyHidden.Append(aShapesIt.Value());
397     }
398     aPrs->setSubShapeHidden(aAlreadyHidden);
399     aPrs->setHiddenSubShapeTransparency(aTransp);
400   }
401
402   // Remove duplicate items
403   if (aToRemove.size() > 0) {
404     myListView->removeItems(aToRemove);
405     std::set<int>::const_iterator aIntIt;
406     for (aIntIt = aToRemove.cbegin(); aIntIt != aToRemove.cend(); aIntIt++)
407       myItems.remove(*aIntIt);
408   }
409   if (isModified) {
410     updateProcessedObjects(myItems, myItemObjects);
411     flushRedisplay();
412   }
413 }
414
415 //********************************************************************
416 bool XGUI_FacesPanel::processDelete()
417 {
418   //appendFirstSelectionInHistory();
419   QModelIndexList anIndices = myListView->getControl()->selectionModel()->selectedIndexes();
420
421   std::set<int> aSelectedIds;
422   myListView->getSelectedIndices(aSelectedIds);
423   if (aSelectedIds.empty())
424     return false;
425
426   bool isModified = false;
427   std::set<ModuleBase_ViewerPrsPtr> aRestored;
428   std::set<int>::const_iterator anIt;
429   for (anIt = aSelectedIds.begin(); anIt != aSelectedIds.end(); anIt++) {
430     ModuleBase_ViewerPrsPtr aPrs = myItems[*anIt];
431     if (aRestored.find(aPrs) == aRestored.end()) {
432       aRestored.insert(aPrs);
433       myItems.remove(*anIt);
434       isModified = true;
435     }
436   }
437   std::map<ObjectPtr, TopoDS_ListOfShape> anObjectToShapes;
438   std::map<ObjectPtr, Handle(ModuleBase_ResultPrs) > anObjectToPrs;
439
440   std::set<ModuleBase_ViewerPrsPtr>::const_iterator aIt;
441   for (aIt = aRestored.cbegin(); aIt != aRestored.cend(); aIt++) {
442     getObjectsMapFromPrs((*aIt), anObjectToShapes, anObjectToPrs);
443     ResultGroupPtr aResGroup = std::dynamic_pointer_cast<ModelAPI_ResultGroup>((*aIt)->object());
444     if (aResGroup.get()) {
445       std::set<std::shared_ptr<ModelAPI_Object> >::iterator aGrpIt = myHiddenGroups.find(aResGroup);
446       if (aGrpIt != myHiddenGroups.end()) {
447         aResGroup->setDisplayed(true);
448         myHiddenGroups.erase(aGrpIt);
449       }
450     }
451   }
452
453   std::set<ObjectPtr> aRestoredObjects;
454   std::map<ObjectPtr, TopoDS_ListOfShape>::const_iterator aShapesIt;
455   for (aShapesIt = anObjectToShapes.begin(); aShapesIt != anObjectToShapes.end(); aShapesIt++) {
456     TopoDS_ListOfShape aShapes = aShapesIt->second;
457     aRestoredObjects.insert(aShapesIt->first);
458     Handle(ModuleBase_ResultPrs) aPrs = anObjectToPrs[aShapesIt->first];
459     TopoDS_ListOfShape aHiddenShapes = aPrs->hiddenSubShapes();
460     TopoDS_ListOfShape::Iterator aSubShapesIt(aShapes);
461     for (; aSubShapesIt.More(); aSubShapesIt.Next()) {
462       if (aHiddenShapes.Contains(aSubShapesIt.Value()))
463         aHiddenShapes.Remove(aSubShapesIt.Value());
464     }
465     aPrs->setSubShapeHidden(aHiddenShapes);
466   }
467   if (redisplayObjects(aRestoredObjects))
468     flushRedisplay();
469
470   myListView->removeSelectedItems();
471   return true;
472 }
473
474 //********************************************************************
475 bool XGUI_FacesPanel::redisplayObjects(
476   const std::set<std::shared_ptr<ModelAPI_Object> >& theObjects)
477 {
478   if (theObjects.empty())
479     return false;
480
481   bool isModified = false;
482   static Events_ID aDispEvent = Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY);
483   for (std::set<ObjectPtr>::const_iterator anIt = theObjects.begin(); anIt != theObjects.end();
484        anIt++)
485   {
486     ObjectPtr anObject = *anIt;
487     if (!anObject->isDisplayed())
488       continue;
489     ModelAPI_EventCreator::get()->sendUpdated(anObject, aDispEvent);
490     isModified = true;
491   }
492   return isModified;
493 }
494
495 //********************************************************************
496 void XGUI_FacesPanel::updateProcessedObjects(QMap<int, ModuleBase_ViewerPrsPtr> theItems,
497                                              std::set<ObjectPtr>& theObjects)
498 {
499   theObjects.clear();
500   for (QMap<int, ModuleBase_ViewerPrsPtr>::const_iterator anIt = theItems.begin();
501        anIt != theItems.end(); anIt++) {
502     ModuleBase_ViewerPrsPtr aPrs = anIt.value();
503     ObjectPtr anObject = aPrs.get() ? aPrs->object() : ObjectPtr();
504     if (anObject.get()) {
505       ResultGroupPtr aResGroup = std::dynamic_pointer_cast<ModelAPI_ResultGroup>(anObject);
506       if (aResGroup.get()) {
507         FeaturePtr aGroupFeature = ModelAPI_Feature::feature(aResGroup);
508         AttributeSelectionListPtr aSelectionList = aGroupFeature->selectionList("group_list");
509         for (int i = 0; i < aSelectionList->size(); i++) {
510           AttributeSelectionPtr aSelection = aSelectionList->value(i);
511           ResultPtr aRes = aSelection->context();
512           if (theObjects.find(aRes) == theObjects.end())
513             theObjects.insert(aRes);
514         }
515       }
516       else {
517         if (theObjects.find(anObject) == theObjects.end())
518           theObjects.insert(anObject);
519       }
520     }
521   }
522 }
523
524 //********************************************************************
525 void XGUI_FacesPanel::closeEvent(QCloseEvent* theEvent)
526 {
527   QDockWidget::closeEvent(theEvent);
528   emit closed();
529 }
530
531 //********************************************************************
532 bool XGUI_FacesPanel::customizeObject(const ObjectPtr& theObject,
533   const AISObjectPtr& thePresentation)
534 {
535   return myItems.size() > 0;
536 }
537
538 //********************************************************************
539 void XGUI_FacesPanel::onDeleteItem()
540 {
541   processDelete();
542 }
543
544 //********************************************************************
545 void XGUI_FacesPanel::onTransparencyChanged()
546 {
547   std::map<ObjectPtr, TopoDS_ListOfShape> anObjectToShapes;
548   std::map<ObjectPtr, Handle(ModuleBase_ResultPrs) > anObjectToPrs;
549   QMap<int, std::shared_ptr<ModuleBase_ViewerPrs> >::const_iterator aIt;
550   for (aIt = myItems.cbegin(); aIt != myItems.cend(); aIt++) {
551     getObjectsMapFromPrs(aIt.value(), anObjectToShapes, anObjectToPrs);
552   }
553
554   double aTransp = Config_PropManager::real("Visualization", "hidden_face_transparency");
555   std::set<ObjectPtr> aObjects;
556   std::map<ObjectPtr, Handle(ModuleBase_ResultPrs)>::const_iterator aPrsIt;
557   for (aPrsIt = anObjectToPrs.cbegin(); aPrsIt != anObjectToPrs.cend(); aPrsIt++) {
558     aObjects.insert(aPrsIt->first);
559     aPrsIt->second->setHiddenSubShapeTransparency(useTransparency()? aTransp : 1);
560   }
561   if (redisplayObjects(aObjects))
562     flushRedisplay();
563 }
564
565 //********************************************************************
566 void XGUI_FacesPanel::onClosed()
567 {
568   setActivePanel(false);
569   reset(true);
570 }
571
572 //********************************************************************
573 void XGUI_FacesPanel::flushRedisplay() const
574 {
575   Events_Loop::loop()->flush(Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY));
576   // Necessary for update visibility icons in ObjectBrowser
577   XGUI_ObjectsBrowser* anObjectBrowser = myWorkshop->objectBrowser();
578   if (anObjectBrowser)
579     anObjectBrowser->updateAllIndexes();
580   myWorkshop->viewer()->update();
581 }