Salome HOME
Merge from V6_main 28/02/2013
[modules/geom.git] / src / GEOM_I / GEOM_IOperations_i.cc
index b56c32942bf903c859ba1c79cf1ebdb727bccfa1..aecbee269204ce71af4f7a618d3d3d613298f715 100644 (file)
@@ -23,6 +23,8 @@
 #include "GEOM_IOperations_i.hh"
 
 #include "GEOM_Engine.hxx"
+#include "GEOM_Gen_i.hh"
+#include <SALOME_NamingService.hxx>
 
 #include "utilities.h"
 #include "OpUtil.hxx"
@@ -32,6 +34,8 @@
 #include <TCollection_AsciiString.hxx>
 #include <TDF_Tool.hxx>
 
+#include CORBA_SERVER_HEADER(SALOME_Session)
+
 //=============================================================================
 /*!
  *  default constructor:
@@ -155,3 +159,32 @@ Handle(GEOM_Object) GEOM_IOperations_i::GetObjectImpl(GEOM::GEOM_Object_ptr theO
   }
   return anImpl;
 }
+
+//=============================================================================
+/*!
+ *  UpdateGUIForObject
+ */
+//=============================================================================
+void GEOM_IOperations_i::UpdateGUIForObject(GEOM::GEOM_Object_ptr theObj)
+{
+  if (!CORBA::is_nil (theObj)) {
+    // Cast _engine to GEOM_Gen_i type.
+    PortableServer::Servant aServant = myPOA->reference_to_servant(_engine.in());
+    GEOM_Gen_i *anEngine = dynamic_cast<GEOM_Gen_i *>(aServant);
+
+    if (anEngine) {
+      SALOME_NamingService *aNameService = anEngine->GetNS();
+      CORBA::Object_var aSessionObj = aNameService->Resolve("/Kernel/Session");
+      SALOME::Session_var aSession = SALOME::Session::_narrow(aSessionObj);
+  
+      if (!aSession->_is_nil())
+      {
+        std::string aMsg("GEOM/modified/");
+        CORBA::String_var anIOR = anEngine->GetORB()->object_to_string(theObj);
+  
+        aMsg += anIOR.in();
+        aSession->emitMessageOneWay(aMsg.c_str());
+      }
+    }
+  }
+}