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 if (aContext.IsNull())
315 // Open local context if there is no one
316 if (!aContext->HasOpenedContext())
319 //aContext->UseDisplayedObjects();
320 //myUseExternalObjects = true;
322 AIS_ListOfInteractive aPrsList;
323 ::displayedObjects(aContext, aPrsList);
325 Handle(AIS_Trihedron) aTrihedron;
326 AIS_ListIteratorOfListOfInteractive aLIt(aPrsList);
327 Handle(AIS_InteractiveObject) anAISIO;
328 for(aLIt.Initialize(aPrsList); aLIt.More(); aLIt.Next()){
329 anAISIO = aLIt.Value();
330 aContext->Load(anAISIO, -1, true);
331 aContext->Deactivate(anAISIO);
332 aTrihedron = Handle(AIS_Trihedron)::DownCast(anAISIO);
333 //Deactivate trihedron which can be activated in local selector
334 if (aTrihedron.IsNull()) {
335 //aContext->Load(anAISIO, -1, true);
336 // In order to clear active modes list
337 if (myActiveSelectionModes.size() == 0) {
338 //aContext->Load(anAISIO, 0, true);
339 aContext->Activate(anAISIO);
340 qDebug("### 2. Activate all %i", (long)anAISIO.Access());
342 foreach(int aMode, myActiveSelectionModes) {
343 //aContext->Load(anAISIO, aMode, true);
344 aContext->Activate(anAISIO, aMode);
345 qDebug("### 1. Activate all %i, %i", (long)anAISIO.Access(), aMode);
353 void XGUI_Displayer::deactivateObjects()
355 myActiveSelectionModes.clear();
356 Handle(AIS_InteractiveContext) aContext = AISContext();
357 // Open local context if there is no one
358 if (!aContext->HasOpenedContext())
361 //aContext->NotUseDisplayedObjects();
362 AIS_ListOfInteractive aPrsList;
363 ::displayedObjects(aContext, aPrsList);
365 AIS_ListIteratorOfListOfInteractive aLIt;
366 //Handle(AIS_Trihedron) aTrihedron;
367 Handle(AIS_InteractiveObject) anAISIO;
368 for(aLIt.Initialize(aPrsList); aLIt.More(); aLIt.Next()){
369 anAISIO = aLIt.Value();
370 aContext->Deactivate(anAISIO);
371 //aTrihedron = Handle(AIS_Trihedron)::DownCast(anAISIO);
372 //if (aTrihedron.IsNull()) {
373 // qDebug("### Deactivate all %i", (long)anAISIO.Access());
374 // //aContext->Activate(anAISIO);
379 bool XGUI_Displayer::isActive(ObjectPtr theObject) const
381 Handle(AIS_InteractiveContext) aContext = AISContext();
382 if (aContext.IsNull())
384 if (!isVisible(theObject))
387 AISObjectPtr anObj = myResult2AISObjectMap[theObject];
388 Handle(AIS_InteractiveObject) anAIS = anObj->impl<Handle(AIS_InteractiveObject)>();
390 TColStd_ListOfInteger aModes;
391 aContext->ActivatedModes(anAIS, aModes);
392 return aModes.Extent() > 0;
395 void XGUI_Displayer::setSelected(const QObjectPtrList& theResults, const bool isUpdateViewer)
397 Handle(AIS_InteractiveContext) aContext = AISContext();
398 if (aContext.IsNull())
400 if (aContext->HasOpenedContext()) {
401 aContext->UnhilightSelected();
402 aContext->ClearSelected();
403 foreach(ObjectPtr aResult, theResults) {
404 if (isVisible(aResult)) {
405 AISObjectPtr anObj = myResult2AISObjectMap[aResult];
406 Handle(AIS_InteractiveObject) anAIS = anObj->impl<Handle(AIS_InteractiveObject)>();
408 aContext->SetSelected(anAIS, false);
412 aContext->UnhilightCurrents();
413 aContext->ClearCurrents();
414 foreach(ObjectPtr aResult, theResults) {
415 if (isVisible(aResult)) {
416 AISObjectPtr anObj = myResult2AISObjectMap[aResult];
417 Handle(AIS_InteractiveObject) anAIS = anObj->impl<Handle(AIS_InteractiveObject)>();
419 aContext->SetCurrentObject(anAIS, false);
428 void XGUI_Displayer::clearSelected()
430 Handle(AIS_InteractiveContext) aContext = AISContext();
432 aContext->UnhilightCurrents(false);
433 aContext->ClearSelected();
437 void XGUI_Displayer::eraseAll(const bool isUpdateViewer)
439 Handle(AIS_InteractiveContext) aContext = AISContext();
440 if (!aContext.IsNull()) {
441 foreach (AISObjectPtr aAISObj, myResult2AISObjectMap) {
443 Handle(AIS_InteractiveObject) anIO = aAISObj->impl<Handle(AIS_InteractiveObject)>();
445 aContext->Remove(anIO, false);
450 myResult2AISObjectMap.clear();
453 void XGUI_Displayer::openLocalContext()
455 Handle(AIS_InteractiveContext) aContext = myWorkshop->viewer()->AISContext();
456 if (aContext.IsNull())
458 // Open local context if there is no one
459 if (!aContext->HasOpenedContext()) {
460 // Preserve selected objects
461 //AIS_ListOfInteractive aAisList;
462 //for (aContext->InitCurrent(); aContext->MoreCurrent(); aContext->NextCurrent())
463 // aAisList.Append(aContext->Current());
465 // get the filters from the global context and append them to the local context
466 // a list of filters in the global context is not cleared and should be cleared here
467 SelectMgr_ListOfFilter aFilters;
468 aFilters.Assign(aContext->Filters());
469 // it is important to remove the filters in the global context, because there is a code
470 // in the closeLocalContex, which restore the global context filters
471 aContext->RemoveFilters();
473 //aContext->ClearCurrents();
474 aContext->OpenLocalContext();
475 qDebug("### Open context");
476 //aContext->NotUseDisplayedObjects();
478 //myUseExternalObjects = false;
480 SelectMgr_ListIteratorOfListOfFilter aIt(aFilters);
481 for (;aIt.More(); aIt.Next()) {
482 aContext->AddFilter(aIt.Value());
485 //AIS_ListIteratorOfListOfInteractive aIt2(aAisList);
486 //for(; aIt2.More(); aIt2.Next()) {
487 // aContext->SetSelected(aIt2.Value(), false);
492 void XGUI_Displayer::closeLocalContexts(const bool isUpdateViewer)
494 Handle(AIS_InteractiveContext) aContext = AISContext();
495 if ( (!aContext.IsNull()) && (aContext->HasOpenedContext()) ) {
496 // Preserve selected objects
497 //AIS_ListOfInteractive aAisList;
498 //for (aContext->InitSelected(); aContext->MoreSelected(); aContext->NextSelected())
499 // aAisList.Append(aContext->SelectedInteractive());
501 // get the filters from the local context and append them to the global context
502 // a list of filters in the local context is cleared
503 SelectMgr_ListOfFilter aFilters;
504 aFilters.Assign(aContext->Filters());
506 //aContext->ClearSelected();
507 aContext->CloseAllContexts(false);
508 qDebug("### Close context");
510 // Redisplay all object if they were displayed in localContext
511 Handle(AIS_InteractiveObject) aAISIO;
512 foreach (AISObjectPtr aAIS, myResult2AISObjectMap) {
513 aAISIO = aAIS->impl<Handle(AIS_InteractiveObject)>();
514 if (aContext->DisplayStatus(aAISIO) != AIS_DS_Displayed) {
515 aContext->Display(aAISIO, false);
516 aContext->SetDisplayMode(aAISIO, Shading, false);
520 // Append the filters from the local selection in the global selection context
521 SelectMgr_ListIteratorOfListOfFilter aIt(aFilters);
522 for (;aIt.More(); aIt.Next()) {
523 Handle(SelectMgr_Filter) aFilter = aIt.Value();
524 aContext->AddFilter(aFilter);
529 //myUseExternalObjects = false;
532 //AIS_ListIteratorOfListOfInteractive aIt2(aAisList);
533 //for(; aIt2.More(); aIt2.Next()) {
534 // if (aContext->IsDisplayed(aIt2.Value()))
535 // aContext->SetCurrentObject(aIt2.Value(), false);
540 AISObjectPtr XGUI_Displayer::getAISObject(ObjectPtr theObject) const
543 if (myResult2AISObjectMap.contains(theObject))
544 anIO = myResult2AISObjectMap[theObject];
548 ObjectPtr XGUI_Displayer::getObject(const AISObjectPtr& theIO) const
550 Handle(AIS_InteractiveObject) aRefAIS = theIO->impl<Handle(AIS_InteractiveObject)>();
551 return getObject(aRefAIS);
554 ObjectPtr XGUI_Displayer::getObject(const Handle(AIS_InteractiveObject)& theIO) const
557 foreach (ObjectPtr anObj, myResult2AISObjectMap.keys()) {
558 AISObjectPtr aAIS = myResult2AISObjectMap[anObj];
559 Handle(AIS_InteractiveObject) anAIS = aAIS->impl<Handle(AIS_InteractiveObject)>();
566 bool XGUI_Displayer::enableUpdateViewer(const bool isEnabled)
568 bool aWasEnabled = myEnableUpdateViewer;
570 myEnableUpdateViewer = isEnabled;
575 void XGUI_Displayer::updateViewer()
577 Handle(AIS_InteractiveContext) aContext = AISContext();
578 if (!aContext.IsNull() && myEnableUpdateViewer)
579 aContext->UpdateCurrentViewer();
582 Handle(AIS_InteractiveContext) XGUI_Displayer::AISContext() const
584 Handle(AIS_InteractiveContext) aContext = myWorkshop->viewer()->AISContext();
585 if ((!aContext.IsNull()) && (!aContext->HasOpenedContext())) {
586 aContext->OpenLocalContext();
587 qDebug("### Open context");
592 Handle(SelectMgr_AndFilter) XGUI_Displayer::GetFilter()
594 Handle(AIS_InteractiveContext) aContext = AISContext();
595 if (myAndFilter.IsNull() && !aContext.IsNull()) {
596 myAndFilter = new SelectMgr_AndFilter();
597 aContext->AddFilter(myAndFilter);
602 void XGUI_Displayer::displayAIS(AISObjectPtr theAIS, bool isUpdate)
604 Handle(AIS_InteractiveContext) aContext = AISContext();
605 if (aContext.IsNull())
607 Handle(AIS_InteractiveObject) anAISIO = theAIS->impl<Handle(AIS_InteractiveObject)>();
608 if (!anAISIO.IsNull()) {
609 aContext->Display(anAISIO, isUpdate);
610 if (aContext->HasOpenedContext()) {
611 //if (myUseExternalObjects) {
612 if (myActiveSelectionModes.size() == 0)
613 aContext->Activate(anAISIO);
615 foreach(int aMode, myActiveSelectionModes) {
616 aContext->Activate(anAISIO, aMode);
624 void XGUI_Displayer::eraseAIS(AISObjectPtr theAIS, const bool isUpdate)
626 Handle(AIS_InteractiveContext) aContext = AISContext();
627 if (aContext.IsNull())
629 Handle(AIS_InteractiveObject) anAISIO = theAIS->impl<Handle(AIS_InteractiveObject)>();
630 if (!anAISIO.IsNull()) {
631 aContext->Remove(anAISIO, isUpdate);
636 void XGUI_Displayer::setDisplayMode(ObjectPtr theObject, DisplayMode theMode, bool toUpdate)
638 if (theMode == NoMode)
641 Handle(AIS_InteractiveContext) aContext = AISContext();
642 if (aContext.IsNull())
645 AISObjectPtr aAISObj = getAISObject(theObject);
649 Handle(AIS_InteractiveObject) aAISIO = aAISObj->impl<Handle(AIS_InteractiveObject)>();
650 bool aCanBeShaded = ::canBeShaded(aAISIO);
651 // In order to avoid extra closing/opening context
652 SelectMgr_IndexedMapOfOwner aSelectedOwners;
654 myWorkshop->selector()->selection()->selectedOwners(aSelectedOwners);
655 closeLocalContexts(false);
657 aContext->SetDisplayMode(aAISIO, theMode, false);
660 activateObjects(myActiveSelectionModes);
661 myWorkshop->selector()->setSelectedOwners(aSelectedOwners, false);
667 XGUI_Displayer::DisplayMode XGUI_Displayer::displayMode(ObjectPtr theObject) const
669 Handle(AIS_InteractiveContext) aContext = AISContext();
670 if (aContext.IsNull())
673 AISObjectPtr aAISObj = getAISObject(theObject);
677 Handle(AIS_InteractiveObject) aAISIO = aAISObj->impl<Handle(AIS_InteractiveObject)>();
678 return (XGUI_Displayer::DisplayMode) aAISIO->DisplayMode();
681 void XGUI_Displayer::addSelectionFilter(const Handle(SelectMgr_Filter)& theFilter)
683 Handle(AIS_InteractiveContext) aContext = AISContext();
684 if (aContext.IsNull())
686 const SelectMgr_ListOfFilter& aFilters = aContext->Filters();
687 SelectMgr_ListIteratorOfListOfFilter aIt(aFilters);
688 for (; aIt.More(); aIt.Next()) {
689 if (theFilter.Access() == aIt.Value().Access())
692 GetFilter()->Add(theFilter);
695 void XGUI_Displayer::removeSelectionFilter(const Handle(SelectMgr_Filter)& theFilter)
697 Handle(AIS_InteractiveContext) aContext = AISContext();
698 if (aContext.IsNull())
700 GetFilter()->Remove(theFilter);
703 void XGUI_Displayer::removeFilters()
705 Handle(AIS_InteractiveContext) aContext = AISContext();
706 if (aContext.IsNull())
708 GetFilter()->Clear();
711 void XGUI_Displayer::showOnly(const QObjectPtrList& theList)
713 QObjectPtrList aDispList = myResult2AISObjectMap.keys();
714 foreach(ObjectPtr aObj, aDispList) {
715 if (!theList.contains(aObj))
718 foreach(ObjectPtr aObj, theList) {
719 if (!isVisible(aObj))
720 display(aObj, false);
725 bool XGUI_Displayer::canBeShaded(ObjectPtr theObject) const
727 if (!isVisible(theObject))
730 AISObjectPtr aAISObj = getAISObject(theObject);
731 if (aAISObj.get() == NULL)
734 Handle(AIS_InteractiveObject) anAIS = aAISObj->impl<Handle(AIS_InteractiveObject)>();
735 return ::canBeShaded(anAIS);