From 8b4db394e7b11ef0fb4c80570710e0371d0cf727 Mon Sep 17 00:00:00 2001 From: jfa Date: Wed, 3 Aug 2005 13:30:32 +0000 Subject: [PATCH] Fix application CRASH on load study with Post-Pro data from ASCII format: apply the same patch, as on HEAD version + small merge --- src/VISU_I/VISUConfig.cc | 93 +++++++----- src/VISU_I/VISUConfig.hh | 52 +++---- src/VISU_I/VISU_Result_i.cc | 285 +++++++++++++++++++++--------------- src/VISU_I/VISU_Result_i.hh | 42 +++--- 4 files changed, 267 insertions(+), 205 deletions(-) diff --git a/src/VISU_I/VISUConfig.cc b/src/VISU_I/VISUConfig.cc index c137e26f..b20267d3 100644 --- a/src/VISU_I/VISUConfig.cc +++ b/src/VISU_I/VISUConfig.cc @@ -1,23 +1,23 @@ // VISU OBJECT : interactive object for VISU entities implementation // // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org // // // File : VISUConfig.cc @@ -47,7 +47,7 @@ namespace VISU{ Base_i::~Base_i() {} - char* Base_i::GetID(){ + char* Base_i::GetID(){ if(myID == ""){ CORBA::Object_var anObject = _this(); CORBA::String_var anIOR = myOrb->object_to_string(anObject); @@ -62,7 +62,7 @@ namespace VISU{ Mutex::Mutex(QMutex* theMutex): myMutex(&aMutex){ if(MYDEBUG) MESSAGE("Mutex::Mutex : "<lock(); } @@ -81,7 +81,7 @@ namespace VISU{ ToStream(strOut); strOut<> dupliacte registring !!!"); } } - + void Storable::StrToMap(const QString& theStr, VISU::Storable::TRestoringMap& theMap){ if(0 && MYDEBUG) MESSAGE("Storable::StrToMap : string="<second; } - + //=========================================================================== PortableServer::ServantBase_var GetServant(CORBA::Object_ptr theObject){ @@ -180,7 +180,7 @@ namespace VISU{ PortableServer::Servant aServant = aPOA->reference_to_servant(theObject); return aServant; } catch (...) { - INFOS("GetServant - Unknown exception was occured!!!"); + INFOS("GetServant - Unknown exception was occured!!!"); return NULL; } } @@ -209,7 +209,7 @@ namespace VISU{ string FindEntryWithComment(SALOMEDS::Study_ptr theStudyDocument, const char* theStartEntry, const char* theComment, int IsAllLevels) { - SALOMEDS::ChildIterator_var anIter = + SALOMEDS::ChildIterator_var anIter = theStudyDocument->NewChildIterator(theStudyDocument->FindObjectID(theStartEntry)); anIter->InitEx(IsAllLevels); SALOMEDS::SObject_var aFieldSO; @@ -230,9 +230,9 @@ namespace VISU{ return ""; } //=========================================================================== - string CreateAttributes(SALOMEDS::Study_ptr theStudyDocument, + string CreateAttributes(SALOMEDS::Study_ptr theStudyDocument, const char* theFatherEntry, const char* theRefFatherEntry, - const char* theIOR, const char* theName, + const char* theIOR, const char* theName, const char* thePersistentRef, const char* theComment, CORBA::Boolean theCreateNew) { @@ -245,17 +245,17 @@ namespace VISU{ if(strcmp(theIOR,"") != 0){ anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributeIOR"); SALOMEDS::AttributeIOR_var anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); - anIOR->SetValue(theIOR); + anIOR->SetValue(theIOR); } if(strcmp(theName,"") != 0){ anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributeName"); SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(anAttr); - aName->SetValue(theName); + aName->SetValue(theName); } if(strcmp(thePersistentRef,"") != 0){ anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributePersistentRef"); SALOMEDS::AttributePersistentRef_var aPRef = SALOMEDS::AttributePersistentRef::_narrow(anAttr); - aPRef->SetValue(thePersistentRef); + aPRef->SetValue(thePersistentRef); } if(strcmp(theComment,"") != 0){ anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributeComment"); @@ -270,10 +270,23 @@ namespace VISU{ } CORBA::String_var anEntry = newObj->GetID(); string aRet(anEntry); - if(MYDEBUG) + if(MYDEBUG) INFOS("CreateAttributes - StudyId = "<StudyId()<<"; anEntry = "<_is_nil()) { + SALOMEDS::Study_var aStudy = theSObject->GetStudy(); + SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder(); + if (theIsAttrOnly) + aStudyBuilder->RemoveAttribute(theSObject,"AttributeIOR"); + else + aStudyBuilder->RemoveObjectWithChildren(theSObject); + } + } } diff --git a/src/VISU_I/VISUConfig.hh b/src/VISU_I/VISUConfig.hh index ca83125f..68e2c7c5 100644 --- a/src/VISU_I/VISUConfig.hh +++ b/src/VISU_I/VISUConfig.hh @@ -1,23 +1,23 @@ // VISU OBJECT : interactive object for VISU entities implementation // // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org // // // File : VISUConfig.hh @@ -31,8 +31,8 @@ #include #include #include -#include -#include +#include +#include #include #include @@ -48,7 +48,7 @@ #include "utilities.h" #include -#include +#include namespace VISU{ //=========================================================================== @@ -101,11 +101,11 @@ namespace VISU{ std::string ToString(); virtual const char* GetComment() const = 0; typedef std::map TRestoringMap; - typedef Storable* (*TStorableEngine)(SALOMEDS::SObject_ptr theSObject, + typedef Storable* (*TStorableEngine)(SALOMEDS::SObject_ptr theSObject, const std::string& thePrefix, const TRestoringMap& theMap); typedef std::map TCallbackMap; static void Registry(const char* theComment, TStorableEngine theEngine); - static Storable* Create(SALOMEDS::SObject_ptr, const std::string& thePrefix, const std::string& theString); + static Storable* Create(SALOMEDS::SObject_ptr, const std::string& thePrefix, const std::string& theString); static const QString& FindValue(const TRestoringMap& theMap, const std::string& theArg, bool* isFind = NULL); static void StrToMap(const QString& theStr, VISU::Storable::TRestoringMap& theMap); static SALOMEDS::SObject_ptr GetResultSO(SALOMEDS::SObject_ptr theSObject); @@ -124,15 +124,17 @@ namespace VISU{ SALOMEDS::SComponent_var FindOrCreateVisuComponent(SALOMEDS::Study_ptr theStudyDocument); - std::string CreateAttributes(SALOMEDS::Study_ptr theStudyDocument, + std::string CreateAttributes(SALOMEDS::Study_ptr theStudyDocument, const char* theFatherEntry, const char* theRefFatherEntry, - const char* theIOR, const char* theName, + const char* theIOR, const char* theName, const char* thePersistentRef, const char* theComment, CORBA::Boolean theCreateNew = true); std::string FindEntryWithComment(SALOMEDS::Study_ptr theStudyDocument, const char* theStartEntry, const char* theComment, int IsAllLevels = true); -} + void RemoveFromStudy(SALOMEDS::SObject_ptr theSObject, + bool theIsAttrOnly = true); +} #endif diff --git a/src/VISU_I/VISU_Result_i.cc b/src/VISU_I/VISU_Result_i.cc index d4e1ee61..7fdddb84 100644 --- a/src/VISU_I/VISU_Result_i.cc +++ b/src/VISU_I/VISU_Result_i.cc @@ -1,23 +1,23 @@ // VISU OBJECT : interactive object for VISU entities implementation // // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org // // // File : VISU_Result_i.cc @@ -25,23 +25,20 @@ // Module : VISU #include "VISU_Result_i.hh" + #include "VISU_Convertor_impl.hxx" #include "VISU_CorbaMedConvertor.hxx" #include "VISU_PipeLine.hxx" #include "QAD_Config.h" + #include "SALOMEDS_Tool.hxx" #include "HDFascii.hxx" +// QT Includes #include #include -#include -#include - -#include -#include - using namespace VISU; using namespace std; @@ -51,53 +48,46 @@ static int MYDEBUG = 0; static int MYDEBUG = 0; #endif -VISU::Result_var VISU::FindResult(SALOMEDS::SObject_ptr theSObject){ +VISU::Result_var VISU::FindResult (SALOMEDS::SObject_ptr theSObject) +{ SALOMEDS::SComponent_var aSComponent = theSObject->GetFatherComponent(); SALOMEDS::SObject_var aFather = theSObject->GetFather(); - CORBA::String_var aComponentID(aSComponent->GetID()); - CORBA::String_var aFatherID(aFather->GetID()); + CORBA::String_var aComponentID (aSComponent->GetID()); + CORBA::String_var aFatherID (aFather->GetID()); VISU::Result_var aResult; - while(strcmp(aComponentID,aFatherID) != 0){ + while (strcmp(aComponentID, aFatherID) != 0) { CORBA::Object_var anObject = VISU::SObjectToObject(aFather); - if(!CORBA::is_nil(anObject)){ + if (!CORBA::is_nil(anObject)) { aResult = VISU::Result::_narrow(anObject); - if(!aResult->_is_nil()) return aResult; + if (!aResult->_is_nil()) return aResult; } aFather = aFather->GetFather(); + aFatherID = aFather->GetID(); } return aResult; } -void VISU::RemoveFromStudy(SALOMEDS::SObject_ptr theSObject, int theIsAttrOnly){ - if(!theSObject->_is_nil()){ - SALOMEDS::Study_var aStudy = theSObject->GetStudy(); - SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder(); - if(theIsAttrOnly) - aStudyBuilder->RemoveAttribute(theSObject,"AttributeIOR"); - else - aStudyBuilder->RemoveObjectWithChildren(theSObject); - } -} - -QString GenerateName(const char* theName){ +QString GenerateName (const char* theName) +{ typedef map TNameMap; static TNameMap aMap; TNameMap::const_iterator i = aMap.find(theName); QString tmp; - if(i == aMap.end()) { + if (i == aMap.end()) { aMap[theName] = 0; tmp = theName; - }else{ + } else { tmp = VISU::GenerateName(theName,++aMap[theName]); } if(MYDEBUG) MESSAGE("GenerateName - "<NewBuilder(); SALOMEDS::SObject_var aFather = theStudyDocument->FindObjectID(theFatherEntry.c_str()); @@ -115,7 +105,8 @@ void CreateReference(SALOMEDS::Study_ptr theStudyDocument, aStudyBuilder->Addreference(newObj,aRefSObj); } -string GetComponentDataType(SALOMEDS::SObject_ptr theSObject){ +string GetComponentDataType (SALOMEDS::SObject_ptr theSObject) +{ SALOMEDS::SComponent_var aCompRefSObj = theSObject->GetFatherComponent(); CORBA::String_var aDataType = aCompRefSObj->ComponentDataType(); return aDataType.in(); @@ -126,7 +117,9 @@ string GetComponentDataType(SALOMEDS::SObject_ptr theSObject){ const string VISU::Result_i::myComment = "RESULT"; const char* VISU::Result_i::GetComment() const { return myComment.c_str();} -VISU::Result_i::Result_i(SALOMEDS::Study_ptr theStudy, const TSourceId& aSourceId) { +VISU::Result_i::Result_i (SALOMEDS::Study_ptr theStudy, + const TSourceId& aSourceId) +{ myStudyDocument = SALOMEDS::Study::_duplicate(theStudy); mySourceId = aSourceId; myInput = NULL; @@ -137,12 +130,16 @@ VISU::Result_i::Result_i(SALOMEDS::Study_ptr theStudy, const TSourceId& aSourceI } -void VISU::Result_i::RemoveFromStudy(){ +void VISU::Result_i::RemoveFromStudy() +{ VISU::RemoveFromStudy(mySObject,false); } -int VISU::Result_i::IsPossible(){ +int +VISU::Result_i:: +IsPossible() +{ try{ float aSize = myInput->GetSize(); bool aResult = VISU_PipeLine::CheckAvailableMemory(aSize); @@ -157,7 +154,10 @@ int VISU::Result_i::IsPossible(){ } -CORBA::Boolean VISU::Result_i::BuildAll(){ +CORBA::Boolean +VISU::Result_i:: +BuildAll() +{ if(MYDEBUG) MESSAGE("Result_i::Build - myIsDone = "<NewBuilder(); aStudyBuilder->NewCommand(); // There is a transaction if(MYDEBUG) MESSAGE("Result_i::Build"); try{ const TMeshMap& aMeshMap = myInput->GetMeshMap(); - if(aMeshMap.empty()) + if(aMeshMap.empty()) throw std::runtime_error("Build - There is no any mesh information in the file !!!"); mySComponent = FindOrCreateVisuComponent(myStudyDocument); CORBA::String_var aSComponentEntry = mySComponent->GetID(), anIOR(GetID()); @@ -254,8 +257,8 @@ VISU::Storable* VISU::Result_i::Build(SALOMEDS::SObject_ptr theSObject) GetComment(), VISU::TRESULT, myFileInfo.filePath().latin1(), - myInitFileName.c_str()); // Restoring of Python dump - string aResultEntry = + myInitFileName.c_str()); // Restoring of Python dump + string aResultEntry = CreateAttributes(myStudyDocument, aSComponentEntry, aRefFatherEntry.c_str(), @@ -305,8 +308,9 @@ VISU::Storable* VISU::Result_i::Build(SALOMEDS::SObject_ptr theSObject) default: throw std::runtime_error("Build >> Value of entity is incorrect!"); } - aEntity2EntryMap[anEntity] = CreateAttributes(myStudyDocument,aSubMeshesEntry.c_str(),aRefFatherEntry.c_str(), - "",anEntityName.c_str(),"",aComment.latin1(),true); + aEntity2EntryMap[anEntity] = CreateAttributes + (myStudyDocument, aSubMeshesEntry.c_str(), aRefFatherEntry.c_str(), + "", anEntityName.c_str(), "", aComment.latin1(), true); const VISU::PMeshOnEntity aMeshOnEntity = aMeshOnEntityMapIter->second; const VISU::TFamilyMap& aFamilyMap = aMeshOnEntity->myFamilyMap; VISU::TFamilyMap::const_iterator aFamilyMapIter = aFamilyMap.begin(); @@ -317,7 +321,7 @@ VISU::Storable* VISU::Result_i::Build(SALOMEDS::SObject_ptr theSObject) aMeshName.c_str(), anEntity, aFamilyName.c_str()); - aComment2EntryMap[aComment.latin1()] = + aComment2EntryMap[aComment.latin1()] = CreateAttributes(myStudyDocument, aEntity2EntryMap[anEntity].c_str(), aRefFatherEntry.c_str(), @@ -333,7 +337,7 @@ VISU::Storable* VISU::Result_i::Build(SALOMEDS::SObject_ptr theSObject) if(aGroupMap.size() > 0){ aComment.sprintf("myComment=GROUPS;myMeshName=%s", aMeshName.c_str()); - string aGroupsEntry = + string aGroupsEntry = CreateAttributes(myStudyDocument, aMeshEntry.c_str(), aRefFatherEntry.c_str(), @@ -378,7 +382,7 @@ VISU::Storable* VISU::Result_i::Build(SALOMEDS::SObject_ptr theSObject) if(!isFieldEntryCreated){ aComment.sprintf("myComment=FIELDS;myMeshName=%s", aMeshName.c_str()); - aFieldsEntry = + aFieldsEntry = CreateAttributes(myStudyDocument, aMeshEntry.c_str(), aRefFatherEntry.c_str(), @@ -425,7 +429,11 @@ VISU::Storable* VISU::Result_i::Build(SALOMEDS::SObject_ptr theSObject) return this; } -VISU::Storable* VISU::Result_i::Create(const char* theFileName){ + +VISU::Storable* +VISU::Result_i:: +Create(const char* theFileName) +{ try{ myFileInfo.setFile(theFileName); myInitFileName = myFileInfo.filePath().latin1(); @@ -442,8 +450,9 @@ VISU::Storable* VISU::Result_i::Create(const char* theFileName){ myFileInfo.setFile(QString(aTmpDir.get()) + myFileInfo.fileName()); } myInput = CreateConvertor(myFileInfo.absFilePath().latin1()); - if(!myInput) - throw std::runtime_error("Create - Cannot create a Convertor for this file!!!"); return Build(); + if(!myInput) + throw std::runtime_error("Create - Cannot create a Convertor for this file!!!"); + return Build(); }catch(std::exception& exc){ INFOS("Follow exception was occured :\n"<ConvertObjectToIOR(theField); SALOMEDS::SObject_var aFieldSObject = myStudyDocument->FindObjectIOR(anIOR); + VISU::Storable* aStorable = Build(aFieldSObject); return aStorable; }catch(std::exception& exc){ @@ -493,101 +518,117 @@ VISU::Storable* VISU::Result_i::Create(SALOME_MED::FIELD_ptr theField){ return NULL; } -VISU::Storable* VISU::Result_i::Restore(SALOMEDS::SObject_ptr theSObject, - const Storable::TRestoringMap& theMap, const string& thePrefix) + +VISU::Storable* +VISU::Result_i:: +Restore(SALOMEDS::SObject_ptr theSObject, + const Storable::TRestoringMap& theMap, + const string& thePrefix) { - if(MYDEBUG) MESSAGE("Result_i::Restore - "<GetStudy(); mySComponent = mySObject->GetFatherComponent(); - myName = VISU::Storable::FindValue(theMap,"myName").latin1(); - myInitFileName = VISU::Storable::FindValue(theMap,"myInitFileName").latin1(); + myName = VISU::Storable::FindValue(theMap, "myName").latin1(); + myInitFileName = VISU::Storable::FindValue(theMap, "myInitFileName").latin1(); + SALOMEDS::SObject_var aRefSObj, aTargetRefSObj; - if(mySObject->FindSubObject(1,aRefSObj) && aRefSObj->ReferencedObject(aTargetRefSObj)){ + if (mySObject->FindSubObject(1, aRefSObj) && + aRefSObj->ReferencedObject(aTargetRefSObj)) { mySourceId = eRestoredComponent; - if(MYDEBUG) MESSAGE("Result_i::GetInput - There is some reference."); + if(MYDEBUG) MESSAGE("Result_i::GetInput - There is some reference."); SALOMEDS::SComponent_var aCompRefSObj = aTargetRefSObj->GetFatherComponent(); CORBA::String_var aDataType = aCompRefSObj->ComponentDataType(); myFileInfo.setFile(aDataType.in()); - if(MYDEBUG) MESSAGE("Result_i::GetInput - aDataType = "<FindOrLoad_Component("FactoryServer", aDataType.in()); - if (CORBA::is_nil(aEngComp)) + if(MYDEBUG) MESSAGE("Result_i::GetInput - aDataType = " << aDataType); + Engines::Component_var aEngComp = + Base_i::myEnginesLifeCycle->FindOrLoad_Component("FactoryServer", aDataType.in()); + if (CORBA::is_nil(aEngComp)) throw std::runtime_error("Restore - There is no aEngComp for the aDataType !!!"); - SALOMEDS::StudyBuilder_var aStudyBuilder = myStudyDocument->NewBuilder(); + SALOMEDS::StudyBuilder_var aStudyBuilder = myStudyDocument->NewBuilder(); SALOMEDS::Driver_var aDriver = SALOMEDS::Driver::_narrow(aEngComp); - aStudyBuilder->LoadWith(aCompRefSObj,aDriver); - if(strcmp(aDataType,"MED") == 0) + aStudyBuilder->LoadWith(aCompRefSObj, aDriver); + if (strcmp(aDataType, "MED") == 0) myInput = CreateMEDConvertor(aTargetRefSObj); else throw std::runtime_error("GetInput - There is no convertor for the aDataType !!!"); - }else{ + } else { myFileInfo.setFile(thePrefix.c_str()); - string aStudyPrefix(""); - if (IsMultifile()) aStudyPrefix = (SALOMEDS_Tool::GetNameFromPath(myStudyDocument->URL())); - if(!myFileInfo.isFile()){ + string aStudyPrefix (""); + if (IsMultifile()) + aStudyPrefix = SALOMEDS_Tool::GetNameFromPath(myStudyDocument->URL()); + if (!myFileInfo.isFile()) { string aFileName = thePrefix + aStudyPrefix + "_" + myName; myFileInfo.setFile(aFileName.c_str()); } - if(MYDEBUG) - MESSAGE("Result_i::Restore - aFileName = "<FindAttribute(anAttr, "AttributeComment")) + if (!theSObject->FindAttribute(anAttr, "AttributeComment")) throw std::runtime_error("Build - There is no AttributeComment for the SObject !!!"); SALOMEDS::AttributeComment_var aCmnt = SALOMEDS::AttributeComment::_narrow(anAttr); aCmnt->SetValue(aComment.latin1()); } QString aIsBuild = QAD_CONFIG->getSetting("Visu:BuildResult"); - if(aIsBuild.isEmpty()? 0 : aIsBuild.toInt()) + if(aIsBuild.isEmpty()? 0 : aIsBuild.toInt()) BuildAll(); return this; - }catch(std::exception& exc){ + } catch(std::exception& exc) { INFOS("Follow exception was occured :\n"<GetStudy(); + VISU::Result_i* pResult = new VISU::Result_i(aStudy); - if(pResult == NULL) return NULL; + if (pResult == NULL) + return NULL; + return pResult->Restore(theSObject,theMap,thePrefix); } - -string VISU::Result_i::GetRefFatherEntry() { + +string VISU::Result_i::GetRefFatherEntry() { //return QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->entry(); return ""; } -string VISU::Result_i::GetEntry(){ +string VISU::Result_i::GetEntry(){ CORBA::String_var anEntry = mySObject->GetID(); return string(anEntry); } @@ -619,14 +665,15 @@ string VISU::Result_i::GetEntry(){ const SALOMEDS::SObject_var& VISU::Result_i::GetSObject() const { return mySObject;} const SALOMEDS::Study_var& VISU::Result_i::GetStudyDocument() const { return myStudyDocument;} const SALOMEDS::SComponent_var& VISU::Result_i::GetSComponent() const { return mySComponent;} -std::string VISU::Result_i::GetEntry(const std::string& theComment) -{ +std::string VISU::Result_i::GetEntry(const std::string& theComment) +{ return FindEntryWithComment(myStudyDocument,GetEntry().c_str(),theComment.c_str()); } -VISU::Result_i::~Result_i() { +VISU::Result_i::~Result_i() +{ MESSAGE("Result_i::~Result_i() - this = "<