- Handle(AIS_InteractiveObject) anObj =
- Handle(AIS_InteractiveObject)::DownCast(aEO->Selectable());
- ObjectPtr anObject = myWorkshop->displayer()->getObject(anObj);
- theOwners.push_back(anObject);
+ if (!aEO.IsNull()) {
+ Handle(AIS_InteractiveObject) anObj =
+ Handle(AIS_InteractiveObject)::DownCast(aEO->Selectable());
+ ObjectPtr anObject = myWorkshop->displayer()->getObject(anObj);
+ theOwners.push_back(anObject);
+ }
+ }
+ }
+}
+
+//**************************************************************
+void XGUI_Selection::selectedOwners(SelectMgr_IndexedMapOfOwner& theSelectedOwners) const
+{
+ Handle(AIS_InteractiveContext) aContext = myWorkshop->viewer()->AISContext();
+
+ for (aContext->InitSelected(); aContext->MoreSelected(); aContext->NextSelected()) {
+ theSelectedOwners.Add(aContext->SelectedOwner());
+ }
+}
+
+//**************************************************************
+void XGUI_Selection::entityOwners(const Handle(AIS_InteractiveObject)& theObject,
+ SelectMgr_IndexedMapOfOwner& theOwners) const
+{
+ Handle(AIS_InteractiveContext) aContext = myWorkshop->viewer()->AISContext();
+
+ if (theObject.IsNull() || aContext.IsNull())
+ return;
+
+ TColStd_ListOfInteger aModes;
+ aContext->ActivatedModes(theObject, aModes);
+
+ TColStd_ListIteratorOfListOfInteger anIt(aModes);
+ for (; anIt.More(); anIt.Next()) {
+ int aMode = anIt.Value();
+ if (!theObject->HasSelection(aMode))
+ continue;
+
+ Handle(SelectMgr_Selection) aSelection = theObject->Selection(aMode);
+ for (aSelection->Init(); aSelection->More(); aSelection->Next()) {
+ Handle(SelectMgr_SensitiveEntity) anEntity = aSelection->Sensitive();
+ if (anEntity.IsNull())
+ continue;
+ Handle(SelectMgr_EntityOwner) anOwner =
+ Handle(SelectMgr_EntityOwner)::DownCast(anEntity->BaseSensitive()->OwnerId());
+ if (!anOwner.IsNull())
+ theOwners.Add(anOwner);