]> SALOME platform Git repositories - modules/geom.git/blobdiff - src/GEOM_I/GEOM_Gen_i.cc
Salome HOME
To show notebook variables in the Object Browser.
[modules/geom.git] / src / GEOM_I / GEOM_Gen_i.cc
index 4a89a99bcfdebf1ffdc26a719c62a33d4b23cba1..b36a652f7981dab7152f75e29e12ebb7b078a979 100644 (file)
@@ -272,6 +272,32 @@ SALOMEDS::SObject_ptr GEOM_Gen_i::PublishInStudy(SALOMEDS::Study_ptr theStudy,
   anAttr = aStudyBuilder->FindOrCreateAttribute(aResultSO, "AttributeName");
   SALOMEDS::AttributeName_var aNameAttrib = SALOMEDS::AttributeName::_narrow(anAttr);
   aNameAttrib->SetValue(aShapeName.ToCString());
+
+  //Set NoteBook variables used in the object creation
+  TCollection_AsciiString aParams(aShape->GetParameters());
+  if(!aParams.IsEmpty()) {
+    TCollection_AsciiString aVars;
+    int nbVars = 0;
+    int n = 1;
+    TCollection_AsciiString aParam = aParams.Token(":",1);
+    while( aParam.Length() != 0 ) {
+      aParam = aParams.Token(":",n);
+      if(theStudy->IsVariable(aParam.ToCString())){
+       aVars+=aParam;
+       nbVars++;
+      }
+      if(aParam.Length() == 0)
+       break;
+      aVars+=":";
+      n++;
+    }
+    aVars.Remove(aVars.Length(),1);
+    if(nbVars > 0 ) {
+      anAttr = aStudyBuilder->FindOrCreateAttribute(aResultSO, "AttributeString");
+      SALOMEDS::AttributeString_var aStringAttrib = SALOMEDS::AttributeString::_narrow(anAttr);
+      aStringAttrib->SetValue(aVars.ToCString());
+    }
+  }
   
   //Set a name of the GEOM object
   aShape->SetName(theName);
@@ -313,7 +339,7 @@ SALOMEDS::TMPFile* GEOM_Gen_i::Save(SALOMEDS::SComponent_ptr theComponent,
   // Build a full file name of temporary file
   TCollection_AsciiString aFullName = TCollection_AsciiString((char*)aTmpDir.c_str()) + aNameWithExt;
   // Save GEOM component in this file
-  _impl->Save(theComponent->GetStudy()->StudyId(), aFullName.ToCString());
+  _impl->Save(theComponent->GetStudy()->StudyId(),(char*) aFullName.ToCString());
   // Conver a file to the byte stream
   aStreamFile = SALOMEDS_Tool::PutFilesToStream(aTmpDir.c_str(), aSeq.in(), isMultiFile);
   // Remove the created file and tmp directory
@@ -375,7 +401,7 @@ CORBA::Boolean GEOM_Gen_i::Load(SALOMEDS::SComponent_ptr theComponent,
   TCollection_AsciiString aFullName = (TCollection_AsciiString((char*)aTmpDir.c_str()) + aNameWithExt);
 
   // Open document
-  if (!_impl->Load(theComponent->GetStudy()->StudyId(), aFullName.ToCString())) return false;
+  if (!_impl->Load(theComponent->GetStudy()->StudyId(),(char*) aFullName.ToCString())) return false;
 
   // Remove the created file and tmp directory
   if (!isMultiFile) SALOMEDS_Tool::RemoveTemporaryFiles(aTmpDir.c_str(), aSeq.in(), true);