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 const TopoDS_Shape& aShape = aShapePrs->Shape();
221 std::shared_ptr<GeomAPI_Shape> anAISShapePtr(new GeomAPI_Shape());
222 anAISShapePtr->setImpl(new TopoDS_Shape(aShape));
224 if (aShapePtr->isEqual(anAISShapePtr))
228 aContext->Redisplay(aAISIO, false);
234 void XGUI_Displayer::deactivate(ObjectPtr theObject)
236 if (isVisible(theObject)) {
237 Handle(AIS_InteractiveContext) aContext = AISContext();
238 if (aContext.IsNull())
241 AISObjectPtr anObj = myResult2AISObjectMap[theObject];
242 Handle(AIS_InteractiveObject) anAIS = anObj->impl<Handle(AIS_InteractiveObject)>();
243 aContext->Deactivate(anAIS);
244 qDebug("### Deactivate obj %i", (long)anAIS.Access());
248 void XGUI_Displayer::activate(ObjectPtr theFeature)
250 activate(theFeature, myActiveSelectionModes);
253 void XGUI_Displayer::activate(ObjectPtr theObject, const QIntList& theModes)
255 if (isVisible(theObject)) {
256 Handle(AIS_InteractiveContext) aContext = AISContext();
257 if (aContext.IsNull())
260 AISObjectPtr anObj = myResult2AISObjectMap[theObject];
261 Handle(AIS_InteractiveObject) anAIS = anObj->impl<Handle(AIS_InteractiveObject)>();
262 aContext->Deactivate(anAIS);
263 aContext->Load(anAIS, -1, true);
264 // In order to clear active modes list
265 if (theModes.size() > 0) {
266 foreach(int aMode, theModes) {
267 //aContext->Load(anAIS, aMode, true);
268 aContext->Activate(anAIS, aMode);
269 qDebug("### 1. Activate obj %i, %i", (long)anAIS.Access(), aMode);
272 //aContext->Load(anAIS, 0, true);
273 aContext->Activate(anAIS);
274 qDebug("### 2. Activate obj %i", (long)anAIS.Access());
279 void XGUI_Displayer::getModesOfActivation(ObjectPtr theObject, QIntList& theModes)
281 if (!isVisible(theObject))
284 Handle(AIS_InteractiveContext) aContext = AISContext();
285 if (aContext.IsNull())
288 AISObjectPtr aAISObj = getAISObject(theObject);
290 if (aAISObj.get() != NULL) {
291 Handle(AIS_InteractiveObject) anAISIO = aAISObj->impl<Handle(AIS_InteractiveObject)>();
292 TColStd_ListOfInteger aTColModes;
293 aContext->ActivatedModes(anAISIO, aTColModes);
294 TColStd_ListIteratorOfListOfInteger itr( aTColModes );
295 for (; itr.More(); itr.Next() ) {
296 theModes.append(itr.Value());
301 void XGUI_Displayer::activateObjects(const QIntList& theModes)
303 // In order to avoid doblications of selection modes
305 foreach (int aMode, theModes) {
306 if (!aNewModes.contains(aMode))
307 aNewModes.append(aMode);
309 myActiveSelectionModes = aNewModes;
310 Handle(AIS_InteractiveContext) aContext = AISContext();
311 // Open local context if there is no one
312 if (!aContext->HasOpenedContext())
315 //aContext->UseDisplayedObjects();
316 //myUseExternalObjects = true;
318 AIS_ListOfInteractive aPrsList;
319 ::displayedObjects(aContext, aPrsList);
321 Handle(AIS_Trihedron) aTrihedron;
322 AIS_ListIteratorOfListOfInteractive aLIt(aPrsList);
323 Handle(AIS_InteractiveObject) anAISIO;
324 for(aLIt.Initialize(aPrsList); aLIt.More(); aLIt.Next()){
325 anAISIO = aLIt.Value();
326 aContext->Load(anAISIO, -1, true);
327 aContext->Deactivate(anAISIO);
328 aTrihedron = Handle(AIS_Trihedron)::DownCast(anAISIO);
329 //Deactivate trihedron which can be activated in local selector
330 if (aTrihedron.IsNull()) {
331 //aContext->Load(anAISIO, -1, true);
332 // In order to clear active modes list
333 if (myActiveSelectionModes.size() == 0) {
334 //aContext->Load(anAISIO, 0, true);
335 aContext->Activate(anAISIO);
336 qDebug("### 2. Activate all %i", (long)anAISIO.Access());
338 foreach(int aMode, myActiveSelectionModes) {
339 //aContext->Load(anAISIO, aMode, true);
340 aContext->Activate(anAISIO, aMode);
341 qDebug("### 1. Activate all %i, %i", (long)anAISIO.Access(), aMode);
349 void XGUI_Displayer::deactivateObjects()
351 myActiveSelectionModes.clear();
352 Handle(AIS_InteractiveContext) aContext = AISContext();
353 // Open local context if there is no one
354 if (!aContext->HasOpenedContext())
357 //aContext->NotUseDisplayedObjects();
358 AIS_ListOfInteractive aPrsList;
359 ::displayedObjects(aContext, aPrsList);
361 AIS_ListIteratorOfListOfInteractive aLIt;
362 //Handle(AIS_Trihedron) aTrihedron;
363 Handle(AIS_InteractiveObject) anAISIO;
364 for(aLIt.Initialize(aPrsList); aLIt.More(); aLIt.Next()){
365 anAISIO = aLIt.Value();
366 aContext->Deactivate(anAISIO);
367 //aTrihedron = Handle(AIS_Trihedron)::DownCast(anAISIO);
368 //if (aTrihedron.IsNull()) {
369 // qDebug("### Deactivate all %i", (long)anAISIO.Access());
370 // //aContext->Activate(anAISIO);
375 bool XGUI_Displayer::isActive(ObjectPtr theObject) const
377 Handle(AIS_InteractiveContext) aContext = AISContext();
378 if (aContext.IsNull())
380 if (!isVisible(theObject))
383 AISObjectPtr anObj = myResult2AISObjectMap[theObject];
384 Handle(AIS_InteractiveObject) anAIS = anObj->impl<Handle(AIS_InteractiveObject)>();
386 TColStd_ListOfInteger aModes;
387 aContext->ActivatedModes(anAIS, aModes);
388 return aModes.Extent() > 0;
391 void XGUI_Displayer::setSelected(const QObjectPtrList& theResults, const bool isUpdateViewer)
393 Handle(AIS_InteractiveContext) aContext = AISContext();
394 if (aContext.IsNull())
396 if (aContext->HasOpenedContext()) {
397 aContext->UnhilightSelected();
398 aContext->ClearSelected();
399 foreach(ObjectPtr aResult, theResults) {
400 if (isVisible(aResult)) {
401 AISObjectPtr anObj = myResult2AISObjectMap[aResult];
402 Handle(AIS_InteractiveObject) anAIS = anObj->impl<Handle(AIS_InteractiveObject)>();
404 aContext->SetSelected(anAIS, false);
408 aContext->UnhilightCurrents();
409 aContext->ClearCurrents();
410 foreach(ObjectPtr aResult, theResults) {
411 if (isVisible(aResult)) {
412 AISObjectPtr anObj = myResult2AISObjectMap[aResult];
413 Handle(AIS_InteractiveObject) anAIS = anObj->impl<Handle(AIS_InteractiveObject)>();
415 aContext->SetCurrentObject(anAIS, false);
424 void XGUI_Displayer::clearSelected()
426 Handle(AIS_InteractiveContext) aContext = AISContext();
428 aContext->UnhilightCurrents(false);
429 aContext->ClearSelected();
433 void XGUI_Displayer::eraseAll(const bool isUpdateViewer)
435 Handle(AIS_InteractiveContext) aContext = AISContext();
436 if (aContext.IsNull())
439 foreach (AISObjectPtr aAISObj, myResult2AISObjectMap) {
441 Handle(AIS_InteractiveObject) anIO = aAISObj->impl<Handle(AIS_InteractiveObject)>();
443 aContext->Remove(anIO, false);
445 myResult2AISObjectMap.clear();
450 void XGUI_Displayer::openLocalContext()
452 Handle(AIS_InteractiveContext) aContext = myWorkshop->viewer()->AISContext();
453 if (aContext.IsNull())
455 // Open local context if there is no one
456 if (!aContext->HasOpenedContext()) {
457 // Preserve selected objects
458 //AIS_ListOfInteractive aAisList;
459 //for (aContext->InitCurrent(); aContext->MoreCurrent(); aContext->NextCurrent())
460 // aAisList.Append(aContext->Current());
462 // get the filters from the global context and append them to the local context
463 // a list of filters in the global context is not cleared and should be cleared here
464 SelectMgr_ListOfFilter aFilters;
465 aFilters.Assign(aContext->Filters());
466 // it is important to remove the filters in the global context, because there is a code
467 // in the closeLocalContex, which restore the global context filters
468 aContext->RemoveFilters();
470 //aContext->ClearCurrents();
471 aContext->OpenLocalContext();
472 qDebug("### Open context");
473 //aContext->NotUseDisplayedObjects();
475 //myUseExternalObjects = false;
477 SelectMgr_ListIteratorOfListOfFilter aIt(aFilters);
478 for (;aIt.More(); aIt.Next()) {
479 aContext->AddFilter(aIt.Value());
482 //AIS_ListIteratorOfListOfInteractive aIt2(aAisList);
483 //for(; aIt2.More(); aIt2.Next()) {
484 // aContext->SetSelected(aIt2.Value(), false);
489 void XGUI_Displayer::closeLocalContexts(const bool isUpdateViewer)
491 Handle(AIS_InteractiveContext) aContext = AISContext();
492 if ( (!aContext.IsNull()) && (aContext->HasOpenedContext()) ) {
493 // Preserve selected objects
494 //AIS_ListOfInteractive aAisList;
495 //for (aContext->InitSelected(); aContext->MoreSelected(); aContext->NextSelected())
496 // aAisList.Append(aContext->SelectedInteractive());
498 // get the filters from the local context and append them to the global context
499 // a list of filters in the local context is cleared
500 SelectMgr_ListOfFilter aFilters;
501 aFilters.Assign(aContext->Filters());
503 //aContext->ClearSelected();
504 aContext->CloseAllContexts(false);
505 qDebug("### Close context");
507 // Redisplay all object if they were displayed in localContext
508 Handle(AIS_InteractiveObject) aAISIO;
509 foreach (AISObjectPtr aAIS, myResult2AISObjectMap) {
510 aAISIO = aAIS->impl<Handle(AIS_InteractiveObject)>();
511 if (aContext->DisplayStatus(aAISIO) != AIS_DS_Displayed) {
512 aContext->Display(aAISIO, false);
513 aContext->SetDisplayMode(aAISIO, Shading, false);
517 // Append the filters from the local selection in the global selection context
518 SelectMgr_ListIteratorOfListOfFilter aIt(aFilters);
519 for (;aIt.More(); aIt.Next()) {
520 Handle(SelectMgr_Filter) aFilter = aIt.Value();
521 aContext->AddFilter(aFilter);
526 //myUseExternalObjects = false;
529 //AIS_ListIteratorOfListOfInteractive aIt2(aAisList);
530 //for(; aIt2.More(); aIt2.Next()) {
531 // if (aContext->IsDisplayed(aIt2.Value()))
532 // aContext->SetCurrentObject(aIt2.Value(), false);
537 AISObjectPtr XGUI_Displayer::getAISObject(ObjectPtr theObject) const
540 if (myResult2AISObjectMap.contains(theObject))
541 anIO = myResult2AISObjectMap[theObject];
545 ObjectPtr XGUI_Displayer::getObject(const AISObjectPtr& theIO) const
547 Handle(AIS_InteractiveObject) aRefAIS = theIO->impl<Handle(AIS_InteractiveObject)>();
548 return getObject(aRefAIS);
551 ObjectPtr XGUI_Displayer::getObject(const Handle(AIS_InteractiveObject)& theIO) const
554 foreach (ObjectPtr anObj, myResult2AISObjectMap.keys()) {
555 AISObjectPtr aAIS = myResult2AISObjectMap[anObj];
556 Handle(AIS_InteractiveObject) anAIS = aAIS->impl<Handle(AIS_InteractiveObject)>();
563 bool XGUI_Displayer::enableUpdateViewer(const bool isEnabled)
565 bool aWasEnabled = myEnableUpdateViewer;
567 myEnableUpdateViewer = isEnabled;
572 void XGUI_Displayer::updateViewer()
574 Handle(AIS_InteractiveContext) aContext = AISContext();
575 if (!aContext.IsNull() && myEnableUpdateViewer)
576 aContext->UpdateCurrentViewer();
579 Handle(AIS_InteractiveContext) XGUI_Displayer::AISContext() const
581 Handle(AIS_InteractiveContext) aContext = myWorkshop->viewer()->AISContext();
582 if ((!aContext.IsNull()) && (!aContext->HasOpenedContext())) {
583 aContext->OpenLocalContext();
584 qDebug("### Open context");
589 Handle(SelectMgr_AndFilter) XGUI_Displayer::GetFilter()
591 Handle(AIS_InteractiveContext) aContext = AISContext();
592 if (myAndFilter.IsNull() && !aContext.IsNull()) {
593 myAndFilter = new SelectMgr_AndFilter();
594 aContext->AddFilter(myAndFilter);
599 void XGUI_Displayer::displayAIS(AISObjectPtr theAIS, bool isUpdate)
601 Handle(AIS_InteractiveContext) aContext = AISContext();
602 Handle(AIS_InteractiveObject) anAISIO = theAIS->impl<Handle(AIS_InteractiveObject)>();
603 if (!anAISIO.IsNull()) {
604 aContext->Display(anAISIO, isUpdate);
605 if (aContext->HasOpenedContext()) {
606 //if (myUseExternalObjects) {
607 if (myActiveSelectionModes.size() == 0)
608 aContext->Activate(anAISIO);
610 foreach(int aMode, myActiveSelectionModes) {
611 aContext->Activate(anAISIO, aMode);
619 void XGUI_Displayer::eraseAIS(AISObjectPtr theAIS, const bool isUpdate)
621 Handle(AIS_InteractiveContext) aContext = AISContext();
622 Handle(AIS_InteractiveObject) anAISIO = theAIS->impl<Handle(AIS_InteractiveObject)>();
623 if (!anAISIO.IsNull()) {
624 aContext->Remove(anAISIO, isUpdate);
629 void XGUI_Displayer::setDisplayMode(ObjectPtr theObject, DisplayMode theMode, bool toUpdate)
631 if (theMode == NoMode)
634 Handle(AIS_InteractiveContext) aContext = AISContext();
635 if (aContext.IsNull())
638 AISObjectPtr aAISObj = getAISObject(theObject);
642 Handle(AIS_InteractiveObject) aAISIO = aAISObj->impl<Handle(AIS_InteractiveObject)>();
643 bool aCanBeShaded = ::canBeShaded(aAISIO);
644 // In order to avoid extra closing/opening context
645 SelectMgr_IndexedMapOfOwner aSelectedOwners;
647 myWorkshop->selector()->selection()->selectedOwners(aSelectedOwners);
648 closeLocalContexts(false);
650 aContext->SetDisplayMode(aAISIO, theMode, false);
653 activateObjects(myActiveSelectionModes);
654 myWorkshop->selector()->setSelectedOwners(aSelectedOwners, false);
660 XGUI_Displayer::DisplayMode XGUI_Displayer::displayMode(ObjectPtr theObject) const
662 Handle(AIS_InteractiveContext) aContext = AISContext();
663 if (aContext.IsNull())
666 AISObjectPtr aAISObj = getAISObject(theObject);
670 Handle(AIS_InteractiveObject) aAISIO = aAISObj->impl<Handle(AIS_InteractiveObject)>();
671 return (XGUI_Displayer::DisplayMode) aAISIO->DisplayMode();
674 void XGUI_Displayer::addSelectionFilter(const Handle(SelectMgr_Filter)& theFilter)
676 Handle(AIS_InteractiveContext) aContext = AISContext();
677 if (aContext.IsNull())
679 const SelectMgr_ListOfFilter& aFilters = aContext->Filters();
680 SelectMgr_ListIteratorOfListOfFilter aIt(aFilters);
681 for (; aIt.More(); aIt.Next()) {
682 if (theFilter.Access() == aIt.Value().Access())
685 GetFilter()->Add(theFilter);
688 void XGUI_Displayer::removeSelectionFilter(const Handle(SelectMgr_Filter)& theFilter)
690 Handle(AIS_InteractiveContext) aContext = AISContext();
691 if (aContext.IsNull())
693 GetFilter()->Remove(theFilter);
696 void XGUI_Displayer::removeFilters()
698 Handle(AIS_InteractiveContext) aContext = AISContext();
699 if (aContext.IsNull())
701 GetFilter()->Clear();
704 void XGUI_Displayer::showOnly(const QObjectPtrList& theList)
706 QObjectPtrList aDispList = myResult2AISObjectMap.keys();
707 foreach(ObjectPtr aObj, aDispList) {
708 if (!theList.contains(aObj))
711 foreach(ObjectPtr aObj, theList) {
712 if (!isVisible(aObj))
713 display(aObj, false);
718 bool XGUI_Displayer::canBeShaded(ObjectPtr theObject) const
720 if (!isVisible(theObject))
723 AISObjectPtr aAISObj = getAISObject(theObject);
724 if (aAISObj.get() == NULL)
727 Handle(AIS_InteractiveObject) anAIS = aAISObj->impl<Handle(AIS_InteractiveObject)>();
728 return ::canBeShaded(anAIS);