From: nri Date: Wed, 21 May 2003 10:05:08 +0000 (+0000) Subject: NRI : Remove dependence with KERNEL. X-Git-Tag: Start-v1_1a~4 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=eaf65bc93b8f377ef31ee6576c00b202f8ebdbda;p=modules%2Fvisu.git NRI : Remove dependence with KERNEL. --- diff --git a/src/VISU_I/VISU_Gen_i.cc b/src/VISU_I/VISU_Gen_i.cc index 0514b6e3..000c07f6 100644 --- a/src/VISU_I/VISU_Gen_i.cc +++ b/src/VISU_I/VISU_Gen_i.cc @@ -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 : "<activate_object(this); RegistryStorable(); diff --git a/src/VISU_I/VISU_Gen_i.hh b/src/VISU_I/VISU_Gen_i.hh index ab69280b..b421cc94 100644 --- a/src/VISU_I/VISU_Gen_i.hh +++ b/src/VISU_I/VISU_Gen_i.hh @@ -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,