From 2b0ecd53dc39ea7c1c4e03a432490e515e1a0ce1 Mon Sep 17 00:00:00 2001 From: nds Date: Fri, 23 Dec 2016 16:29:27 +0300 Subject: [PATCH] Porting to SALOME_8.2.0 : Selection with SHIFT in sketch, stayed selection of point attribute of a line by line move --- src/PartSet/PartSet_SketcherMgr.cpp | 4 ++-- src/XGUI/XGUI_SelectionMgr.cpp | 31 ++++------------------------- src/XGUI/XGUI_SelectionMgr.h | 4 ---- src/XGUI/XGUI_Workshop.cpp | 2 +- 4 files changed, 7 insertions(+), 34 deletions(-) diff --git a/src/PartSet/PartSet_SketcherMgr.cpp b/src/PartSet/PartSet_SketcherMgr.cpp index 796b63a35..ff779fa9f 100755 --- a/src/PartSet/PartSet_SketcherMgr.cpp +++ b/src/PartSet/PartSet_SketcherMgr.cpp @@ -1718,12 +1718,12 @@ void PartSet_SketcherMgr::restoreSelection() FeatureToSelectionMap::const_iterator aSIt = myCurrentSelection.begin(), aSLast = myCurrentSelection.end(); SelectMgr_IndexedMapOfOwner anOwnersToSelect; + anOwnersToSelect.Clear(); for (; aSIt != aSLast; aSIt++) { - anOwnersToSelect.Clear(); getSelectionOwners(aSIt.key(), myCurrentSketch, aWorkshop, myCurrentSelection, anOwnersToSelect); - aConnector->workshop()->selector()->setSelectedOwners(anOwnersToSelect, false); } + aConnector->workshop()->selector()->setSelectedOwners(anOwnersToSelect, false); } void PartSet_SketcherMgr::onShowConstraintsToggle(int theType, bool theState) diff --git a/src/XGUI/XGUI_SelectionMgr.cpp b/src/XGUI/XGUI_SelectionMgr.cpp index d126f49ce..059f3e2a1 100755 --- a/src/XGUI/XGUI_SelectionMgr.cpp +++ b/src/XGUI/XGUI_SelectionMgr.cpp @@ -61,6 +61,10 @@ void XGUI_SelectionMgr::setSelectedOwners(const SelectMgr_IndexedMapOfOwner& the Handle(AIS_InteractiveContext) aContext = myWorkshop->viewer()->AISContext(); if (!aContext.IsNull()) { + /// previous selection should be cleared, else there will be decomposition of selections: + /// as AddOrRemoveSelected inverts current selection + aContext->ClearSelected(false); + for (Standard_Integer i = 1, n = theSelectedOwners.Extent(); i <= n; i++) { Handle(SelectMgr_EntityOwner) anOwner = theSelectedOwners(i); if (aSelectedOwners.FindIndex(anOwner) > 0) @@ -75,33 +79,6 @@ 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; - - 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() { diff --git a/src/XGUI/XGUI_SelectionMgr.h b/src/XGUI/XGUI_SelectionMgr.h index 0ca09a167..e13818587 100644 --- a/src/XGUI/XGUI_SelectionMgr.h +++ b/src/XGUI/XGUI_SelectionMgr.h @@ -47,10 +47,6 @@ Q_OBJECT void setSelectedOwners(const SelectMgr_IndexedMapOfOwner& theSelectedOwners, bool isUpdateViewer); - //! Check that the selected owners are valid for the current filters - /// \param isUpdateViewer the parameter whether the viewer should be update immediatelly - void updateSelectedOwners(bool isUpdateViewer); - //! Clears selection in Viewer and object Browser void clearSelection(); diff --git a/src/XGUI/XGUI_Workshop.cpp b/src/XGUI/XGUI_Workshop.cpp index a742061bf..a891e6f35 100755 --- a/src/XGUI/XGUI_Workshop.cpp +++ b/src/XGUI/XGUI_Workshop.cpp @@ -105,6 +105,7 @@ #ifdef DFBROWSER #include +#include #include static bool DFBrowser_FirstCall = true; #endif @@ -1352,7 +1353,6 @@ void XGUI_Workshop::onContextMenuCommand(const QString& theId, bool isChecked) else if (theId == "DFBROWSER_VIEW") { if (DFBrowser_FirstCall) { Handle(CDF_Application) anApplication = CDF_Session::CurrentSession()->CurrentApplication(); - DFBrowserAPI_Communicator* aCommunicator = DFBrowserAPI_Communicator::loadPluginLibrary("DFBrowser.dll"); aCommunicator->setApplication(anApplication); -- 2.39.2