X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FXGUI%2FXGUI_SelectionMgr.cpp;h=3a13e32131180e23b0374d5db04814eeec2f915c;hb=327f5bbd915fb32d21f2e524a8d97536e0e5dd4b;hp=84d03259006a4f449ebae4ce90457ab97101ddd2;hpb=acaa4d04df93d44ed6c093584aa7de2f7f86b5e3;p=modules%2Fshaper.git diff --git a/src/XGUI/XGUI_SelectionMgr.cpp b/src/XGUI/XGUI_SelectionMgr.cpp index 84d032590..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,9 +91,11 @@ void XGUI_SelectionMgr::updateSelectedOwners(bool isUpdateViewer) //************************************************************** void XGUI_SelectionMgr::onObjectBrowserSelection() { - QObjectPtrList aObjects = myWorkshop->objectBrowser()->selectedObjects(); + QList aSelectedPrs = + myWorkshop->selector()->selection()->getSelected(ModuleBase_ISelection::Browser); + XGUI_Displayer* aDisplayer = myWorkshop->displayer(); - aDisplayer->setSelected(aObjects); + aDisplayer->setSelected(aSelectedPrs); emit selectionChanged(); } @@ -97,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); @@ -117,9 +126,12 @@ void XGUI_SelectionMgr::clearSelection() bool aBlocked = myWorkshop->objectBrowser()->blockSignals(true); myWorkshop->objectBrowser()->setObjectsSelected(aFeatures); myWorkshop->objectBrowser()->blockSignals(aBlocked); + + QList aSelectedPrs = + myWorkshop->selector()->selection()->getSelected(ModuleBase_ISelection::Browser); XGUI_Displayer* aDisplayer = myWorkshop->displayer(); - aDisplayer->setSelected(aFeatures); + aDisplayer->setSelected(aSelectedPrs); emit selectionChanged(); }