From: apo Date: Fri, 10 Feb 2006 12:18:58 +0000 (+0000) Subject: To save / restore optional build parameters of the VISU::Result_i, namely - BuildFiel... X-Git-Tag: mergeto_trunk_13Mar06~45 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=d98485cd241d40b567f46f0aa32098c2748a12ad;p=modules%2Fvisu.git To save / restore optional build parameters of the VISU::Result_i, namely - BuildFields, BuildMinMax and BuildGroups --- diff --git a/src/VISU_I/VISUConfig.cc b/src/VISU_I/VISUConfig.cc index ee879b6a..d1e4c58e 100644 --- a/src/VISU_I/VISUConfig.cc +++ b/src/VISU_I/VISUConfig.cc @@ -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; diff --git a/src/VISU_I/VISUConfig.hh b/src/VISU_I/VISUConfig.hh index 6ec9a2d0..3e835d71 100644 --- a/src/VISU_I/VISUConfig.hh +++ b/src/VISU_I/VISUConfig.hh @@ -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); diff --git a/src/VISU_I/VISU_Result_i.cc b/src/VISU_I/VISU_Result_i.cc index 2a85df81..c150b76d 100644 --- a/src/VISU_I/VISU_Result_i.cc +++ b/src/VISU_I/VISU_Result_i.cc @@ -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); } diff --git a/src/VISU_I/VISU_Result_i.hh b/src/VISU_I/VISU_Result_i.hh index ee903de6..fec23981 100644 --- a/src/VISU_I/VISU_Result_i.hh +++ b/src/VISU_I/VISU_Result_i.hh @@ -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();