From: mkr Date: Wed, 23 Aug 2006 05:49:08 +0000 (+0000) Subject: Fix for bug 10597 : Post-Pro data incorrect restored from HDF, created on 2.2.6 versi... X-Git-Tag: mergefrom_BR_For_OCT_611_04Sep06~11 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=bab9153475a09a77ec95f73e23a10d76ed5d4465;p=modules%2Fvisu.git Fix for bug 10597 : Post-Pro data incorrect restored from HDF, created on 2.2.6 version in 3.1.0a2 version. --- diff --git a/src/VISU_I/VISU_Gen_i.cc b/src/VISU_I/VISU_Gen_i.cc index 98b81da5..d973f0ee 100644 --- a/src/VISU_I/VISU_Gen_i.cc +++ b/src/VISU_I/VISU_Gen_i.cc @@ -72,6 +72,7 @@ // QT Includes #include #include +#include // VTK Includes #include @@ -262,6 +263,66 @@ namespace VISU VISU_Gen_i::~VISU_Gen_i(){ if(MYDEBUG) MESSAGE("VISU_Gen_i::~VISU_Gen_i"); } + + void CorrectSObjectType(SALOMEDS::SObject_ptr theSObject) + { + SALOMEDS::GenericAttribute_var anAttr; + if ( theSObject->FindAttribute(anAttr, "AttributeComment") ) { + SALOMEDS::AttributeComment_var aAttComment = SALOMEDS::AttributeComment::_narrow(anAttr); + if ( aAttComment ) { + string aValue = aAttComment->Value(); + if ( aValue.compare("") ) { + const QString aStr = QString( aValue.c_str() ); + VISU::Storable::TRestoringMap aMap; + Storable::StrToMap( aStr, aMap ); + + bool isFind = false; + QString aType = Storable::FindValue( aMap, "myType", &isFind ); + if ( isFind ) { + VISU::VISUType aVISUType = (VISU::VISUType)( aType.toInt() ); + QString aComment = Storable::FindValue( aMap, "myComment", &isFind ); + if ( isFind ) { + if ( !aComment.compare(QString("NONE")) ) aVISUType = VISU::TNONE; + else if ( !aComment.compare(QString("CURVE")) ) aVISUType = VISU::TCURVE; + else if ( !aComment.compare(QString("TABLE")) ) aVISUType = VISU::TTABLE; + else if ( !aComment.compare(QString("CONTAINER")) ) aVISUType = VISU::TCONTAINER; + else if ( !aComment.compare(QString("MESH")) ) aVISUType = VISU::TMESH; + else if ( !aComment.compare(QString("SCALARMAP")) ) aVISUType = VISU::TSCALARMAP; + else if ( !aComment.compare(QString("ISOSURFACE")) ) aVISUType = VISU::TISOSURFACE; + else if ( !aComment.compare(QString("DEFORMEDSHAPE")) ) aVISUType = VISU::TDEFORMEDSHAPE; + else if ( !aComment.compare(QString("SCALARMAPONDEFORMEDSHAPE")) ) aVISUType = VISU::TSCALARMAPONDEFORMEDSHAPE; + else if ( !aComment.compare(QString("GAUSSPOINTS")) ) aVISUType = VISU::TGAUSSPOINTS; + else if ( !aComment.compare(QString("PLOT3D")) ) aVISUType = VISU::TPLOT3D; + else if ( !aComment.compare(QString("CUTPLANES")) ) aVISUType = VISU::TCUTPLANES; + else if ( !aComment.compare(QString("CUTLINES")) ) aVISUType = VISU::TCUTLINES; + else if ( !aComment.compare(QString("VECTORS")) ) aVISUType = VISU::TVECTORS; + else if ( !aComment.compare(QString("STREAMLINES")) ) aVISUType = VISU::TSTREAMLINES; + else if ( !aComment.compare(QString("VISUGEN")) ) aVISUType = VISU::TVISUGEN; + else if ( !aComment.compare(QString("VIEWMANAGER")) ) aVISUType = VISU::TVIEWMANAGER; + else if ( !aComment.compare(QString("RESULT")) ) aVISUType = VISU::TRESULT; + else if ( !aComment.compare(QString("XYPLOT")) ) aVISUType = VISU::TXYPLOT; + else if ( !aComment.compare(QString("TABLEVIEW,")) ) aVISUType = VISU::TTABLEVIEW; + else if ( !aComment.compare(QString("VIEW3D")) ) aVISUType = VISU::TVIEW3D; + else if ( !aComment.compare(QString("GAUSSVIEW")) ) aVISUType = VISU::TGAUSSVIEW; + else if ( !aComment.compare(QString("ENTITY")) ) aVISUType = VISU::TENTITY; + else if ( !aComment.compare(QString("FAMILY")) ) aVISUType = VISU::TFAMILY; + else if ( !aComment.compare(QString("GROUP")) ) aVISUType = VISU::TGROUP; + else if ( !aComment.compare(QString("FIELD")) ) aVISUType = VISU::TFIELD; + else if ( !aComment.compare(QString("TIMESTAMP")) ) aVISUType = VISU::TTIMESTAMP; + else if ( !aComment.compare(QString("ANIMATION")) ) aVISUType = VISU::TANIMATION; + else if ( !aComment.compare(QString("ALL")) ) aVISUType = VISU::TALL; + else + if (MYDEBUG) MESSAGE("Error : Unknown type of VISU object!"); + } + QString aNewStr = aStr; + aAttComment->SetValue( aNewStr.replace( QRegExp( QString("myType=") + aType ) , + QString("myType=") + QString::number(aVISUType) ).latin1() ); + } + } + } + } + } + //=========================================================================== CORBA::Boolean VISU_Gen_i::Load(SALOMEDS::SComponent_ptr theComponent, const SALOMEDS::TMPFile & theStream, @@ -270,6 +331,13 @@ namespace VISU { Mutex mt(myMutex); SALOMEDS::Study_var aStudy = theComponent->GetStudy(); + + SALOMEDS::ChildIterator_var anIter = aStudy->NewChildIterator(theComponent); + for (anIter->InitEx(true); anIter->More(); anIter->Next()) { + SALOMEDS::SObject_var aSObject = anIter->Value(); + CorrectSObjectType(aSObject); + } + SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder(); string aDir = isMultiFile ? theURL : SALOMEDS_Tool::GetTmpDir(); TCollection_AsciiString aTmpDir (const_cast(aDir.c_str())); @@ -302,6 +370,7 @@ namespace VISU } return aString._retn(); } + //=========================================================================== SALOMEDS::TMPFile* VISU_Gen_i::Save(SALOMEDS::SComponent_ptr theComponent, const char* theURL, diff --git a/src/VISU_I/VISU_Result_i.cc b/src/VISU_I/VISU_Result_i.cc index be9cbc98..db7457fb 100644 --- a/src/VISU_I/VISU_Result_i.cc +++ b/src/VISU_I/VISU_Result_i.cc @@ -1478,9 +1478,9 @@ VISU::Result_i if(aCreationId == eImportMed || aCreationId == eImportMedField) aSourceId = eRestoredComponent; - 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(); + CORBA::Boolean anIsBuildFields = Storable::FindValue(theMap,"myIsBuildFields","1").toInt(); + CORBA::Boolean anIsBuildMinMax = Storable::FindValue(theMap,"myIsBuildMinMax","1").toInt(); + CORBA::Boolean anIsBuildGroups = Storable::FindValue(theMap,"myIsBuildGroups","1").toInt(); VISU::Result_i* aResult = new VISU::Result_i(aStudy, aSourceId,