Salome HOME
Issue #348 Validate sketch is disabled when point coordinates are set manually
[modules/shaper.git] / src / XGUI / XGUI_SelectionMgr.cpp
index 25bfd703030c8ab6fa309019005b5cc87d6786bb..b0d22089f8c3da6c6c7fe48836be2822bbe9225d 100644 (file)
@@ -1,13 +1,16 @@
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
+
 #include "XGUI_SelectionMgr.h"
 
 #include "XGUI_Workshop.h"
-#include "XGUI_MainWindow.h"
 #include "XGUI_ObjectsBrowser.h"
 #include "XGUI_SalomeConnector.h"
 #include "XGUI_ViewerProxy.h"
 #include "XGUI_Displayer.h"
 #include "XGUI_Selection.h"
 
+#include <AppElements_MainWindow.h>
+
 #include <ModelAPI_Feature.h>
 #include <ModelAPI_Session.h>
 #include <ModelAPI_AttributeDocRef.h>
@@ -37,6 +40,23 @@ void XGUI_SelectionMgr::connectViewers()
   connect(myWorkshop->viewer(), SIGNAL(selectionChanged()), this, SLOT(onViewerSelection()));
 }
 
+//**************************************************************
+void XGUI_SelectionMgr::setSelectedOwners(const SelectMgr_IndexedMapOfOwner& theSelectedOwners,
+                                          bool isUpdateViewer)
+{
+  SelectMgr_IndexedMapOfOwner aSelectedOwners;
+  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;
+
+    aContext->AddOrRemoveSelected(anOwner, isUpdateViewer);
+  }
+}
+
 //**************************************************************
 void XGUI_SelectionMgr::onObjectBrowserSelection()
 {