]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
Fix for bug 10597 : Post-Pro data incorrect restored from HDF, created on 2.2.6 versi...
authormkr <mkr@opencascade.com>
Wed, 23 Aug 2006 05:49:08 +0000 (05:49 +0000)
committermkr <mkr@opencascade.com>
Wed, 23 Aug 2006 05:49:08 +0000 (05:49 +0000)
src/VISU_I/VISU_Gen_i.cc
src/VISU_I/VISU_Result_i.cc

index 98b81da56ffc00e3f094eebd174eb997cf104708..d973f0eec1589fbce19d877bb09bcb2fd85e1e86 100644 (file)
@@ -72,6 +72,7 @@
 // QT Includes
 #include <qstring.h>
 #include <qfileinfo.h>
+#include <qregexp.h>
 
 // VTK Includes
 #include <vtkRenderer.h>
@@ -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<char*>(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,
index be9cbc9809e7eaaad0df720215054b50adf188e9..db7457fba8d80d0435fad6015a0de74c7539d131 100644 (file)
@@ -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,