1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
3 // File: XGUI_Displayer.cpp
4 // Created: 20 Apr 2014
5 // Author: Natalia ERMOLAEVA
7 #include "XGUI_Displayer.h"
8 #include "XGUI_Workshop.h"
9 #include "XGUI_ViewerProxy.h"
10 #include "XGUI_SelectionMgr.h"
11 #include "XGUI_Selection.h"
13 #include <AppElements_Viewer.h>
15 #include <ModelAPI_Document.h>
16 #include <ModelAPI_Data.h>
17 #include <ModelAPI_Object.h>
18 #include <ModelAPI_Tools.h>
20 #include <ModuleBase_ResultPrs.h>
22 #include <GeomAPI_Shape.h>
23 #include <GeomAPI_IPresentable.h>
24 #include <GeomAPI_ICustomPrs.h>
26 #include <AIS_InteractiveContext.hxx>
27 #include <AIS_LocalContext.hxx>
28 #include <AIS_ListOfInteractive.hxx>
29 #include <AIS_ListIteratorOfListOfInteractive.hxx>
30 #include <AIS_DimensionSelectionMode.hxx>
31 #include <AIS_Shape.hxx>
32 #include <AIS_Dimension.hxx>
33 #include <TColStd_ListIteratorOfListOfInteger.hxx>
34 #include <SelectMgr_ListOfFilter.hxx>
35 #include <SelectMgr_ListIteratorOfListOfFilter.hxx>
37 #include <TColStd_MapOfTransient.hxx>
38 #include <TColStd_MapIteratorOfMapOfTransient.hxx>
42 const int MOUSE_SENSITIVITY_IN_PIXEL = 10; ///< defines the local context mouse selection sensitivity
45 // Workaround for bug #25637
46 void displayedObjects(const Handle(AIS_InteractiveContext)& theAIS, AIS_ListOfInteractive& theList)
48 // Get from null point
49 theAIS->DisplayedObjects(theList, true);
50 if (theAIS->HasOpenedContext()) {
51 // get from local context
52 const Handle(AIS_LocalContext)& aLC = theAIS->LocalContext();
53 TColStd_MapOfTransient aMap;
54 int NbDisp = aLC->DisplayedObjects(aMap);
55 TColStd_MapIteratorOfMapOfTransient aIt(aMap);
57 Handle(AIS_InteractiveObject) curIO;
58 Handle(Standard_Transient) Tr;
59 for(; aIt.More(); aIt.Next()){
61 curIO = *((Handle(AIS_InteractiveObject)*) &Tr);
62 theList.Append(curIO);
68 XGUI_Displayer::XGUI_Displayer(XGUI_Workshop* theWorkshop)
69 : myWorkshop(theWorkshop)
71 enableUpdateViewer(true);
74 XGUI_Displayer::~XGUI_Displayer()
78 bool XGUI_Displayer::isVisible(ObjectPtr theObject) const
80 return myResult2AISObjectMap.contains(theObject);
83 void XGUI_Displayer::display(ObjectPtr theObject, bool isUpdateViewer)
85 if (isVisible(theObject)) {
86 redisplay(theObject, isUpdateViewer);
90 GeomPresentablePtr aPrs = std::dynamic_pointer_cast<GeomAPI_IPresentable>(theObject);
91 bool isShading = false;
92 if (aPrs.get() != NULL) {
93 anAIS = aPrs->getAISObject(AISObjectPtr());
95 ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(theObject);
96 if (aResult.get() != NULL) {
97 std::shared_ptr<GeomAPI_Shape> aShapePtr = ModelAPI_Tools::shape(aResult);
98 if (aShapePtr.get() != NULL) {
99 anAIS = AISObjectPtr(new GeomAPI_AISObject());
100 anAIS->setImpl(new Handle(AIS_InteractiveObject)(new ModuleBase_ResultPrs(aResult)));
101 //anAIS->createShape(aShapePtr);
107 display(theObject, anAIS, isShading, isUpdateViewer);
111 bool canBeShaded(Handle(AIS_InteractiveObject) theAIS)
113 Handle(AIS_Shape) aShapePrs = Handle(AIS_Shape)::DownCast(theAIS);
114 if (!aShapePrs.IsNull()) {
115 TopoDS_Shape aShape = aShapePrs->Shape();
116 TopAbs_ShapeEnum aType = aShape.ShapeType();
117 if ((aType == TopAbs_VERTEX) || (aType == TopAbs_EDGE) || (aType == TopAbs_WIRE))
120 // Check that the presentation is not a sketch
121 Handle(ModuleBase_ResultPrs) aPrs = Handle(ModuleBase_ResultPrs)::DownCast(theAIS);
123 return !aPrs->isSketchMode();
130 void XGUI_Displayer::display(ObjectPtr theObject, AISObjectPtr theAIS,
131 bool isShading, bool isUpdateViewer)
133 Handle(AIS_InteractiveContext) aContext = AISContext();
134 if (aContext.IsNull())
137 Handle(AIS_InteractiveObject) anAISIO = theAIS->impl<Handle(AIS_InteractiveObject)>();
138 if (!anAISIO.IsNull()) {
139 myResult2AISObjectMap[theObject] = theAIS;
140 bool aCanBeShaded = ::canBeShaded(anAISIO);
141 // In order to avoid extra closing/opening context
142 SelectMgr_IndexedMapOfOwner aSelectedOwners;
144 myWorkshop->selector()->selection()->selectedOwners(aSelectedOwners);
145 closeLocalContexts(false);
147 aContext->Display(anAISIO, false);
148 qDebug("### Display %i", (long)anAISIO.Access());
150 aContext->SetDisplayMode(anAISIO, isShading? Shading : Wireframe, false);
151 // Customization of presentation
152 FeaturePtr aFeature = ModelAPI_Feature::feature(theObject);
153 if (aFeature.get() != NULL) {
154 GeomCustomPrsPtr aCustPrs = std::dynamic_pointer_cast<GeomAPI_ICustomPrs>(aFeature);
155 if (aCustPrs.get() != NULL)
156 aCustPrs->customisePresentation(theAIS);
160 activateObjects(myActiveSelectionModes);
161 myWorkshop->selector()->setSelectedOwners(aSelectedOwners, false);
168 void XGUI_Displayer::erase(ObjectPtr theObject, const bool isUpdateViewer)
170 if (!isVisible(theObject))
173 Handle(AIS_InteractiveContext) aContext = AISContext();
174 if (aContext.IsNull())
176 AISObjectPtr anObject = myResult2AISObjectMap[theObject];
178 Handle(AIS_InteractiveObject) anAIS = anObject->impl<Handle(AIS_InteractiveObject)>();
179 if (!anAIS.IsNull()) {
180 aContext->Remove(anAIS, isUpdateViewer);
183 myResult2AISObjectMap.remove(theObject);
186 void XGUI_Displayer::redisplay(ObjectPtr theObject, bool isUpdateViewer)
188 if (!isVisible(theObject))
191 AISObjectPtr aAISObj = getAISObject(theObject);
192 Handle(AIS_InteractiveObject) aAISIO = aAISObj->impl<Handle(AIS_InteractiveObject)>();
194 GeomPresentablePtr aPrs = std::dynamic_pointer_cast<GeomAPI_IPresentable>(theObject);
196 AISObjectPtr aAIS_Obj = aPrs->getAISObject(aAISObj);
198 erase(theObject, isUpdateViewer);
201 if (aAIS_Obj != aAISObj) {
202 myResult2AISObjectMap[theObject] = aAIS_Obj;
204 aAISIO = aAIS_Obj->impl<Handle(AIS_InteractiveObject)>();
207 if (!aAISIO.IsNull()) {
208 Handle(AIS_InteractiveContext) aContext = AISContext();
209 if (aContext.IsNull())
211 // Check that the visualized shape is the same and the redisplay is not necessary
212 // Redisplay of AIS object leads to this object selection compute and the selection
213 // in the browser is lost
215 ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(theObject);
216 if (aResult.get() != NULL) {
217 Handle(AIS_Shape) aShapePrs = Handle(AIS_Shape)::DownCast(aAISIO);
218 if (!aShapePrs.IsNull()) {
219 std::shared_ptr<GeomAPI_Shape> aShapePtr = ModelAPI_Tools::shape(aResult);
220 if (aShapePtr.get()) {
221 const TopoDS_Shape& aShape = aShapePrs->Shape();
222 std::shared_ptr<GeomAPI_Shape> anAISShapePtr(new GeomAPI_Shape());
223 anAISShapePtr->setImpl(new TopoDS_Shape(aShape));
225 if (aShapePtr->isEqual(anAISShapePtr))
230 aContext->Redisplay(aAISIO, false);
236 void XGUI_Displayer::deactivate(ObjectPtr theObject)
238 if (isVisible(theObject)) {
239 Handle(AIS_InteractiveContext) aContext = AISContext();
240 if (aContext.IsNull())
243 AISObjectPtr anObj = myResult2AISObjectMap[theObject];
244 Handle(AIS_InteractiveObject) anAIS = anObj->impl<Handle(AIS_InteractiveObject)>();
245 aContext->Deactivate(anAIS);
246 qDebug("### Deactivate obj %i", (long)anAIS.Access());
250 void XGUI_Displayer::activate(ObjectPtr theFeature)
252 activate(theFeature, myActiveSelectionModes);
255 void XGUI_Displayer::activate(ObjectPtr theObject, const QIntList& theModes)
257 if (isVisible(theObject)) {
258 Handle(AIS_InteractiveContext) aContext = AISContext();
259 if (aContext.IsNull())
262 AISObjectPtr anObj = myResult2AISObjectMap[theObject];
263 Handle(AIS_InteractiveObject) anAIS = anObj->impl<Handle(AIS_InteractiveObject)>();
264 aContext->Deactivate(anAIS);
265 aContext->Load(anAIS, -1, true);
266 // In order to clear active modes list
267 if (theModes.size() > 0) {
268 foreach(int aMode, theModes) {
269 //aContext->Load(anAIS, aMode, true);
270 aContext->Activate(anAIS, aMode);
271 qDebug("### 1. Activate obj %i, %i", (long)anAIS.Access(), aMode);
274 //aContext->Load(anAIS, 0, true);
275 aContext->Activate(anAIS);
276 qDebug("### 2. Activate obj %i", (long)anAIS.Access());
281 void XGUI_Displayer::getModesOfActivation(ObjectPtr theObject, QIntList& theModes)
283 if (!isVisible(theObject))
286 Handle(AIS_InteractiveContext) aContext = AISContext();
287 if (aContext.IsNull())
290 AISObjectPtr aAISObj = getAISObject(theObject);
292 if (aAISObj.get() != NULL) {
293 Handle(AIS_InteractiveObject) anAISIO = aAISObj->impl<Handle(AIS_InteractiveObject)>();
294 TColStd_ListOfInteger aTColModes;
295 aContext->ActivatedModes(anAISIO, aTColModes);
296 TColStd_ListIteratorOfListOfInteger itr( aTColModes );
297 for (; itr.More(); itr.Next() ) {
298 theModes.append(itr.Value());
303 void XGUI_Displayer::activateObjects(const QIntList& theModes)
305 // In order to avoid doblications of selection modes
307 foreach (int aMode, theModes) {
308 if (!aNewModes.contains(aMode))
309 aNewModes.append(aMode);
311 myActiveSelectionModes = aNewModes;
312 Handle(AIS_InteractiveContext) aContext = AISContext();
313 // Open local context if there is no one
314 if (!aContext->HasOpenedContext())
317 //aContext->UseDisplayedObjects();
318 //myUseExternalObjects = true;
320 AIS_ListOfInteractive aPrsList;
321 ::displayedObjects(aContext, aPrsList);
323 Handle(AIS_Trihedron) aTrihedron;
324 AIS_ListIteratorOfListOfInteractive aLIt(aPrsList);
325 Handle(AIS_InteractiveObject) anAISIO;
326 for(aLIt.Initialize(aPrsList); aLIt.More(); aLIt.Next()){
327 anAISIO = aLIt.Value();
328 aContext->Load(anAISIO, -1, true);
329 aContext->Deactivate(anAISIO);
330 aTrihedron = Handle(AIS_Trihedron)::DownCast(anAISIO);
331 //Deactivate trihedron which can be activated in local selector
332 if (aTrihedron.IsNull()) {
333 //aContext->Load(anAISIO, -1, true);
334 // In order to clear active modes list
335 if (myActiveSelectionModes.size() == 0) {
336 //aContext->Load(anAISIO, 0, true);
337 aContext->Activate(anAISIO);
338 qDebug("### 2. Activate all %i", (long)anAISIO.Access());
340 foreach(int aMode, myActiveSelectionModes) {
341 //aContext->Load(anAISIO, aMode, true);
342 aContext->Activate(anAISIO, aMode);
343 qDebug("### 1. Activate all %i, %i", (long)anAISIO.Access(), aMode);
351 void XGUI_Displayer::deactivateObjects()
353 myActiveSelectionModes.clear();
354 Handle(AIS_InteractiveContext) aContext = AISContext();
355 // Open local context if there is no one
356 if (!aContext->HasOpenedContext())
359 //aContext->NotUseDisplayedObjects();
360 AIS_ListOfInteractive aPrsList;
361 ::displayedObjects(aContext, aPrsList);
363 AIS_ListIteratorOfListOfInteractive aLIt;
364 //Handle(AIS_Trihedron) aTrihedron;
365 Handle(AIS_InteractiveObject) anAISIO;
366 for(aLIt.Initialize(aPrsList); aLIt.More(); aLIt.Next()){
367 anAISIO = aLIt.Value();
368 aContext->Deactivate(anAISIO);
369 //aTrihedron = Handle(AIS_Trihedron)::DownCast(anAISIO);
370 //if (aTrihedron.IsNull()) {
371 // qDebug("### Deactivate all %i", (long)anAISIO.Access());
372 // //aContext->Activate(anAISIO);
377 bool XGUI_Displayer::isActive(ObjectPtr theObject) const
379 Handle(AIS_InteractiveContext) aContext = AISContext();
380 if (aContext.IsNull())
382 if (!isVisible(theObject))
385 AISObjectPtr anObj = myResult2AISObjectMap[theObject];
386 Handle(AIS_InteractiveObject) anAIS = anObj->impl<Handle(AIS_InteractiveObject)>();
388 TColStd_ListOfInteger aModes;
389 aContext->ActivatedModes(anAIS, aModes);
390 return aModes.Extent() > 0;
393 void XGUI_Displayer::setSelected(const QObjectPtrList& theResults, const bool isUpdateViewer)
395 Handle(AIS_InteractiveContext) aContext = AISContext();
396 if (aContext.IsNull())
398 if (aContext->HasOpenedContext()) {
399 aContext->UnhilightSelected();
400 aContext->ClearSelected();
401 foreach(ObjectPtr aResult, theResults) {
402 if (isVisible(aResult)) {
403 AISObjectPtr anObj = myResult2AISObjectMap[aResult];
404 Handle(AIS_InteractiveObject) anAIS = anObj->impl<Handle(AIS_InteractiveObject)>();
406 aContext->SetSelected(anAIS, false);
410 aContext->UnhilightCurrents();
411 aContext->ClearCurrents();
412 foreach(ObjectPtr aResult, theResults) {
413 if (isVisible(aResult)) {
414 AISObjectPtr anObj = myResult2AISObjectMap[aResult];
415 Handle(AIS_InteractiveObject) anAIS = anObj->impl<Handle(AIS_InteractiveObject)>();
417 aContext->SetCurrentObject(anAIS, false);
426 void XGUI_Displayer::clearSelected()
428 Handle(AIS_InteractiveContext) aContext = AISContext();
430 aContext->UnhilightCurrents(false);
431 aContext->ClearSelected();
435 void XGUI_Displayer::eraseAll(const bool isUpdateViewer)
437 Handle(AIS_InteractiveContext) aContext = AISContext();
438 if (aContext.IsNull())
441 foreach (AISObjectPtr aAISObj, myResult2AISObjectMap) {
443 Handle(AIS_InteractiveObject) anIO = aAISObj->impl<Handle(AIS_InteractiveObject)>();
445 aContext->Remove(anIO, false);
447 myResult2AISObjectMap.clear();
452 void XGUI_Displayer::openLocalContext()
454 Handle(AIS_InteractiveContext) aContext = myWorkshop->viewer()->AISContext();
455 if (aContext.IsNull())
457 // Open local context if there is no one
458 if (!aContext->HasOpenedContext()) {
459 // Preserve selected objects
460 //AIS_ListOfInteractive aAisList;
461 //for (aContext->InitCurrent(); aContext->MoreCurrent(); aContext->NextCurrent())
462 // aAisList.Append(aContext->Current());
464 // get the filters from the global context and append them to the local context
465 // a list of filters in the global context is not cleared and should be cleared here
466 SelectMgr_ListOfFilter aFilters;
467 aFilters.Assign(aContext->Filters());
468 // it is important to remove the filters in the global context, because there is a code
469 // in the closeLocalContex, which restore the global context filters
470 aContext->RemoveFilters();
472 //aContext->ClearCurrents();
473 aContext->OpenLocalContext();
474 qDebug("### Open context");
475 //aContext->NotUseDisplayedObjects();
477 //myUseExternalObjects = false;
479 SelectMgr_ListIteratorOfListOfFilter aIt(aFilters);
480 for (;aIt.More(); aIt.Next()) {
481 aContext->AddFilter(aIt.Value());
484 //AIS_ListIteratorOfListOfInteractive aIt2(aAisList);
485 //for(; aIt2.More(); aIt2.Next()) {
486 // aContext->SetSelected(aIt2.Value(), false);
491 void XGUI_Displayer::closeLocalContexts(const bool isUpdateViewer)
493 Handle(AIS_InteractiveContext) aContext = AISContext();
494 if ( (!aContext.IsNull()) && (aContext->HasOpenedContext()) ) {
495 // Preserve selected objects
496 //AIS_ListOfInteractive aAisList;
497 //for (aContext->InitSelected(); aContext->MoreSelected(); aContext->NextSelected())
498 // aAisList.Append(aContext->SelectedInteractive());
500 // get the filters from the local context and append them to the global context
501 // a list of filters in the local context is cleared
502 SelectMgr_ListOfFilter aFilters;
503 aFilters.Assign(aContext->Filters());
505 //aContext->ClearSelected();
506 aContext->CloseAllContexts(false);
507 qDebug("### Close context");
509 // Redisplay all object if they were displayed in localContext
510 Handle(AIS_InteractiveObject) aAISIO;
511 foreach (AISObjectPtr aAIS, myResult2AISObjectMap) {
512 aAISIO = aAIS->impl<Handle(AIS_InteractiveObject)>();
513 if (aContext->DisplayStatus(aAISIO) != AIS_DS_Displayed) {
514 aContext->Display(aAISIO, false);
515 aContext->SetDisplayMode(aAISIO, Shading, false);
519 // Append the filters from the local selection in the global selection context
520 SelectMgr_ListIteratorOfListOfFilter aIt(aFilters);
521 for (;aIt.More(); aIt.Next()) {
522 Handle(SelectMgr_Filter) aFilter = aIt.Value();
523 aContext->AddFilter(aFilter);
528 //myUseExternalObjects = false;
531 //AIS_ListIteratorOfListOfInteractive aIt2(aAisList);
532 //for(; aIt2.More(); aIt2.Next()) {
533 // if (aContext->IsDisplayed(aIt2.Value()))
534 // aContext->SetCurrentObject(aIt2.Value(), false);
539 AISObjectPtr XGUI_Displayer::getAISObject(ObjectPtr theObject) const
542 if (myResult2AISObjectMap.contains(theObject))
543 anIO = myResult2AISObjectMap[theObject];
547 ObjectPtr XGUI_Displayer::getObject(const AISObjectPtr& theIO) const
549 Handle(AIS_InteractiveObject) aRefAIS = theIO->impl<Handle(AIS_InteractiveObject)>();
550 return getObject(aRefAIS);
553 ObjectPtr XGUI_Displayer::getObject(const Handle(AIS_InteractiveObject)& theIO) const
556 foreach (ObjectPtr anObj, myResult2AISObjectMap.keys()) {
557 AISObjectPtr aAIS = myResult2AISObjectMap[anObj];
558 Handle(AIS_InteractiveObject) anAIS = aAIS->impl<Handle(AIS_InteractiveObject)>();
565 bool XGUI_Displayer::enableUpdateViewer(const bool isEnabled)
567 bool aWasEnabled = myEnableUpdateViewer;
569 myEnableUpdateViewer = isEnabled;
574 void XGUI_Displayer::updateViewer()
576 Handle(AIS_InteractiveContext) aContext = AISContext();
577 if (!aContext.IsNull() && myEnableUpdateViewer)
578 aContext->UpdateCurrentViewer();
581 Handle(AIS_InteractiveContext) XGUI_Displayer::AISContext() const
583 Handle(AIS_InteractiveContext) aContext = myWorkshop->viewer()->AISContext();
584 if ((!aContext.IsNull()) && (!aContext->HasOpenedContext())) {
585 aContext->OpenLocalContext();
586 qDebug("### Open context");
591 Handle(SelectMgr_AndFilter) XGUI_Displayer::GetFilter()
593 Handle(AIS_InteractiveContext) aContext = AISContext();
594 if (myAndFilter.IsNull() && !aContext.IsNull()) {
595 myAndFilter = new SelectMgr_AndFilter();
596 aContext->AddFilter(myAndFilter);
601 void XGUI_Displayer::displayAIS(AISObjectPtr theAIS, bool isUpdate)
603 Handle(AIS_InteractiveContext) aContext = AISContext();
604 Handle(AIS_InteractiveObject) anAISIO = theAIS->impl<Handle(AIS_InteractiveObject)>();
605 if (!anAISIO.IsNull()) {
606 aContext->Display(anAISIO, isUpdate);
607 if (aContext->HasOpenedContext()) {
608 //if (myUseExternalObjects) {
609 if (myActiveSelectionModes.size() == 0)
610 aContext->Activate(anAISIO);
612 foreach(int aMode, myActiveSelectionModes) {
613 aContext->Activate(anAISIO, aMode);
621 void XGUI_Displayer::eraseAIS(AISObjectPtr theAIS, const bool isUpdate)
623 Handle(AIS_InteractiveContext) aContext = AISContext();
624 Handle(AIS_InteractiveObject) anAISIO = theAIS->impl<Handle(AIS_InteractiveObject)>();
625 if (!anAISIO.IsNull()) {
626 aContext->Remove(anAISIO, isUpdate);
631 void XGUI_Displayer::setDisplayMode(ObjectPtr theObject, DisplayMode theMode, bool toUpdate)
633 if (theMode == NoMode)
636 Handle(AIS_InteractiveContext) aContext = AISContext();
637 if (aContext.IsNull())
640 AISObjectPtr aAISObj = getAISObject(theObject);
644 Handle(AIS_InteractiveObject) aAISIO = aAISObj->impl<Handle(AIS_InteractiveObject)>();
645 bool aCanBeShaded = ::canBeShaded(aAISIO);
646 // In order to avoid extra closing/opening context
647 SelectMgr_IndexedMapOfOwner aSelectedOwners;
649 myWorkshop->selector()->selection()->selectedOwners(aSelectedOwners);
650 closeLocalContexts(false);
652 aContext->SetDisplayMode(aAISIO, theMode, false);
655 activateObjects(myActiveSelectionModes);
656 myWorkshop->selector()->setSelectedOwners(aSelectedOwners, false);
662 XGUI_Displayer::DisplayMode XGUI_Displayer::displayMode(ObjectPtr theObject) const
664 Handle(AIS_InteractiveContext) aContext = AISContext();
665 if (aContext.IsNull())
668 AISObjectPtr aAISObj = getAISObject(theObject);
672 Handle(AIS_InteractiveObject) aAISIO = aAISObj->impl<Handle(AIS_InteractiveObject)>();
673 return (XGUI_Displayer::DisplayMode) aAISIO->DisplayMode();
676 void XGUI_Displayer::addSelectionFilter(const Handle(SelectMgr_Filter)& theFilter)
678 Handle(AIS_InteractiveContext) aContext = AISContext();
679 if (aContext.IsNull())
681 const SelectMgr_ListOfFilter& aFilters = aContext->Filters();
682 SelectMgr_ListIteratorOfListOfFilter aIt(aFilters);
683 for (; aIt.More(); aIt.Next()) {
684 if (theFilter.Access() == aIt.Value().Access())
687 GetFilter()->Add(theFilter);
690 void XGUI_Displayer::removeSelectionFilter(const Handle(SelectMgr_Filter)& theFilter)
692 Handle(AIS_InteractiveContext) aContext = AISContext();
693 if (aContext.IsNull())
695 GetFilter()->Remove(theFilter);
698 void XGUI_Displayer::removeFilters()
700 Handle(AIS_InteractiveContext) aContext = AISContext();
701 if (aContext.IsNull())
703 GetFilter()->Clear();
706 void XGUI_Displayer::showOnly(const QObjectPtrList& theList)
708 QObjectPtrList aDispList = myResult2AISObjectMap.keys();
709 foreach(ObjectPtr aObj, aDispList) {
710 if (!theList.contains(aObj))
713 foreach(ObjectPtr aObj, theList) {
714 if (!isVisible(aObj))
715 display(aObj, false);
720 bool XGUI_Displayer::canBeShaded(ObjectPtr theObject) const
722 if (!isVisible(theObject))
725 AISObjectPtr aAISObj = getAISObject(theObject);
726 if (aAISObj.get() == NULL)
729 Handle(AIS_InteractiveObject) anAIS = aAISObj->impl<Handle(AIS_InteractiveObject)>();
730 return ::canBeShaded(anAIS);