X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FXGUI%2FXGUI_SelectionMgr.cpp;h=3a13e32131180e23b0374d5db04814eeec2f915c;hb=327f5bbd915fb32d21f2e524a8d97536e0e5dd4b;hp=517f248668f0d0404773a0af6a2de7d610c0157a;hpb=d11f54b43656fe504e36f548540e919e1cc7cfa4;p=modules%2Fshaper.git diff --git a/src/XGUI/XGUI_SelectionMgr.cpp b/src/XGUI/XGUI_SelectionMgr.cpp index 517f24866..3a13e3213 100644 --- a/src/XGUI/XGUI_SelectionMgr.cpp +++ b/src/XGUI/XGUI_SelectionMgr.cpp @@ -50,12 +50,14 @@ void XGUI_SelectionMgr::setSelectedOwners(const SelectMgr_IndexedMapOfOwner& the selection()->selectedOwners(aSelectedOwners); Handle(AIS_InteractiveContext) aContext = myWorkshop->viewer()->AISContext(); - for (Standard_Integer i = 1, n = theSelectedOwners.Extent(); i <= n; i++) { - Handle(SelectMgr_EntityOwner) anOwner = theSelectedOwners(i); - if (aSelectedOwners.FindIndex(anOwner) > 0) - continue; + if (!aContext.IsNull()) { + for (Standard_Integer i = 1, n = theSelectedOwners.Extent(); i <= n; i++) { + Handle(SelectMgr_EntityOwner) anOwner = theSelectedOwners(i); + if (aSelectedOwners.FindIndex(anOwner) > 0) + continue; - aContext->AddOrRemoveSelected(anOwner, isUpdateViewer); + aContext->AddOrRemoveSelected(anOwner, isUpdateViewer); + } } } @@ -63,6 +65,9 @@ void XGUI_SelectionMgr::setSelectedOwners(const SelectMgr_IndexedMapOfOwner& the void XGUI_SelectionMgr::updateSelectedOwners(bool isUpdateViewer) { Handle(AIS_InteractiveContext) aContext = myWorkshop->viewer()->AISContext(); + if (aContext.IsNull()) + return; + const SelectMgr_ListOfFilter& aFilters = aContext->Filters(); SelectMgr_IndexedMapOfOwner anOwnersToDeselect; @@ -86,8 +91,8 @@ void XGUI_SelectionMgr::updateSelectedOwners(bool isUpdateViewer) //************************************************************** void XGUI_SelectionMgr::onObjectBrowserSelection() { - QObjectPtrList aObjects = myWorkshop->objectBrowser()->selectedObjects(); - QList aSelectedPrs = ModuleBase_ISelection::getViewerPrs(aObjects); + QList aSelectedPrs = + myWorkshop->selector()->selection()->getSelected(ModuleBase_ISelection::Browser); XGUI_Displayer* aDisplayer = myWorkshop->displayer(); aDisplayer->setSelected(aSelectedPrs); @@ -99,11 +104,13 @@ void XGUI_SelectionMgr::onViewerSelection() { QObjectPtrList aFeatures; Handle(AIS_InteractiveContext) aContext = myWorkshop->viewer()->AISContext(); - for (aContext->InitSelected(); aContext->MoreSelected(); aContext->NextSelected()) { - Handle(AIS_InteractiveObject) anIO = aContext->SelectedInteractive(); - ObjectPtr aResult = myWorkshop->displayer()->getObject(anIO); - if (aResult) - aFeatures.append(aResult); + if (!aContext.IsNull()) { + for (aContext->InitSelected(); aContext->MoreSelected(); aContext->NextSelected()) { + Handle(AIS_InteractiveObject) anIO = aContext->SelectedInteractive(); + ObjectPtr aResult = myWorkshop->displayer()->getObject(anIO); + if (aResult) + aFeatures.append(aResult); + } } bool aBlocked = myWorkshop->objectBrowser()->blockSignals(true); myWorkshop->objectBrowser()->setObjectsSelected(aFeatures); @@ -119,7 +126,9 @@ void XGUI_SelectionMgr::clearSelection() bool aBlocked = myWorkshop->objectBrowser()->blockSignals(true); myWorkshop->objectBrowser()->setObjectsSelected(aFeatures); myWorkshop->objectBrowser()->blockSignals(aBlocked); - QList aSelectedPrs = ModuleBase_ISelection::getViewerPrs(aFeatures); + + QList aSelectedPrs = + myWorkshop->selector()->selection()->getSelected(ModuleBase_ISelection::Browser); XGUI_Displayer* aDisplayer = myWorkshop->displayer(); aDisplayer->setSelected(aSelectedPrs);