]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Porting to SALOME_8.2.0 : Selection with SHIFT in sketch, stayed selection of point...
authornds <nds@opencascade.com>
Fri, 23 Dec 2016 13:29:27 +0000 (16:29 +0300)
committernds <nds@opencascade.com>
Fri, 23 Dec 2016 13:29:57 +0000 (16:29 +0300)
src/PartSet/PartSet_SketcherMgr.cpp
src/XGUI/XGUI_SelectionMgr.cpp
src/XGUI/XGUI_SelectionMgr.h
src/XGUI/XGUI_Workshop.cpp

index 796b63a35d077da44c3d4b9df60fa51009c7c806..ff779fa9f2bdf2b4c12a708d81b1ba4c111d27eb 100755 (executable)
@@ -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)
index d126f49ced8fd49a5cc3527160d5f2e8524560b3..059f3e2a19f27ea575d8cbde260ed8d69e606232 100755 (executable)
@@ -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()
 {
index 0ca09a167f2c1edc34ee88c026cabc9a2eeb260d..e1381858739877765b18a30aed3dd043b63d9113 100644 (file)
@@ -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();
 
index a742061bf9bbaf51d6c98bc8135c7b458141ebb6..a891e6f3554120650ce28f41047f2b6a224d174c 100755 (executable)
 
 #ifdef DFBROWSER
 #include <CDF_Session.hxx>
+#include <CDF_Application.hxx>
 #include <DFBrowserAPI_Communicator.hxx>
 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);