]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
To save / restore optional build parameters of the VISU::Result_i, namely - BuildFiel...
authorapo <apo@opencascade.com>
Fri, 10 Feb 2006 12:18:58 +0000 (12:18 +0000)
committerapo <apo@opencascade.com>
Fri, 10 Feb 2006 12:18:58 +0000 (12:18 +0000)
src/VISU_I/VISUConfig.cc
src/VISU_I/VISUConfig.hh
src/VISU_I/VISU_Result_i.cc
src/VISU_I/VISU_Result_i.hh

index ee879b6a407126e423413b4bc43c2c8cfa4ac77c..d1e4c58e1487db8dbfe403195e4e9ae37f76a3a8 100644 (file)
@@ -194,6 +194,16 @@ namespace VISU{
   }
 
 
+  QString Storable::FindValue(const TRestoringMap& theMap, const string& theArg, const QString& theDefaultValue)
+  {
+    bool anIsFound = false;
+    QString aValue = FindValue(theMap,theArg,&anIsFound);
+    if(anIsFound)
+      return aValue;
+    return theDefaultValue;
+  }
+
+
   //===========================================================================
   PortableServer::ServantBase_var GetServant(CORBA::Object_ptr theObject){
     if(CORBA::is_nil(theObject))  return NULL;
index 6ec9a2d015ba90dce00fdd20403169043f77a357..3e835d714e58f7d9fb3d00b04597e2af981dccb8 100644 (file)
@@ -124,6 +124,7 @@ namespace VISU
     static void Registry(const char* theComment, TStorableEngine theEngine);
     static Storable* Create(SALOMEDS::SObject_ptr, const std::string& thePrefix, const std::string& theString);
     static QString FindValue(const TRestoringMap& theMap, const std::string& theArg, bool* isFind = NULL);
+    static QString FindValue(const TRestoringMap& theMap, const std::string& theArg, const QString& theDefaultValue);
     static void StrToMap(const QString& theStr, VISU::Storable::TRestoringMap& theMap);
     static SALOMEDS::SObject_ptr GetResultSO(SALOMEDS::SObject_ptr theSObject);
     static void DataToStream(std::ostringstream& theStr, const QString& theName, const QString& theVal);
index 2a85df8166ad105511b8a8743bca50ed8d1e1c30..c150b76dec54f59429c7f64d8b1ae7de48f00cd4 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),
+  myIsBuildGroups(theIsBuildMinMax),
+  myIsBuildMinMax(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,17 @@ 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();
+       if(myIsBuildMinMax){
+         myInput->BuildMinMax();
+       }
+      }
+      if(myIsBuildGroups)
+       myInput->BuildGroups();
+
       QString aComment;
       aComment.sprintf("myComment=%s;myType=%d;myFileName=%s;myInitFileName=%s",
                       GetComment(), VISU::TRESULT, myFileInfo.filePath().latin1(),
@@ -1269,8 +1283,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 +1371,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 +1391,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);
 }
 
 
index ee903de6aafb7f295de17dd07032c7f7d1e65bf2..fec23981c8d43173996908197c84ca6b6aa2c575 100644 (file)
@@ -73,7 +73,10 @@ namespace VISU
     Result_i(SALOMEDS::Study_ptr theStudy,
             const ESourceId& theSourceId,
             const ECreationId& theCreationId,
-            CORBA::Boolean theIsBuildImmediately = true);
+            CORBA::Boolean theIsBuildImmediately = true,
+            CORBA::Boolean theIsBuildFields = true,
+            CORBA::Boolean theIsBuildMinMax = true,
+            CORBA::Boolean theIsBuildGroups = true);
 
     virtual ~Result_i();
     virtual void RemoveFromStudy();