]> SALOME platform Git repositories - modules/kernel.git/commitdiff
Salome HOME
Added a check for negative savePoint parameters
authorsrn <srn@opencascade.com>
Fri, 10 Feb 2006 11:06:58 +0000 (11:06 +0000)
committersrn <srn@opencascade.com>
Fri, 10 Feb 2006 11:06:58 +0000 (11:06 +0000)
src/SALOMEDS/SALOMEDS_Study.cxx
src/SALOMEDSImpl/SALOMEDSImpl_Study.cxx

index 428787d50d7796af197a38974d7c6ea173f7e5ff..db5e7f72185a0335598285b8dc866cb75de73737 100644 (file)
@@ -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);
 }
index 6bcdfff3b82da2a19890f8c5935c7d53efad9875..507a9a547dc1b75f49bd89ec9a90c33843855859 100644 (file)
@@ -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;