- XGUI_ObjectsBrowser* aObjBrowser = myWorkshop->objectBrowser();
- mySelectedData = aObjBrowser->selectedData();
-
- // Set current document
- if (mySelectedData.size() > 0) {
- FeaturePtr aFeature = mySelectedData.first();
-
- boost::shared_ptr<ModelAPI_PluginManager> aMgr = ModelAPI_PluginManager::get();
- boost::shared_ptr<ModelAPI_AttributeDocRef> aDocRef = aFeature->data()->docRef("PartDocument");
- if (aDocRef)
- aMgr->setCurrentDocument(aDocRef->value());
+ Handle(AIS_InteractiveContext) aContext = myWorkshop->viewer()->AISContext();
+ if (aContext.IsNull())
+ return;
+
+ const SelectMgr_ListOfFilter& aFilters = aContext->Filters();
+
+ SelectMgr_IndexedMapOfOwner anOwnersToDeselect;
+
+ SelectMgr_ListIteratorOfListOfFilter anIt(aFilters);
+ for (; anIt.More(); anIt.Next()) {
+ Handle(SelectMgr_Filter) aFilter = anIt.Value();
+ for (aContext->InitSelected(); aContext->MoreSelected(); aContext->NextSelected()) {
+ Handle(SelectMgr_EntityOwner) anOwner = aContext->SelectedOwner();
+ if (!aFilter->IsOk(anOwner))
+ anOwnersToDeselect.Add(aContext->SelectedOwner());
+ }
+ }
+
+ setSelectedOwners(anOwnersToDeselect, false);
+
+ if (isUpdateViewer)
+ aContext->UpdateCurrentViewer();
+}
+
+//**************************************************************
+void XGUI_SelectionMgr::onObjectBrowserSelection()
+{
+ QList<ModuleBase_ViewerPrs> aSelectedPrs =
+ myWorkshop->selector()->selection()->getSelected(ModuleBase_ISelection::Browser);
+
+ XGUI_Displayer* aDisplayer = myWorkshop->displayer();
+ aDisplayer->setSelected(aSelectedPrs);
+ emit selectionChanged();
+}
+
+//**************************************************************
+void XGUI_SelectionMgr::onViewerSelection()
+{
+ QObjectPtrList aFeatures;
+ Handle(AIS_InteractiveContext) aContext = myWorkshop->viewer()->AISContext();
+ if (!aContext.IsNull()) {
+ QList<ModuleBase_ViewerPrs> aPresentations = selection()->getSelected(ModuleBase_ISelection::Viewer);
+ foreach(ModuleBase_ViewerPrs aPrs, aPresentations) {
+ if (aPrs.object().get())
+ aFeatures.append(aPrs.object());
+ }