From 13575a6e936c95860a4da4c1cfcdb779f56c4b17 Mon Sep 17 00:00:00 2001 From: nri Date: Fri, 16 May 2003 17:03:57 +0000 Subject: [PATCH] NRI : Correction 1.1a version. --- resources/VISU_en.xml | 4 +- resources/VISU_fr.xml | 4 +- src/OBJECT/VISU_Actor.cxx | 10 +- src/OBJECT/VISU_Actor.h | 2 +- src/VISU_I/VISU_Gen_i.cc | 317 +++++++++++++++++++++----------------- src/VISU_I/VISU_Gen_i.hh | 7 +- 6 files changed, 189 insertions(+), 155 deletions(-) diff --git a/resources/VISU_en.xml b/resources/VISU_en.xml index 121d7122..76f0ffce 100644 --- a/resources/VISU_en.xml +++ b/resources/VISU_en.xml @@ -18,7 +18,7 @@ - + @@ -86,7 +86,7 @@ - + diff --git a/resources/VISU_fr.xml b/resources/VISU_fr.xml index 7ff81e22..90faa06e 100644 --- a/resources/VISU_fr.xml +++ b/resources/VISU_fr.xml @@ -16,7 +16,7 @@ - + @@ -83,7 +83,7 @@ - + diff --git a/src/OBJECT/VISU_Actor.cxx b/src/OBJECT/VISU_Actor.cxx index a94fb9df..1d5da42d 100644 --- a/src/OBJECT/VISU_Actor.cxx +++ b/src/OBJECT/VISU_Actor.cxx @@ -21,10 +21,9 @@ VISU_Actor* VISU_Actor::New(){ VISU_Actor::VISU_Actor(){ this->Device = vtkActor::New(); - this->EdgeDevice = NULL; - //this->EdgeDevice = SALOME_Actor::New(); - //EdgeDevice->VisibilityOff(); - //EdgeDevice->PickableOff(); + this->EdgeDevice = vtkActor::New(); + EdgeDevice->VisibilityOff(); + EdgeDevice->PickableOff(); this->DataSource = NULL; myScalarBar = NULL; @@ -49,8 +48,7 @@ VISU_Actor::VISU_Actor(){ VISU_Actor::~VISU_Actor() { - if (EdgeDevice != NULL) - this->EdgeDevice->Delete(); + this->EdgeDevice->Delete(); } diff --git a/src/OBJECT/VISU_Actor.h b/src/OBJECT/VISU_Actor.h index 298f25cb..437bb776 100644 --- a/src/OBJECT/VISU_Actor.h +++ b/src/OBJECT/VISU_Actor.h @@ -80,7 +80,7 @@ class VTKOCC_EXPORT VISU_Actor : public SALOME_Actor { void setPrs3d(VISU::Prs3d_i* thePrs) { Presentation = thePrs; } vtkDataSet *DataSource; - VISU_Actor* EdgeDevice; + vtkActor* EdgeDevice; Standard_Boolean IsShrinkable; Standard_Boolean IsShrunk; diff --git a/src/VISU_I/VISU_Gen_i.cc b/src/VISU_I/VISU_Gen_i.cc index 037e0d51..0514b6e3 100644 --- a/src/VISU_I/VISU_Gen_i.cc +++ b/src/VISU_I/VISU_Gen_i.cc @@ -17,7 +17,6 @@ using namespace std; #include "QAD_Desktop.h" #include "QAD_Study.h" #include "SALOMEDS_Tool.hxx" - #include #include #include @@ -42,22 +41,30 @@ static int MYDEBUG = 0; //static int IS_LOADED = (cout<<"\n----------------- VisuEngine_factory is loaded -----------------\n", 1); extern "C" { PortableServer::ObjectId * - VisuEngine_factory(CORBA::ORB_ptr orb, PortableServer::POA_ptr poa, PortableServer::ObjectId * contId, - const char *instanceName, const char *interfaceName) - { - if(MYDEBUG) MESSAGE("VisuEngine_factory : "<getId() ; - } + VISUEngine_factory(CORBA::ORB_ptr orb, + PortableServer::POA_ptr poa, + PortableServer::ObjectId * contId, + const char *instanceName, + const char *interfaceName) + { + if(MYDEBUG) MESSAGE("VisuEngine_factory : "<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_ptr theORB, PortableServer::POA_ptr thePOA, - SALOME_NamingService* theNamingService, QMutex* theMutex) - { - if(MYDEBUG) MESSAGE("extern \"C\" GetVisuGen"); - VISU::VISU_Gen_i *aVISU_Gen = new VISU::VISU_Gen_i(theORB,thePOA,theNamingService,theMutex); - return Engines::Component::_narrow( VISU::VISU_Gen::_duplicate(aVISU_Gen->_this())); - //return aVISU_Gen->_this(); - } + 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 Engines::Component::_narrow( VISU::VISU_Gen::_duplicate(aVISU_Gen->_this()) ); + } } namespace VISU{ @@ -65,10 +72,6 @@ namespace VISU{ QMutex* Base_i::myMutex = NULL; CORBA::ORB_var Base_i::myOrb; PortableServer::POA_var Base_i::myPOA; - SALOME_NamingService* Base_i::myNamingService; - SALOME_LifeCycleCORBA* Base_i::myEnginesLifeCycle; - VISU_Gen_i* Base_i::myVisuGenImpl; - VISU_Gen_var Base_i::GetVisuGenInter() { return myVisuGenImpl->_this();} Base_i::~Base_i() {} char* Base_i::GetID(){ //CORBA::Object_var anObject = _this(); @@ -98,16 +101,14 @@ namespace VISU{ } //=========================================================================== static Storable::TCallbackMap VisuStoreMap; - string Storable::ToString(){ + const char* Storable::ToString(){ ostrstream strOut; Storable::DataToStream( strOut, "myComment", GetComment() ); ToStream(strOut); strOut< aRet(strOut.str()); - return aRet.get(); + return strOut.str(); } - void Storable::Registry(const char* theComment, TStorableEngine theEngine) throw(std::logic_error&) { @@ -116,7 +117,6 @@ namespace VISU{ throw std::logic_error("Storable::Registry >> dupliacte registring !!!"); } } - void RegistryStorable() throw(std::logic_error&) { //Storable::Registry(View3D_i::myComment.c_str(),&View3DRestore); Storable::Registry(Result_i::myComment.c_str(),&ResultRestore); @@ -132,8 +132,20 @@ namespace VISU{ Storable::Registry(Container_i::myComment.c_str(),&ContainerRestore); } + SALOMEDS::SObject_ptr Storable::GetResultSO(SALOMEDS::SObject_ptr theSObject) { + CORBA::String_var aComponentID(theSObject->GetFatherComponent()->GetID()); + SALOMEDS::SObject_var aResult = SALOMEDS::SObject::_duplicate(theSObject); + CORBA::String_var aFatherID(aResult->GetFather()->GetID()); + while(strcmp(aComponentID, aFatherID)) { + aResult = aResult->GetFather(); + aFatherID = aResult->GetFather()->GetID(); + if (strlen(aFatherID) < 3) break; + } + return aResult._retn(); + } + void Storable::StrToMap(const QString& theStr, VISU::Storable::TRestoringMap& theMap){ - if(0 && MYDEBUG) MESSAGE("Storable::StrToMap : string="<reference_to_servant(theObject); @@ -222,16 +234,12 @@ namespace VISU{ CORBA::Object_var SObjectToObject(SALOMEDS::SObject_ptr theSObject){ SALOMEDS::GenericAttribute_var anAttr; CORBA::Object_var anObj; - try{ - if(theSObject->FindAttribute(anAttr, "AttributeIOR")){ - SALOMEDS::AttributeIOR_var anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); - CORBA::String_var aValue = anIOR->Value(); - CORBA::ORB_ptr anORB = Base_i::GetORB(); - if(strcmp(aValue,"") != 0) - anObj = anORB->string_to_object(aValue); - } - }catch(...){ - MESSAGE("SObjectToObject - Unknown exception was accured!"); + if(theSObject->FindAttribute(anAttr, "AttributeIOR")){ + SALOMEDS::AttributeIOR_var anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); + CORBA::String_var aValue = anIOR->Value(); + CORBA::ORB_var anORB = GetORB(); + if(strcmp(aValue,"") != 0) + anObj = anORB->string_to_object(aValue); } return anObj; } @@ -252,7 +260,7 @@ namespace VISU{ SALOMEDS::AttributePixMap_var aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr); aPixmap->SetPixMap( "ICON_OBJBROWSER_Visu" ); - VISU_Gen_var aVisuGen = Base_i::GetVisuGenInter(); + VISU_Gen_var aVisuGen = GetVisu(); aStudyBuilder->DefineComponentInstance(aSComponent,aVisuGen); if (aLocked) theStudyDocument->GetProperties()->SetLocked(true); aStudyBuilder->CommitCommand(); @@ -263,7 +271,7 @@ namespace VISU{ string FindEntryWithComment(SALOMEDS::Study_ptr theStudyDocument, const char* theStartEntry, const char* theComment, int IsAllLevels) { - if(0 && MYDEBUG) MESSAGE("FindEntryWithComment - '"<NewChildIterator(theStudyDocument->FindObjectID(theStartEntry)); anIter->InitEx(IsAllLevels); @@ -291,7 +299,7 @@ namespace VISU{ const char* thePersistentRef, const char* theComment, CORBA::Boolean theCreateNew) { - if(0 && MYDEBUG) + if(MYDEBUG) MESSAGE("CreateAttributes - theName = "<activate_object(_thisObj); - SALOME_NamingService aNamingService(orb); - CORBA::Object_ptr anObject = aNamingService.Resolve("/Kernel/Session"); - SALOME::Session_var aSession = SALOME::Session::_narrow(anObject); - //aSession->GetInterface(); - myVisuGen = VISU::VISU_Gen::_narrow( aSession->GetVisuComponent() ); - } - - VISU_Gen_i::VISU_Gen_i(CORBA::ORB_ptr theORB, PortableServer::POA_ptr thePOA, - SALOME_NamingService* theNamingService, QMutex* theMutex) : - Engines_Component_i() - { - if(MYDEBUG) MESSAGE("VISU_Gen_i::VISU_Gen_i : "<getActiveStudy()) - QAD_Application::getDesktop()->createStudy(); - myStudyDocument = - QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument(); - Base_i::myPOA->activate_object(this); - } - - VISU_Gen_i::~VISU_Gen_i(){ - if(MYDEBUG) MESSAGE("VISU_Gen_i::~VISU_Gen_i"); + CORBA::ORB_var GetORB() { return VisuORB;} + PortableServer::POA_var GetPOA() { return VisuPOA;} + VISU_Gen_var GetVisu() { + return VISU_Gen::_duplicate(VisuGen->_this()); + //return VisuGen->_this(); } + const CORBA::Boolean IsMultifile() { return myIsMultiFile;} //=========================================================================== bool VISU_Gen_i::Load(SALOMEDS::SComponent_ptr theComponent, const SALOMEDS::TMPFile & theStream, @@ -397,9 +370,9 @@ namespace VISU{ const char* aLocalPersistentID, CORBA::Boolean isMultiFile) { if(myMutex){ + Mutex mt(myMutex,qApp); CORBA::String_var aString(""); if(strcmp(aLocalPersistentID,"") != 0) { - Mutex mt(myMutex,qApp); Storable* aStorable = Storable::Create(theSObject,VisuTmpDir.c_str(),aLocalPersistentID); if(aStorable != NULL) aString = aStorable->GetID(); @@ -416,8 +389,8 @@ namespace VISU{ if(MYDEBUG) MESSAGE("VISU_Gen_i::Save - myMutex = "<(GetServant(anObj)); - if(pResult && abs(pResult->GetSourceId()) == Result_i::eFile){ + if(pResult){ const QFileInfo& aFileInfo = pResult->GetFileInfo(); QString aPrefix = SALOMEDS_Tool::GetNameFromPath(aStudy->URL()); - QString aFileName = aPrefix + "_" + (pResult->GetName()).c_str(); + QString aFileName = aPrefix + "_" + pResult->GetName(); static QString aCommand; aCommand.sprintf("cp %s %s%s",aFileInfo.filePath().latin1(),aTmpDir.ToCString(),aFileName.latin1()); if(system(aCommand) == -1){ @@ -464,15 +437,15 @@ namespace VISU{ CORBA::Boolean isMultiFile) { if(MYDEBUG) MESSAGE("VISU_Gen_i::IORToLocalPersistentID - myMutex = "<string_to_object(aString); if(!CORBA::is_nil(anObj)){ Storable* pStorable = dynamic_cast(GetServant(anObj)); if(pStorable != NULL){ - Mutex mt(myMutex,qApp); - aString = pStorable->ToString().c_str(); + aString = pStorable->ToString(); return aString._retn(); } } @@ -482,6 +455,44 @@ namespace VISU{ return myVisuGen->IORToLocalPersistentID(theSObject, IORString, isMultiFile); } + //=========================================================================== + VISU_Gen_i::VISU_Gen_i(CORBA::ORB_ptr orb, + PortableServer::POA_ptr poa, + PortableServer::ObjectId * contId, + const char *instanceName, + const char *interfaceName) : + Engines_Component_i(orb, poa, contId, instanceName, interfaceName) + { + if(MYDEBUG) MESSAGE("VISU_Gen_i::VISU_Gen_i : "<activate_object(_thisObj); + SALOME_NamingService aNamingService(orb); + SALOME::Session_var aSession(SALOME::Session::_narrow(aNamingService.Resolve("/Kernel/Session"))); + //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) : + Engines_Component_i() + { + if(MYDEBUG) MESSAGE("VISU_Gen_i::VISU_Gen_i : "<activate_object(this); + RegistryStorable(); + if(!QAD_Application::getDesktop()->getActiveStudy()) + QAD_Application::getDesktop()->createStudy(); + myStudyDocument = + QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument(); + } + VISU_Gen_i::~VISU_Gen_i(){ + if(MYDEBUG) MESSAGE("VISU_Gen_i::~VISU_Gen_i"); + } void VISU_Gen_i::SetCurrentStudy(SALOMEDS::Study_ptr theStudy){ //if(MYDEBUG) MESSAGE("VISU_Gen_i::SetCurrentStudy : "<<(!theStudy->_is_nil())); if(myMutex) @@ -529,18 +540,42 @@ namespace VISU{ } return myVisuGen->ImportFile(theFileName); } - - Result_ptr VISU_Gen_i::ImportMed(SALOMEDS::SObject_ptr theMedSObject){ + Result_ptr VISU_Gen_i::ImportMed(SALOME_MED::FIELD_ptr theField){ if(MYDEBUG) MESSAGE("VISU_Gen_i::ImportMed : "<GetProperties()->IsLocked()) return Result::_nil(); Mutex mt(myMutex,qApp); Result_i* pResult = new Result_i(myStudyDocument); - if(pResult->Create(theMedSObject) != NULL) + if(pResult->Create(theField) != NULL) + return Result::_duplicate(pResult->_this()); + return Result::_nil(); + } + return myVisuGen->ImportMed(theField); + } + Result_ptr VISU_Gen_i::ImportMedMesh(SALOME_MED::MESH_ptr theMesh){ + if(MYDEBUG) MESSAGE("VISU_Gen_i::ImportMedMesh : "<GetProperties()->IsLocked()) return Result::_nil(); + Mutex mt(myMutex,qApp); + Result_i* pResult = new Result_i(myStudyDocument); + if(pResult->Create(theMesh) != NULL) + return Result::_duplicate(pResult->_this()); + return Result::_nil(); + } + return myVisuGen->ImportMedMesh(theMesh); + } + + Result_ptr VISU_Gen_i::ImportMedSupport(SALOME_MED::SUPPORT_ptr theSupport){ + if(MYDEBUG) MESSAGE("VISU_Gen_i::ImportMedSupport : "<GetProperties()->IsLocked()) return Result::_nil(); + Mutex mt(myMutex,qApp); + Result_i* pResult = new Result_i(myStudyDocument); + if(pResult->Create(theSupport) != NULL) return Result::_duplicate(pResult->_this()); return Result::_nil(); } - return myVisuGen->ImportMed(theMedSObject); + return myVisuGen->ImportMedSupport(theSupport); } Mesh_ptr VISU_Gen_i::MeshOnEntity(Result_ptr theResult, const char* theMeshName, VISU::Entity theEntity){ @@ -708,7 +743,7 @@ namespace VISU{ if(myMutex){ if(myStudyDocument->GetProperties()->IsLocked()) return Curve::_nil(); Mutex mt(myMutex,qApp); - PortableServer::POA_ptr aPOA = GetPOA(); + PortableServer::POA_var aPOA = GetPOA(); Table_i* pTable = dynamic_cast(aPOA->reference_to_servant(theTable)); Curve_i* aPresent = new Curve_i(myStudyDocument,pTable,theHRow,theVRow); if(aPresent->Create() != NULL) { @@ -745,7 +780,7 @@ namespace VISU{ CORBA::Object_var anObj = SObjectToObject(gotBranch); if(CORBA::is_nil(anObj)) continue; Result_i* pResult = dynamic_cast(GetServant(anObj)); - if(pResult->GetSourceId() == Result_i::eRestoredFile){ //Try remove its file and directory + if(pResult->IsRestored()){ //Try remove its file and directory const QFileInfo& aFileInfo = pResult->GetFileInfo(); static QString aCommand; aCommand.sprintf("rm %s",aFileInfo.filePath().latin1()); @@ -779,10 +814,20 @@ namespace VISU{ if(myMutex){ Mutex mt(myMutex,qApp); SALOMEDS::SObject_var aResultSO; - Result_i* aResultObj = dynamic_cast(GetServant(theObject)); + PortableServer::POA_var aPOA = GetPOA(); + Result_i* aResultObj = dynamic_cast(aPOA->reference_to_servant(theObject)); if (!aResultObj) return aResultSO._retn(); + + CORBA::String_var anEntry; const QFileInfo& aFileInfo = aResultObj->GetFileInfo(); - CORBA::String_var anEntry = aResultObj->Create(aFileInfo.filePath().latin1())->GetID(); + anEntry = strdup(aResultObj->Create(aFileInfo.filePath().latin1())->GetID()); +// if (CORBA::is_nil(theSObject)) { +// anEntry = strdup(aResultObj->Create(SALOMEDS::SObject::_nil(), theName)); +// } else { +// if (!theSObject->ReferencedObject(aResultSO)) +// THROW_SALOME_CORBA_EXCEPTION("Publish error: bad referenced SObject",SALOME::BAD_PARAM); +// anEntry = strdup(aResultObj->Create(aResultSO, (const char *)theName)); +// } aResultSO = theStudy->FindObjectID(anEntry); return aResultSO._retn(); } @@ -790,32 +835,22 @@ namespace VISU{ } CORBA::Boolean VISU_Gen_i::CanCopy(SALOMEDS::SObject_ptr theObject) { - if(0 && MYDEBUG) MESSAGE("VISU_Gen_i::CanCopy : "<FindAttribute(anAttr, "AttributeIOR")) return false; try { - SALOMEDS::AttributeIOR_var anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); - CORBA::String_var aValue = anIOR->Value(); - if(strcmp(aValue,"") != 0){ - CORBA::Object_ptr anObj = GetORB()->string_to_object(aValue); - if (!CORBA::is_nil(anObj)){ - Result_var aResultObj = Result::_narrow(anObj); - if(!aResultObj->_is_nil()){ - Result_i* pResult = dynamic_cast(GetServant(aResultObj)); - if(pResult != NULL){ - if(abs(pResult->GetSourceId()) > Result_i::eFile) - if((pResult->GetFileInfo()).filePath() == "Med") return false; - return true; - } - } - } + CORBA::Object_var anObj = GetORB()->string_to_object(SALOMEDS::AttributeIOR::_narrow(anAttr)->Value()); + if (CORBA::is_nil(anObj)) return false; + else { + Result_var aResultObj = Result::_narrow(anObj); + if (aResultObj->_is_nil()) return false; } } catch (...) { - MESSAGE("Unknown exception was accured!"); + return false; } - return false; + return true; } return myVisuGen->CanCopy(theObject); } @@ -829,7 +864,7 @@ namespace VISU{ SALOMEDS::TMPFile_var aStreamFile = new SALOMEDS::TMPFile; SALOMEDS::ListOfFileNames_var aSeq = new SALOMEDS::ListOfFileNames; - PortableServer::POA_ptr aPOA = GetPOA(); + PortableServer::POA_var aPOA = GetPOA(); SALOMEDS::GenericAttribute_var anAttr; if (!theObject->FindAttribute(anAttr,"AttributeIOR")) return NULL; @@ -852,20 +887,20 @@ namespace VISU{ } CORBA::String_var aTmpDir = SALOMEDS_Tool::GetTmpDir(); - string aStr = pStorable->ToString().c_str(); + char* aStr = strdup(pStorable->ToString()); ofstream stmOut2((string(aTmpDir) + string("copy_persistent")).c_str(),ios::out); stmOut2<(aPOA->reference_to_servant(aCorbaObj)); if (aResultObj) { - string aFileName = string(SALOMEDS_Tool::GetNameFromPath(theObject->GetStudy()->URL())) + "_"; + string aStudyPrefix = string(SALOMEDS_Tool::GetNameFromPath(theObject->GetStudy()->URL())) + string("_"); + const QFileInfo& aFileInfo = aResultObj->GetFileInfo(); - aFileName += aFileInfo.fileName().latin1(); static QString aCommand; aCommand.sprintf("cp %s %s", aFileInfo.filePath().latin1(), - (string(aTmpDir) + aFileName).c_str()); + (string(aTmpDir)+aStudyPrefix + string(aResultObj->GetName())).c_str()); if(system(aCommand) == -1) { if(MYDEBUG) MESSAGE("VISU_Gen_i::Copy - Cann't execute the command :"<length(2); aSeq[0] = "copy_persistent"; - aSeq[1] = aFileName.c_str(); + aSeq[1] = (aStudyPrefix + string(aResultObj->GetName())).c_str(); } else { aSeq->length(1); aSeq[0] = "copy_persistent"; @@ -891,7 +926,7 @@ namespace VISU{ CORBA::Boolean VISU_Gen_i::CanPaste(const char* theComponentName, CORBA::Long theObjectID) { // The VISU component can paste only objects copied by VISU component // and with the object type = 1 - if(0 && MYDEBUG) MESSAGE("VISU_Gen_i::CanPaste : "<GetFatherComponent(); + SALOMEDS::Study_var aStudy = theObject->GetStudy(); + SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder(); + CORBA::ORB_var anORB = GetORB(); + ifstream stmIn((string(aTmpDir) + string("copy_persistent")).c_str()); // ifstream stmIn((string(aTmpDir) + string("copy_persistent")).c_str(),ios::in); stmIn.seekg(0, ios::end); @@ -917,28 +957,23 @@ namespace VISU{ stmIn.read(aString, aLength); aString[aLength] = 0; myIsMultiFile = true; - - string aFileName(aTmpDir.in()); - if(aSeq->length() > 1) aFileName += aSeq[1].in(); - Storable* aStorable = Storable::Create(theObject,aFileName,aString); + Storable* aStorable = Storable::Create(theObject,aTmpDir.in(),aString); SALOMEDS::ListOfFileNames_var aSeqToRm = new SALOMEDS::ListOfFileNames; aSeqToRm->length(1); aSeqToRm[0] = "copy_persistent"; SALOMEDS_Tool::RemoveTemporaryFiles(aTmpDir, aSeqToRm.in(), true); - SALOMEDS::SComponent_var aComponent = theObject->GetFatherComponent(); - SALOMEDS::Study_var aStudy = theObject->GetStudy(); - SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder(); - CORBA::String_var aComponentID(aComponent->GetID()), aSObjID(theObject->GetID()); - if (strcmp(aComponentID, aSObjID) == 0) //create the new result SObject + CORBA::String_var aComponentIDString(aComponent->GetID()); + if (strcmp(aComponentIDString, theObject->GetID()) == 0) { + // create the new result SObject aResultSO = aStudyBuilder->NewObject(aComponent); - else + } else { aResultSO = SALOMEDS::SObject::_duplicate(theObject); - SALOMEDS::GenericAttribute_var anAttr = aStudyBuilder->FindOrCreateAttribute(aResultSO, "AttributeIOR"); - SALOMEDS::AttributeIOR_var anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); - CORBA::String_var anIORValue(aStorable->GetID()); - anIOR->SetValue(anIORValue); + } + SALOMEDS::AttributeIOR_var anIOR = + SALOMEDS::AttributeIOR::_narrow(aStudyBuilder->FindOrCreateAttribute(aResultSO, "AttributeIOR")); + anIOR->SetValue(aStorable->GetID()); return aResultSO._retn(); } return myVisuGen->PasteInto(theStream,theObjectID,theObject); diff --git a/src/VISU_I/VISU_Gen_i.hh b/src/VISU_I/VISU_Gen_i.hh index 3b5e2386..ab69280b 100644 --- a/src/VISU_I/VISU_Gen_i.hh +++ b/src/VISU_I/VISU_Gen_i.hh @@ -24,8 +24,7 @@ namespace VISU{ VISU_Gen_i(); VISU_Gen_i(const VISU::VISU_Gen_i &); public: - VISU_Gen_i(CORBA::ORB_ptr theORB, PortableServer::POA_ptr thePOA, - SALOME_NamingService* theNamingService, QMutex* theMutex); + VISU_Gen_i(CORBA::ORB_var orb, PortableServer::POA_var poa, QMutex* theMutex); VISU_Gen_i(CORBA::ORB_ptr orb, PortableServer::POA_ptr poa, PortableServer::ObjectId * contId, @@ -42,7 +41,9 @@ namespace VISU{ //Create Result virtual Result_ptr ImportFile(const char* theFileName); - virtual Result_ptr ImportMed(SALOMEDS::SObject_ptr theMedSObject); + virtual Result_ptr ImportMed(SALOME_MED::FIELD_ptr theField); + virtual Result_ptr ImportMedMesh(SALOME_MED::MESH_ptr theMesh); + virtual Result_ptr ImportMedSupport(SALOME_MED::SUPPORT_ptr theSupport); //Create Presentation Of Submeshes virtual Mesh_ptr MeshOnEntity(Result_ptr theResult, const char* theMeshName, VISU::Entity theEntity); -- 2.39.2