Salome HOME
Merge C++ part of kleontev/38044_auto_repair
[modules/geom.git] / src / GEOM_SWIG_WITHIHM / GEOM_Swig_LocalSelector.cxx
index 76fb0d259d9213613395d40b3aa7deed9b848c1d..041c5b96ba857e2a6c12a38a1eccac82883c3104 100644 (file)
@@ -94,3 +94,27 @@ std::vector<int> GEOM_Swig_LocalSelector::getSelection()
   return ids;
 }
 
+void GEOM_Swig_LocalSelector::setSelection(const std::vector<int> ids)
+{
+  MESSAGE("setSelection() start...");
+
+  SalomeApp_Application* app = (SalomeApp_Application*)SUIT_Session::session()->activeApplication();
+  LightApp_SelectionMgr* aSelMgr = app->selectionMgr();
+  SALOME_ListIO aSelList;
+  aSelMgr->selectedObjects(aSelList);
+
+  MESSAGE("aSelList.Extent(): " << aSelList.Extent());
+  if (!aSelList.Extent())
+  {
+    return;
+  }
+
+  TColStd_IndexedMapOfInteger idsMap;
+  for (const auto i : ids)
+  {
+    idsMap.Add(i);
+  }
+
+  Handle(SALOME_InteractiveObject) anIO = aSelList.First();
+  aSelMgr->selectObjects(anIO, idsMap, false);
+}