+boost::shared_ptr<ModelAPI_Feature> XGUI_Displayer::GetFeature(const TopoDS_Shape& theShape)
+{
+ boost::shared_ptr<ModelAPI_Feature> aFeature;
+
+ FeatureToAISMap::const_iterator aFIt = myFeature2AISObjectMap.begin(),
+ aFLast = myFeature2AISObjectMap.end();
+ for (; aFIt != aFLast && !aFeature; aFIt++)
+ {
+ Handle(AIS_InteractiveObject) anAIS = (*aFIt).second;
+ Handle(AIS_Shape) anAISShape = Handle(AIS_Shape)::DownCast(anAIS);
+ if (!anAISShape.IsNull() && anAISShape->Shape() == theShape) {
+ aFeature = (*aFIt).first;
+ }
+ }
+ return aFeature;
+}
+
+std::list<XGUI_ViewerPrs> XGUI_Displayer::GetViewerPrs
+ (const NCollection_List<TopoDS_Shape>& theShapes)
+{
+ std::list<XGUI_ViewerPrs> aPresentations;
+ if (theShapes.IsEmpty())
+ return aPresentations;
+
+ NCollection_List<TopoDS_Shape>::Iterator anIt(theShapes);
+ for (; anIt.More(); anIt.Next()) {
+ const TopoDS_Shape& aShape = anIt.Value();
+ if (aShape.IsNull())
+ continue;
+ boost::shared_ptr<ModelAPI_Feature> aFeature = GetFeature(aShape);
+ aPresentations.push_back(XGUI_ViewerPrs(aFeature, aShape));
+ }
+
+ return aPresentations;
+}
+