+ GetFilter()->Remove(theFilter);
+}
+
+void XGUI_Displayer::removeFilters()
+{
+ Handle(AIS_InteractiveContext) aContext = AISContext();
+ if (aContext.IsNull())
+ return;
+ GetFilter()->Clear();
+}
+
+void XGUI_Displayer::showOnly(const QObjectPtrList& theList)
+{
+ QObjectPtrList aDispList = myResult2AISObjectMap.keys();
+ foreach(ObjectPtr aObj, aDispList) {
+ if (!theList.contains(aObj))
+ erase(aObj, false);
+ }
+ foreach(ObjectPtr aObj, theList) {
+ if (!isVisible(aObj))
+ display(aObj, false);
+ }
+ updateViewer();
+}
+
+bool XGUI_Displayer::canBeShaded(ObjectPtr theObject) const
+{
+ if (!isVisible(theObject))
+ return false;
+
+ AISObjectPtr aAISObj = getAISObject(theObject);
+ if (aAISObj.get() == NULL)
+ return false;
+
+ Handle(AIS_InteractiveObject) anAIS = aAISObj->impl<Handle(AIS_InteractiveObject)>();
+ return ::canBeShaded(anAIS);
+}
+
+void XGUI_Displayer::activate(const Handle(AIS_InteractiveObject)& theIO,
+ const QIntList& theModes) const
+{
+ Handle(AIS_InteractiveContext) aContext = AISContext();
+ if (aContext.IsNull() || theIO.IsNull())
+ return;
+
+ aContext->Load(theIO, -1, true);
+ aContext->Deactivate(theIO);
+ Handle(AIS_Trihedron) aTrihedron = Handle(AIS_Trihedron)::DownCast(theIO);
+ //Deactivate trihedron which can be activated in local selector
+ if (aTrihedron.IsNull()) {
+ //aContext->Load(anAISIO, -1, true);
+ // In order to clear active modes list
+ if (theModes.size() == 0) {
+ //aContext->Load(anAISIO, 0, true);
+ aContext->Activate(theIO);
+ } else {
+ foreach(int aMode, theModes) {
+ //aContext->Load(anAISIO, aMode, true);
+ aContext->Activate(theIO, aMode);
+ }
+ }
+ }
+}
+
+bool XGUI_Displayer::customizeObject(ObjectPtr theObject)
+{
+ AISObjectPtr anAISObj = getAISObject(theObject);
+ // correct the result's color it it has the attribute
+ ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(theObject);
+
+ // Customization of presentation
+ GeomCustomPrsPtr aCustomPrs;
+ FeaturePtr aFeature = ModelAPI_Feature::feature(theObject);
+ if (aFeature.get() != NULL) {
+ GeomCustomPrsPtr aCustPrs = std::dynamic_pointer_cast<GeomAPI_ICustomPrs>(aFeature);
+ if (aCustPrs.get() != NULL)
+ aCustomPrs = aCustPrs;
+ }
+ if (aCustomPrs.get() == NULL) {
+ // we ignore presentable not customized objects
+ GeomPresentablePtr aPrs = std::dynamic_pointer_cast<GeomAPI_IPresentable>(theObject);
+ if (aPrs.get() != NULL)
+ return false;
+ aCustomPrs = myCustomPrs;
+ }
+ return aCustomPrs->customisePresentation(aResult, anAISObj, myCustomPrs);