Salome HOME
NRI : Remove dependence with KERNEL.
authornri <nri@opencascade.com>
Wed, 21 May 2003 10:05:08 +0000 (10:05 +0000)
committernri <nri@opencascade.com>
Wed, 21 May 2003 10:05:08 +0000 (10:05 +0000)
src/VISU_I/VISU_Gen_i.cc
src/VISU_I/VISU_Gen_i.hh

index 0514b6e3b55f90372ec992ab48d012b793241d39..000c07f615883b526b12b3fe10b2d84556ab2f22 100644 (file)
@@ -52,18 +52,18 @@ extern "C" {
     return pVISU_Gen->getId() ;
   }
 
-//    VISU::VISU_Gen_ptr  
-//    GetVisuGen(CORBA::ORB_var orb, PortableServer::POA_var poa, QMutex* theMutex){
-//      if(MYDEBUG) MESSAGE("extern \"C\" GetVisuGen");
-//      VISU::VISU_Gen_i * aVISU_Gen = new VISU::VISU_Gen_i(orb,poa,theMutex);
-//      return VISU::VISU_Gen::_duplicate(aVISU_Gen->_this()); 
-//    }
-
-  Engines::Component_ptr  
-  GetVisuGen(CORBA::ORB_var orb, PortableServer::POA_var poa, QMutex* theMutex){
+  //    VISU::VISU_Gen_ptr  
+  //    GetVisuGen(CORBA::ORB_var orb, PortableServer::POA_var poa, QMutex* theMutex){
+  //      if(MYDEBUG) MESSAGE("extern \"C\" GetVisuGen");
+  //      VISU::VISU_Gen_i * aVISU_Gen = new VISU::VISU_Gen_i(orb,poa,theMutex);
+  //      return VISU::VISU_Gen::_duplicate(aVISU_Gen->_this()); 
+  //    }
+  
+  Engines::Component_ptr GetVisuGen(CORBA::ORB_ptr theORB, PortableServer::POA_ptr thePOA, QMutex* theMutex){
     if(MYDEBUG) MESSAGE("extern \"C\" GetVisuGen");
-    VISU::VISU_Gen_i * aVISU_Gen = new VISU::VISU_Gen_i(orb,poa,theMutex);
-    return Engines::Component::_narrow( VISU::VISU_Gen::_duplicate(aVISU_Gen->_this()) ); 
+    VISU::VISU_Gen_i * aVISU_Gen = new VISU::VISU_Gen_i(theORB,thePOA,theMutex);
+    VISU::VISU_Gen_var aVisuGen = VISU::VISU_Gen::_duplicate(aVISU_Gen->_this());
+    return Engines::Component::_narrow( aVisuGen );
   }
 }
 
@@ -254,7 +254,16 @@ namespace VISU{
       aSComponent = aStudyBuilder->NewComponent("VISU"); 
       SALOMEDS::GenericAttribute_var anAttr = aStudyBuilder->FindOrCreateAttribute(aSComponent, "AttributeName");
       SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(anAttr);
-      aName->SetValue("Visu");
+      //NRI      aName->SetValue("Visu");
+
+      CORBA::ORB_var anORB = GetORB();
+      SALOME_NamingService *NamingService = new SALOME_NamingService( anORB );
+      CORBA::Object_var objVarN = NamingService->Resolve("/Kernel/ModulCatalog");
+      SALOME_ModuleCatalog::ModuleCatalog_var Catalogue  = SALOME_ModuleCatalog::ModuleCatalog::_narrow(objVarN);
+      SALOME_ModuleCatalog::Acomponent_var Comp = Catalogue->GetComponent( "VISU" );
+      if ( !Comp->_is_nil() ) {
+       aName->SetValue( Comp->componentusername() );
+      }
 
       anAttr = aStudyBuilder->FindOrCreateAttribute(aSComponent, "AttributePixMap");
       SALOMEDS::AttributePixMap_var aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr);
@@ -467,21 +476,22 @@ namespace VISU{
     _thisObj = this ;
     _id = _poa->activate_object(_thisObj);
     SALOME_NamingService aNamingService(orb);
-    SALOME::Session_var aSession(SALOME::Session::_narrow(aNamingService.Resolve("/Kernel/Session")));
+    CORBA::Object_ptr anObject = aNamingService.Resolve("/Kernel/Session");
+    SALOME::Session_var aSession = SALOME::Session::_narrow(anObject);
     //aSession->GetInterface(); 
     //myVisuGen = aSession->GetVisuGen();
     myVisuGen = VISU::VISU_Gen::_narrow( aSession->GetVisuComponent() );
   }
-  VISU_Gen_i::VISU_Gen_i(CORBA::ORB_var orb, PortableServer::POA_var poa, QMutex* theMutex) :
+  VISU_Gen_i::VISU_Gen_i(CORBA::ORB_ptr theORB, PortableServer::POA_ptr thePOA, QMutex* theMutex) :
     Engines_Component_i()
   {
     if(MYDEBUG) MESSAGE("VISU_Gen_i::VISU_Gen_i : "<<theMutex);
     Base_i::myMutex = theMutex;
-    Base_i::myOrb = CORBA::ORB::_duplicate(orb);
-    Base_i::myPOA = PortableServer::POA::_duplicate(poa);
+    Base_i::myOrb = CORBA::ORB::_duplicate(theORB);
+    Base_i::myPOA = PortableServer::POA::_duplicate(thePOA);
     Mutex mt(myMutex,qApp);
-    VisuORB = orb;
-    VisuPOA = poa;
+    VisuORB = theORB;
+    VisuPOA = thePOA;
     VisuGen = this;
     VisuPOA->activate_object(this);
     RegistryStorable();
index ab69280b77326b1e595b30ecf2ecff6d4117d5a0..b421cc94a54fa544cdce040e827a49d2ffa8ac4a 100644 (file)
@@ -24,7 +24,7 @@ namespace VISU{
     VISU_Gen_i();
     VISU_Gen_i(const VISU::VISU_Gen_i &);
   public:
-    VISU_Gen_i(CORBA::ORB_var orb, PortableServer::POA_var poa, QMutex* theMutex);
+    VISU_Gen_i(CORBA::ORB_ptr theORB, PortableServer::POA_ptr thePOA, QMutex* theMutex);
     VISU_Gen_i(CORBA::ORB_ptr orb,
               PortableServer::POA_ptr poa,
               PortableServer::ObjectId * contId,