Salome HOME
Join modifications from branch OCC_development_for_3_2_0a2
[modules/visu.git] / src / VISU_I / VISU_Result_i.cc
index 2a85df8166ad105511b8a8743bca50ed8d1e1c30..9745df0151ee25f8c58b112988c278ff423ef07f 100644 (file)
@@ -787,20 +787,23 @@ VISU::Result_i
 ::Result_i (SALOMEDS::Study_ptr theStudy,
            const ESourceId& theSourceId,
            const ECreationId& theCreationId,
-           CORBA::Boolean theIsBuildImmediately):
+           CORBA::Boolean theIsBuildImmediately,
+           CORBA::Boolean theIsBuildFields,
+           CORBA::Boolean theIsBuildMinMax,
+           CORBA::Boolean theIsBuildGroups):
   myStudyDocument(SALOMEDS::Study::_duplicate(theStudy)),
   myCreationId(theCreationId),
   mySourceId(theSourceId),
   myIsBuildImmediately(theIsBuildImmediately),
-  myInput(NULL),
+  myIsBuildFields(theIsBuildFields),
+  myIsBuildMinMax(theIsBuildMinMax),
+  myIsBuildGroups(theIsBuildGroups),
   myIsEntitiesDone(false),
   myIsFieldsDone(false),
   myIsGroupsDone(false),
   myIsMinMaxDone(false),
-  myIsBuildFields(true),
-  myIsBuildGroups(true),
-  myIsBuildMinMax(true),
-  myIsAllDone(false)
+  myIsAllDone(false),
+  myInput(NULL)
 {
   myStudy = ProcessEvent(new TGetStudy(myStudyDocument->StudyId()));
 }
@@ -1181,7 +1184,8 @@ Restore(SALOMEDS::SObject_ptr theSObject,
 
     SALOMEDS::SObject_var aRefSObj, aTargetRefSObj;
     if (mySObject->FindSubObject(1, aRefSObj) &&
-       aRefSObj->ReferencedObject(aTargetRefSObj)) {
+       aRefSObj->ReferencedObject(aTargetRefSObj)) 
+    {
       if(MYDEBUG) MESSAGE("Result_i::GetInput - There is some reference.");
       SALOMEDS::SComponent_var aCompRefSObj = aTargetRefSObj->GetFatherComponent();
       CORBA::String_var aDataType = aCompRefSObj->ComponentDataType();
@@ -1258,7 +1262,21 @@ Restore(SALOMEDS::SObject_ptr theSObject,
       }
       if(MYDEBUG) MESSAGE("VISU::Result_i::Restore - mySourceId = " << mySourceId);
       myInput = CreateConvertor(myFileInfo.filePath().latin1());
-      myInput->Build();
+
+      myInput->BuildEntities();
+      if(myIsBuildFields){
+       myInput->BuildFields();
+       myIsFieldsDone = true;
+       if(myIsBuildMinMax){
+         myInput->BuildMinMax();
+         myIsMinMaxDone = true;
+       }
+      }
+      if(myIsBuildGroups){
+       myInput->BuildGroups();
+       myIsGroupsDone = true;
+      }
+
       QString aComment;
       aComment.sprintf("myComment=%s;myType=%d;myFileName=%s;myInitFileName=%s",
                       GetComment(), VISU::TRESULT, myFileInfo.filePath().latin1(),
@@ -1269,8 +1287,8 @@ Restore(SALOMEDS::SObject_ptr theSObject,
       SALOMEDS::AttributeComment_var aCmnt = SALOMEDS::AttributeComment::_narrow(anAttr);
       aCmnt->SetValue(aComment.latin1());
     }
-    bool isBuildAll = VISU::GetResourceMgr()->booleanValue("VISU", "full_med_loading", false);
-    if (isBuildAll)
+    bool anIsBuildAll = VISU::GetResourceMgr()->booleanValue("VISU", "full_med_loading", false);
+    if(anIsBuildAll)
       BuildAll();
     return this;
   } catch(std::exception& exc) {
@@ -1357,6 +1375,9 @@ VISU::Result_i
   Storable::DataToStream(theStr,"myName",myName.c_str());
   Storable::DataToStream(theStr,"myInitFileName",myInitFileName.c_str());
   Storable::DataToStream(theStr,"myCreationId",myCreationId);
+  Storable::DataToStream(theStr,"myIsBuildFields",myIsFieldsDone);
+  Storable::DataToStream(theStr,"myIsBuildMinMax",myIsMinMaxDone);
+  Storable::DataToStream(theStr,"myIsBuildGroups",myIsGroupsDone);
 }
 
 
@@ -1374,11 +1395,20 @@ VISU::Result_i
   if(aCreationId == eImportMed || aCreationId == eImportMedField)
     aSourceId = eRestoredComponent;
 
-  VISU::Result_i* pResult = new VISU::Result_i(aStudy,aSourceId,aCreationId);
-  if (pResult == NULL)
+  CORBA::Boolean anIsBuildFields = Storable::FindValue(theMap,"myIsBuildFields","0").toInt();
+  CORBA::Boolean anIsBuildMinMax = Storable::FindValue(theMap,"myIsBuildMinMax","0").toInt();
+  CORBA::Boolean anIsBuildGroups = Storable::FindValue(theMap,"myIsBuildGroups","0").toInt();
+
+  VISU::Result_i* aResult = new VISU::Result_i(aStudy,
+                                              aSourceId,
+                                              aCreationId,
+                                              anIsBuildFields,
+                                              anIsBuildMinMax,
+                                              anIsBuildGroups);
+  if (aResult == NULL)
     return NULL;
 
-  return pResult->Restore(theSObject,theMap,thePrefix);
+  return aResult->Restore(theSObject,theMap,thePrefix);
 }