From b70064fa88585b95769eb4de337108ca65018e7a Mon Sep 17 00:00:00 2001 From: srn Date: Fri, 10 Feb 2006 11:06:58 +0000 Subject: [PATCH] Added a check for negative savePoint parameters --- src/SALOMEDS/SALOMEDS_Study.cxx | 30 +++++++++++++------------ src/SALOMEDSImpl/SALOMEDSImpl_Study.cxx | 6 +++++ 2 files changed, 22 insertions(+), 14 deletions(-) diff --git a/src/SALOMEDS/SALOMEDS_Study.cxx b/src/SALOMEDS/SALOMEDS_Study.cxx index 428787d50..db5e7f721 100644 --- a/src/SALOMEDS/SALOMEDS_Study.cxx +++ b/src/SALOMEDS/SALOMEDS_Study.cxx @@ -688,14 +688,15 @@ SALOMEDS::Study_ptr SALOMEDS_Study::GetStudy() _PTR(AttributeParameter) SALOMEDS_Study::GetCommonParameters(const string& theID, int theSavePoint) { SALOMEDSClient_AttributeParameter* AP = NULL; - if (_isLocal) { - SALOMEDS::Locker lock; - AP = new SALOMEDS_AttributeParameter(_local_impl->GetCommonParameters(theID.c_str(), theSavePoint)); - } - else { - AP = new SALOMEDS_AttributeParameter(_corba_impl->GetCommonParameters(theID.c_str(), theSavePoint)); + if(theSavePoint > 0) { + if (_isLocal) { + SALOMEDS::Locker lock; + AP = new SALOMEDS_AttributeParameter(_local_impl->GetCommonParameters(theID.c_str(), theSavePoint)); + } + else { + AP = new SALOMEDS_AttributeParameter(_corba_impl->GetCommonParameters(theID.c_str(), theSavePoint)); + } } - return _PTR(AttributeParameter)(AP); } @@ -703,13 +704,14 @@ _PTR(AttributeParameter) SALOMEDS_Study::GetModuleParameters(const string& theID const string& theModuleName, int theSavePoint) { SALOMEDSClient_AttributeParameter* AP = NULL; - if (_isLocal) { - SALOMEDS::Locker lock; - AP = new SALOMEDS_AttributeParameter(_local_impl->GetModuleParameters(theID.c_str(), theModuleName.c_str(), theSavePoint)); - } - else { - AP = new SALOMEDS_AttributeParameter(_corba_impl->GetModuleParameters(theID.c_str(), theModuleName.c_str(), theSavePoint)); + if(theSavePoint > 0) { + if (_isLocal) { + SALOMEDS::Locker lock; + AP = new SALOMEDS_AttributeParameter(_local_impl->GetModuleParameters(theID.c_str(), theModuleName.c_str(), theSavePoint)); + } + else { + AP = new SALOMEDS_AttributeParameter(_corba_impl->GetModuleParameters(theID.c_str(), theModuleName.c_str(), theSavePoint)); + } } - return _PTR(AttributeParameter)(AP); } diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_Study.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_Study.cxx index 6bcdfff3b..507a9a547 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_Study.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_Study.cxx @@ -1389,6 +1389,10 @@ bool SALOMEDSImpl_Study::DumpStudy(const TCollection_AsciiString& thePath, fp << aScriptName << ".RebuildData(" << aBatchModeScript << ".myStudy)" << endl; } + if(thePrefix.Length() > 0) { //Output the call to Session's method restoreVisualState + fp << "iparameters.getSession().restoreVisualState(1)" << endl; + } + fp << "salome.sg.updateObjBrowser(1)" << endl; fp.close(); @@ -1508,6 +1512,7 @@ void SALOMEDSImpl_Study::Modify() //============================================================================ Handle(SALOMEDSImpl_AttributeParameter) SALOMEDSImpl_Study::GetCommonParameters(const char* theID, int theSavePoint) { + if(theSavePoint <= 0) return NULL; Handle(SALOMEDSImpl_StudyBuilder) builder = NewBuilder(); Handle(SALOMEDSImpl_SObject) so = FindComponent((char*)theID); if(so.IsNull()) so = builder->NewComponent((char*)theID); @@ -1524,6 +1529,7 @@ Handle(SALOMEDSImpl_AttributeParameter) SALOMEDSImpl_Study::GetModuleParameters( const char* theModuleName, int theSavePoint) { + if(theSavePoint <= 0) return NULL; Handle(SALOMEDSImpl_AttributeParameter) main_ap = GetCommonParameters(theID, theSavePoint); Handle(SALOMEDSImpl_SObject) main_so = main_ap->GetSObject(); Handle(SALOMEDSImpl_AttributeParameter) par; -- 2.39.2