+#endif
+
+void XGUI_Displayer::getPresentations(const ObjectPtr& theObject,
+ NCollection_Map<Handle(AIS_InteractiveObject)>& thePresentations)
+{
+ ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(theObject);
+ if (aResult.get()) {
+ AISObjectPtr aAISObj = getAISObject(aResult);
+ if (aAISObj.get() == NULL) {
+ // if result is a result of a composite feature, it is visualized by visualization of
+ // composite children, so we should get one of this presentations
+ ResultCompSolidPtr aCompSolid = std::dynamic_pointer_cast<ModelAPI_ResultCompSolid>(aResult);
+ if (aCompSolid.get() && aCompSolid->numberOfSubs() > 0) {
+ aAISObj = getAISObject(aCompSolid->subResult(0));
+ }
+ }
+ if (aAISObj.get() != NULL) {
+ Handle(AIS_InteractiveObject) anAIS = aAISObj->impl<Handle(AIS_InteractiveObject)>();
+ if (!anAIS.IsNull() && !thePresentations.Contains(anAIS))
+ thePresentations.Add(anAIS);
+ }
+ }
+ else {
+ FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(theObject);
+ // find presentation of the feature
+ AISObjectPtr aAISObj = getAISObject(aFeature);
+ if (aAISObj.get() != NULL) {
+ Handle(AIS_InteractiveObject) anAIS = aAISObj->impl<Handle(AIS_InteractiveObject)>();
+ if (!anAIS.IsNull() && !thePresentations.Contains(anAIS))
+ thePresentations.Add(anAIS);
+ }
+ // find presentations of the feature results
+ std::list<ResultPtr> aResults;
+ ModelAPI_Tools::allResults(aFeature, aResults);
+ std::list<ResultPtr>::const_iterator anIt = aResults.begin(), aLast = aResults.end();
+ for (; anIt != aLast; ++anIt) {
+ AISObjectPtr aAISObj = getAISObject(*anIt);
+ if (aAISObj.get() != NULL) {
+ Handle(AIS_InteractiveObject) anAIS = aAISObj->impl<Handle(AIS_InteractiveObject)>();
+ if (!anAIS.IsNull() && !thePresentations.Contains(anAIS))
+ thePresentations.Add(anAIS);
+ }
+ }
+ }
+}