]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
Fix for Bug IPAL16080
authorapo <apo@opencascade.com>
Wed, 30 May 2007 14:50:18 +0000 (14:50 +0000)
committerapo <apo@opencascade.com>
Wed, 30 May 2007 14:50:18 +0000 (14:50 +0000)
 - IOLS. Impossible to display and edit presentations created in 3x

31 files changed:
src/VISU_I/VISUConfig.cc
src/VISU_I/VISUConfig.hh
src/VISU_I/VISU_ColoredPrs3dHolder_i.cc
src/VISU_I/VISU_ColoredPrs3d_i.cc
src/VISU_I/VISU_ColoredPrs3d_i.hh
src/VISU_I/VISU_CutLines_i.cc
src/VISU_I/VISU_CutLines_i.hh
src/VISU_I/VISU_CutPlanes_i.cc
src/VISU_I/VISU_CutPlanes_i.hh
src/VISU_I/VISU_DeformedShape_i.cc
src/VISU_I/VISU_DeformedShape_i.hh
src/VISU_I/VISU_GaussPoints_i.cc
src/VISU_I/VISU_GaussPoints_i.hh
src/VISU_I/VISU_Gen_i.cc
src/VISU_I/VISU_IsoSurfaces_i.cc
src/VISU_I/VISU_IsoSurfaces_i.hh
src/VISU_I/VISU_Mesh_i.cc
src/VISU_I/VISU_Mesh_i.hh
src/VISU_I/VISU_Plot3D_i.cc
src/VISU_I/VISU_Plot3D_i.hh
src/VISU_I/VISU_Prs3d_i.cc
src/VISU_I/VISU_Prs3d_i.hh
src/VISU_I/VISU_ScalarMapOnDeformedShape_i.cc
src/VISU_I/VISU_ScalarMapOnDeformedShape_i.hh
src/VISU_I/VISU_ScalarMap_i.cc
src/VISU_I/VISU_ScalarMap_i.hh
src/VISU_I/VISU_StreamLines_i.cc
src/VISU_I/VISU_StreamLines_i.hh
src/VISU_I/VISU_TimeAnimation.cxx
src/VISU_I/VISU_Vectors_i.cc
src/VISU_I/VISU_Vectors_i.hh

index c0e51c20703a5895fd1c4260acc949abae79c710..02ea2d14866817b615d851c5cf2903b9c4f2dff9 100644 (file)
 #include "SUIT_ResourceMgr.h"
 #include "SUIT_Session.h"
 
-#include <SALOMEDSClient_GenericAttribute.hxx>
-#include <SALOMEDSClient_AttributeIOR.hxx>
+#include "SALOMEDSClient_GenericAttribute.hxx"
+#include "SALOMEDSClient_AttributeIOR.hxx"
 
-#include <SalomeApp_Application.h>
+#include "SalomeApp_Application.h"
+#include <qregexp.h>
 
 using namespace std;
 
@@ -120,6 +121,99 @@ namespace VISU{
     }
   }
 
+  std::string 
+  Storable
+  ::CorrectPersistentString(const std::string& thePersistentString)
+  {
+    QString aString(thePersistentString.c_str());
+    if(aString.isEmpty())
+      return aString.latin1();
+
+    VISU::Storable::TRestoringMap aRestoringMap;
+    Storable::StrToMap( aString, aRestoringMap );
+         
+    bool anIsFound = false;
+    QString aComment = Storable::FindValue( aRestoringMap, "myComment", &anIsFound );
+    if ( anIsFound ) {
+      QString aType = Storable::FindValue( aRestoringMap, "myType", &anIsFound );
+      VISU::VISUType aVISUType = (VISU::VISUType)( aType.toInt() );
+      if ( anIsFound ) {
+       if ( aComment == "NONE" ) 
+         aVISUType = VISU::TNONE;
+       else if ( aComment == "CURVE" ) 
+         aVISUType = VISU::TCURVE;
+       else if ( aComment == "TABLE" ) 
+         aVISUType = VISU::TTABLE;
+       else if ( aComment == "CONTAINER" ) 
+         aVISUType = VISU::TCONTAINER;
+       else if ( aComment == "MESH" ) 
+         aVISUType = VISU::TMESH;
+       else if ( aComment == "SCALARMAP" ) 
+         aVISUType = VISU::TSCALARMAP;
+       else if ( aComment == "PRSMERGER" ) 
+         aVISUType = VISU::TSCALARMAP;
+       else if ( aComment == "ISOSURFACE" ) 
+         aVISUType = VISU::TISOSURFACE;
+       else if ( aComment == "DEFORMEDSHAPE" ) 
+         aVISUType = VISU::TDEFORMEDSHAPE;
+       else if ( aComment == "SCALARMAPONDEFORMEDSHAPE" ) 
+         aVISUType = VISU::TSCALARMAPONDEFORMEDSHAPE;
+       else if ( aComment == "GAUSSPOINTS" ) 
+         aVISUType = VISU::TGAUSSPOINTS;
+       else if ( aComment == "PLOT3D" ) 
+         aVISUType = VISU::TPLOT3D;
+       else if ( aComment == "CUTPLANES" ) 
+         aVISUType = VISU::TCUTPLANES;
+       else if ( aComment == "CUTLINES" ) 
+         aVISUType = VISU::TCUTLINES;
+       else if ( aComment == "VECTORS" ) 
+         aVISUType = VISU::TVECTORS;
+       else if ( aComment == "STREAMLINES" ) 
+         aVISUType = VISU::TSTREAMLINES;
+       else if ( aComment == "VISUGEN" ) 
+         aVISUType = VISU::TVISUGEN;
+       else if ( aComment == "VIEWMANAGER" ) 
+         aVISUType = VISU::TVIEWMANAGER;
+       else if ( aComment == "RESULT" ) 
+         aVISUType = VISU::TRESULT;
+       else if ( aComment == "XYPLOT" ) 
+         aVISUType = VISU::TXYPLOT;
+       else if ( aComment == "TABLEVIEW" ) 
+         aVISUType = VISU::TTABLEVIEW;
+       else if ( aComment == "VIEW3D" ) 
+         aVISUType = VISU::TVIEW3D;
+       else if ( aComment == "GAUSSVIEW" ) 
+         aVISUType = VISU::TGAUSSVIEW;
+       else if ( aComment == "ENTITY" ) 
+         aVISUType = VISU::TENTITY;
+       else if ( aComment == "FAMILY" ) 
+         aVISUType = VISU::TFAMILY;
+       else if ( aComment == "PART" ) 
+         aVISUType = VISU::TPART; // MULTIPR
+       else if ( aComment == "GROUP" ) 
+         aVISUType = VISU::TGROUP;
+       else if ( aComment == "FIELD" ) 
+         aVISUType = VISU::TFIELD;
+       else if ( aComment == "TIMESTAMP" ) 
+         aVISUType = VISU::TTIMESTAMP;
+       else if ( aComment == "ANIMATION" ) 
+         aVISUType = VISU::TANIMATION;
+       else if ( aComment == "ALL" ) 
+         aVISUType = VISU::TALL;
+       else
+         INFOS("Error : Unknown type of VISU object!");
+      }
+      if(aType != QString::number(aVISUType))
+       aString.replace( QString("myType=") + aType + ";",
+                        QString("myType=") + QString::number(aVISUType) + ";");
+    }
+
+    if ( aComment == "PRSMERGER" )
+      aString.replace( "myComment=PRSMERGER", "myComment=SCALARMAP" );
+
+    return aString.latin1();
+  }
+
   void 
   Storable
   ::StrToMap(const QString& theStr, 
@@ -189,17 +283,18 @@ namespace VISU{
           const std::string& theLocalPersistentID)
   {
     try{
-      QString strIn( theLocalPersistentID.c_str() );
-      TRestoringMap aMap;
-      StrToMap(strIn,aMap);
-      bool isExist;
-      QString aComment = VISU::Storable::FindValue(aMap,"myComment",&isExist);
-      if ( isExist ) {
+      QString aString( CorrectPersistentString( theLocalPersistentID ) );
+      TRestoringMap aRestoringMap;
+      StrToMap(aString, aRestoringMap);
+      bool anIsExists;
+      QString aComment = VISU::Storable::FindValue(aRestoringMap, "myComment", &anIsExists);
+      if ( anIsExists ) {
        TCallbackMap::const_iterator anIter = VisuStoreMap.find(aComment.latin1());
        if(MYDEBUG) MESSAGE("Storable::Create - "<<aComment.latin1()<<" "<<(anIter != VisuStoreMap.end()));
        if(anIter == VisuStoreMap.end()) 
          return NULL;
-       return (anIter->second)(theSObject, thePrefix, aMap);
+       TStorableEngine aStorableEngine = anIter->second;
+       return aStorableEngine(theSObject, thePrefix, aRestoringMap);
       }
     }catch(std::exception& exc){
       INFOS("Follow exception was occured :\n"<<exc.what());
index 0f7b962d78a82094c41e620c0da07791122b4a2f..7d365a3179786f39196d871c4c67ca7b256880b7 100644 (file)
@@ -136,6 +136,10 @@ namespace VISU
                                         const TRestoringMap& theMap);
     typedef std::map<std::string,TStorableEngine> TCallbackMap;
 
+    static 
+    std::string
+    CorrectPersistentString(const std::string& thePersistentString);
+
     static 
     void
     Registry(const std::string& theComment, 
index 9927e98ba95a0ec035582506ef7bc8927e39c5db..5f543b345fbe75ec895b50d80c8e5db497fc6d6f 100644 (file)
@@ -251,7 +251,7 @@ VISU::ColoredPrs3dHolder_i
     if(ColoredPrs3dCache_i* aCache = ColoredPrs3dCache_i::GetInstance_i(aStudy))
       if(ColoredPrs3dHolder_i* aHolder = new ColoredPrs3dHolder_i(*aCache)){
        // To postpone restoring of the device
-       aColoredPrs3d->SaveRestoringState(aStudy, theMap); 
+       aColoredPrs3d->SaveRestoringState(theSObject, theMap); 
        CORBA::String_var anEntry = theSObject->GetID();
        aCache->RegisterInHolder(aColoredPrs3d, anEntry.in());
        return aHolder;
index 351952dc8bcbd2f99439f26232e1f2b72312e5ea..8824261fc231f67b7b9e98b5e4e01253bd974895 100644 (file)
@@ -79,7 +79,8 @@ ColoredPrs3d_i(EPublishInStudyMode thePublishInStudyMode) :
   myPublishInStudyMode(thePublishInStudyMode),
   myIsTimeStampFixed(thePublishInStudyMode == EPublishUnderTimeStamp),
   myColoredPL(NULL),
-  myIsFixedRange(false)
+  myIsFixedRange(false),
+  myIsRestored(true)
 {}
 
 //---------------------------------------------------------------
@@ -1128,13 +1129,38 @@ VISU::ColoredPrs3d_i
   return this;
 }
 
+
+//----------------------------------------------------------------------------
+void
+VISU::ColoredPrs3d_i
+::SaveRestoringState(SALOMEDS::SObject_ptr theSObject,
+                    const Storable::TRestoringMap& theMap)
+{
+  myRestoringSObject = SALOMEDS::SObject::_duplicate(theSObject);
+  myRestoringMap = theMap;
+  myIsRestored = false;
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU::ColoredPrs3d_i
+::InitFromRestoringState()
+{
+  if(!myIsRestored){
+    Restore(myRestoringSObject, myRestoringMap);
+    myIsRestored = true;
+  }
+}
+
+
 //----------------------------------------------------------------------------
 VISU::Storable* 
 VISU::ColoredPrs3d_i
-::Restore(SALOMEDS::Study_ptr theStudy,
+::Restore(SALOMEDS::SObject_ptr theSObject,
          const Storable::TRestoringMap& theMap)
 {
-  if(!TSuperClass::Restore(theStudy, theMap))
+  if(!TSuperClass::Restore(theSObject, theMap))
     return NULL;
 
   SetEntity((VISU::Entity)VISU::Storable::FindValue(theMap,"myEntity").toInt());
index 6d242070100a94d60c8d44dc66836d6fed7cd09d..a255c6a65536385d0620764e5d62c197d4230cd3 100644 (file)
@@ -237,6 +237,15 @@ namespace VISU
     std::string
     GetHolderEntry();
 
+    //! To keep restoring params till the explicit Restore() call
+    void
+    SaveRestoringState(SALOMEDS::SObject_ptr theSObject,
+                      const Storable::TRestoringMap& theMap);
+
+    //! To restore the presentation according to the saved state
+    void 
+    InitFromRestoringState();
+
     //----------------------------------------------------------------------------
     virtual 
     const char* 
@@ -259,7 +268,7 @@ namespace VISU
     */
     virtual 
     Storable* 
-    Restore(SALOMEDS::Study_ptr theStudy,
+    Restore(SALOMEDS::SObject_ptr theSObject,
            const Storable::TRestoringMap& theMap);
 
     /*!
@@ -445,6 +454,10 @@ namespace VISU
     GetActorEntry();
 
   private:
+    bool myIsRestored;
+    Storable::TRestoringMap myRestoringMap;
+    SALOMEDS::SObject_var myRestoringSObject;
+
     // Decalare basic input parameters
     VISU::Entity myEntity;
     VISU::Entity myPreviousEntity;
@@ -494,8 +507,7 @@ namespace VISU
          const Storable::TRestoringMap& theMap)
   {
     TColoredPrs3d* aColoredPrs3d = new TColoredPrs3d(ColoredPrs3d_i::EDoNotPublish);
-    SALOMEDS::Study_var aStudy = theSObject->GetStudy();
-    return aColoredPrs3d->Restore(aStudy, theMap);
+    return aColoredPrs3d->Restore(theSObject, theMap);
   }
   //----------------------------------------------------------------------------
 }
index e634111b500103ff744d2fdd18beb1b4131e5bc3..ede2fea61989a2b470b4545123e5d96debe4c8f4 100644 (file)
@@ -147,10 +147,10 @@ VISU::CutLines_i
 //---------------------------------------------------------------
 VISU::Storable* 
 VISU::CutLines_i
-::Restore(SALOMEDS::Study_ptr theStudy,
+::Restore(SALOMEDS::SObject_ptr theSObject,
          const Storable::TRestoringMap& theMap)
 {
-  if(!TSuperClass::Restore(theStudy, theMap))
+  if(!TSuperClass::Restore(theSObject, theMap))
     return NULL;
 
   SetNbLines(VISU::Storable::FindValue(theMap,"myNbLines").toInt());
index 21a97641498e7b8d5318f81a9c167de665053ed5..ab01a4f9aef41b6ce117ea664f5cc95771df1f67 100644 (file)
@@ -238,7 +238,7 @@ namespace VISU
     //! Extends VISU_ColoredPrs3d_i::Restore
     virtual
     Storable* 
-    Restore(SALOMEDS::Study_ptr theStudy,
+    Restore(SALOMEDS::SObject_ptr theSObject,
            const Storable::TRestoringMap& theMap);
 
     virtual 
index 4d9583d22f399c1651151f1712b147369e4054fb..f899ee38ad904b05b07f9a6c0d56ec2c6ee0b0ee 100644 (file)
@@ -112,10 +112,10 @@ VISU::CutPlanes_i
 //----------------------------------------------------------------------------
 VISU::Storable* 
 VISU::CutPlanes_i
-::Restore(SALOMEDS::Study_ptr theStudy,
+::Restore(SALOMEDS::SObject_ptr theSObject,
          const Storable::TRestoringMap& theMap)
 {
-  if(!TSuperClass::Restore(theStudy, theMap))
+  if(!TSuperClass::Restore(theSObject, theMap))
     return NULL;
 
   SetNbPlanes(VISU::Storable::FindValue(theMap,"myNbPlanes").toInt());
index 6dc9c870c17b5983295f4727b65f4def7aeb7989..9386f9f3ea241aef07e830b6d8aeeb9dbcdf86ab 100644 (file)
@@ -154,7 +154,7 @@ namespace VISU
     //! Redefines VISU_ColoredPrs3d_i::Restore
     virtual
     Storable* 
-    Restore(SALOMEDS::Study_ptr theStudy,
+    Restore(SALOMEDS::SObject_ptr theSObject,
            const Storable::TRestoringMap& theMap);
 
     //! Redefines VISU_ColoredPrs3d_i::CreateActor
index b942c81ae3a5dd0cec6b21c37ece6bdee8bd3395..805cbd606732885627c80f7a1baa937a63fd6fab 100644 (file)
@@ -156,10 +156,10 @@ VISU::DeformedShape_i
 //---------------------------------------------------------------
 VISU::Storable* 
 VISU::DeformedShape_i
-::Restore(SALOMEDS::Study_ptr theStudy,
+::Restore(SALOMEDS::SObject_ptr theSObject,
          const Storable::TRestoringMap& theMap)
 {
-  if(!TSuperClass::Restore(theStudy, theMap))
+  if(!TSuperClass::Restore(theSObject, theMap))
     return NULL;
 
   SetScale(VISU::Storable::FindValue(theMap,"myFactor").toDouble());
index e433be3e4cad0af292b9a23fbd9a141cb5281d9c..b5f877e198158ee3a5715928b36306293e822e6b 100644 (file)
@@ -144,7 +144,7 @@ namespace VISU
 
     virtual
     Storable* 
-    Restore(SALOMEDS::Study_ptr theStudy,
+    Restore(SALOMEDS::SObject_ptr theSObject,
            const Storable::TRestoringMap& theMap);
 
     virtual
index b58064b3b65e811b548e6fef5e689bd7c9cf64de..a9a19426d6dbae2d8218a2bcf8880d53cc3f0bfd 100644 (file)
@@ -253,10 +253,10 @@ VISU::GaussPoints_i
 //----------------------------------------------------------------------------
 VISU::Storable* 
 VISU::GaussPoints_i
-::Restore(SALOMEDS::Study_ptr theStudy,
+::Restore(SALOMEDS::SObject_ptr theSObject,
          const Storable::TRestoringMap& theMap)
 {
-  if(!TSuperClass::Restore(theStudy, theMap))
+  if(!TSuperClass::Restore(theSObject, theMap))
     return NULL;
 
   SetIsActiveLocalScalarBar(Storable::FindValue(theMap,"myIsActiveLocalScalarBar").toInt());
index 5b79bf6078f00993a6164ec688620db4dfee2ac8..b4b150ece0d70d0cb71e963afed74095656f4e4d 100644 (file)
@@ -346,7 +346,7 @@ namespace VISU
 
     virtual 
     Storable* 
-    Restore(SALOMEDS::Study_ptr theStudy,
+    Restore(SALOMEDS::SObject_ptr theSObject,
            const Storable::TRestoringMap& theMap);
 
     //----------------------------------------------------------------------------
index 93cf423c4d9d4f663ac7c0147cf7d4c12c3ab705..8b152b688a8ae8733de2b2f3158ba8cfa9dbce87 100644 (file)
@@ -67,7 +67,6 @@
 // QT Includes
 #include <qdir.h>
 #include <qfileinfo.h>
-#include <qregexp.h>
 
 // VTK Includes
 #include <vtkRenderer.h>
@@ -283,57 +282,9 @@ namespace VISU
     if ( isAttrStringFound || theSObject->FindAttribute(anAttr, "AttributeString") ) {
       SALOMEDS::AttributeString_var aAttComment = SALOMEDS::AttributeString::_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("PRSMERGER")) ) 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("PART")) ) aVISUType = VISU::TPART; // MULTIPR
-             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::String_var aValue = aAttComment->Value();
+       std::string aString = Storable::CorrectPersistentString(aValue.in());
+       aAttComment->SetValue( aString.c_str() );
       }
     }
   }
index c152e8daf621c2e4b98ca9bd1d329598209b843d..769e48de3c4d5994eee0f4d0f6028c8f27f4f7e7 100644 (file)
@@ -111,10 +111,10 @@ VISU::IsoSurfaces_i
 //---------------------------------------------------------------
 VISU::Storable* 
 VISU::IsoSurfaces_i
-::Restore(SALOMEDS::Study_ptr theStudy,
+::Restore(SALOMEDS::SObject_ptr theSObject,
          const Storable::TRestoringMap& theMap)
 {
-  if(!TSuperClass::Restore(theStudy, theMap))
+  if(!TSuperClass::Restore(theSObject, theMap))
     return NULL;
 
   SetNbSurfaces(VISU::Storable::FindValue(theMap,"myNbSurface").toInt());
index 63dc9347ccf9f8ce7049cffb585c7b30a47d1aad..7046e99713ffb03baea65c8ac078e828755bba8b 100644 (file)
@@ -139,7 +139,7 @@ namespace VISU
 
     virtual
     Storable* 
-    Restore(SALOMEDS::Study_ptr theStudy,
+    Restore(SALOMEDS::SObject_ptr theSObject,
            const Storable::TRestoringMap& theMap);
 
     virtual 
index 45669d75b108cd6fba37772f8d4134c851e289f9..0c27e8c61128ee386658688073d551eb81a9e9eb 100644 (file)
@@ -252,13 +252,14 @@ VISU::Mesh_i
 
     myMeshPL->SetUnstructuredGridIDMapper(anIDMapper);
 
+    string anEntry = GetCResult()->GetEntry(aComment.latin1());
+    if(anEntry == "") 
+      throw std::runtime_error("Mesh_i::Build - anEntry was not found !!!");
+    SALOMEDS::SObject_var aSObject = GetStudyDocument()->FindObjectID(anEntry.c_str());
+
     if(!theRestoring) { //Setting IOR on the label
       myMeshPL->Init();
       string aResultEntry = GetCResult()->GetEntry();
-      string anEntry = GetCResult()->GetEntry(aComment.latin1());
-      if(anEntry == "") 
-       throw std::runtime_error("Mesh_i::Build - anEntry was not found !!!");
-      SALOMEDS::SObject_var aSObject = GetStudyDocument()->FindObjectID(anEntry.c_str());
       SALOMEDS::StudyBuilder_var aStudyBuilder = GetStudyDocument()->NewBuilder();
       SALOMEDS::GenericAttribute_var anAttr = aStudyBuilder->FindOrCreateAttribute(aSObject,"AttributeIOR");
       SALOMEDS::AttributeIOR_var anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
@@ -270,7 +271,7 @@ VISU::Mesh_i
     SALOMEDS::GenericAttribute_var anAttr;
     SALOMEDS::AttributePixMap_var  aPixmap;
     
-    anAttr  = aStudyBuilder->FindOrCreateAttribute(GetSObject(), "AttributePixMap");
+    anAttr  = aStudyBuilder->FindOrCreateAttribute(aSObject, "AttributePixMap");
     aPixmap = SALOMEDS::AttributePixMap::_narrow( anAttr );
     aPixmap->SetPixMap("ICON_TREE_MESH");
 
@@ -433,10 +434,10 @@ VISU::Mesh_i
 //----------------------------------------------------------------------------
 VISU::Storable* 
 VISU::Mesh_i
-::Restore(SALOMEDS::Study_ptr theStudy,
+::Restore(SALOMEDS::SObject_ptr theSObject,
          const Storable::TRestoringMap& theMap)
 {
-  if(!TSuperClass::Restore(theStudy, theMap))
+  if(!TSuperClass::Restore(theSObject, theMap))
     return NULL;
 
   myEntity = VISU::Storable::FindValue(theMap,"myEntity").toInt();//jfa IPAL9284
@@ -468,8 +469,7 @@ VISU::Mesh_i
          const Storable::TRestoringMap& theMap)
 {
   Mesh_i* aMesh = new Mesh_i();
-  SALOMEDS::Study_var aStudy = theSObject->GetStudy();
-  return aMesh->Restore(aStudy, theMap);
+  return aMesh->Restore(theSObject, theMap);
 }
 
 
index 27f3cc2045adb69515186e2ef12ed359a0d1ebd1..a6b452211d18278f78f97be49a4e514c781c661f 100644 (file)
@@ -162,7 +162,7 @@ namespace VISU
 
     virtual
     Storable* 
-    Restore(SALOMEDS::Study_ptr theStudy,
+    Restore(SALOMEDS::SObject_ptr theSObject,
            const Storable::TRestoringMap& theMap);
 
     static 
index 34ac5d2a03e5855532f509c24dbabb230c2e33aa..cf2b8ebba293c62fbe84c31903eae2adf9fb12a9 100644 (file)
@@ -109,10 +109,10 @@ VISU::Plot3D_i
 //---------------------------------------------------------------
 VISU::Storable* 
 VISU::Plot3D_i
-::Restore(SALOMEDS::Study_ptr theStudy,
+::Restore(SALOMEDS::SObject_ptr theSObject,
          const Storable::TRestoringMap& theMap)
 {
-  if(!TSuperClass::Restore(theStudy, theMap))
+  if(!TSuperClass::Restore(theSObject, theMap))
     return NULL;
 
   SetOrientation(VISU::Plot3D::Orientation(VISU::Storable::FindValue(theMap,"myBasePlane").toInt()),
index fb6144955247bc61bef50a20a49dac9f3372bcfd..de7ffb09e13ec4f5c9c4695a5646af91b069580a 100644 (file)
@@ -148,7 +148,7 @@ namespace VISU
 
     virtual
     Storable* 
-    Restore(SALOMEDS::Study_ptr theStudy,
+    Restore(SALOMEDS::SObject_ptr theSObject,
            const Storable::TRestoringMap& theMap);
 
     virtual 
index afb7eee5dd0cb1e8304b27702023050167fe52b6..f1e8d226e735d6d592f9a0aa66c00aa9b362ecdf 100644 (file)
@@ -51,8 +51,7 @@ VISU::Prs3d_i
 ::Prs3d_i() :
   PrsObject_i(SALOMEDS::Study::_nil()),
   myActorCollection(vtkActorCollection::New()),
-  myIsActiveSatate(true),
-  myIsRestored(true)
+  myIsActiveSatate(true)
 {
   if(MYDEBUG) MESSAGE("Prs3d_i::Prs3d_i - this = "<<this);
   myOffset[0] = myOffset[1] = myOffset[2] = 0;
@@ -272,11 +271,28 @@ VISU::Prs3d_i
 //----------------------------------------------------------------------------
 VISU::Storable* 
 VISU::Prs3d_i
-::Restore(SALOMEDS::Study_ptr theStudy,
+::Restore(SALOMEDS::SObject_ptr theSObject,
          const Storable::TRestoringMap& theMap)
 {
-  SetStudyDocument(theStudy);
-  SetResultEntry(VISU::Storable::FindValue(theMap,"myResultEntry").latin1());
+  SALOMEDS::Study_var aStudy = theSObject->GetStudy();
+  SetStudyDocument(aStudy);
+
+  bool anIsExists = false;
+  QString aResultEntry = VISU::Storable::FindValue(theMap,"myResultEntry", &anIsExists);
+  if(!anIsExists){
+    SALOMEDS::SObject_var aSObject = SALOMEDS::SObject::_duplicate(theSObject);
+    for(; aSObject->Depth() > 2 && !aResultEntry.isEmpty(); aSObject = aSObject->GetFather()){
+      CORBA::Object_var anObject = VISU::SObjectToObject(aSObject);
+      if(CORBA::is_nil(anObject))
+       continue;
+      VISU::Result_var aResult = VISU::Result::_narrow(anObject);
+      if(CORBA::is_nil(aResult))
+       continue;
+      CORBA::String_var anEntry = aSObject->GetID();
+      aResultEntry = anEntry.in();
+    }
+  }
+  SetResultEntry(aResultEntry.latin1());
   if(!GetCResult())
     return NULL;
 
@@ -289,28 +305,6 @@ VISU::Prs3d_i
   return this;
 }
 
-//----------------------------------------------------------------------------
-void
-VISU::Prs3d_i
-::SaveRestoringState(SALOMEDS::Study_ptr theStudy,
-                    const Storable::TRestoringMap& theMap)
-{
-  myRestoringStudy = SALOMEDS::Study::_duplicate(theStudy);
-  myRestoringMap = theMap;
-  myIsRestored = false;
-}
-
-//----------------------------------------------------------------------------
-void
-VISU::Prs3d_i
-::InitFromRestoringState()
-{
-  if(!myIsRestored){
-    Restore(myRestoringStudy, myRestoringMap);
-    myIsRestored = true;
-  }
-}
-
 //----------------------------------------------------------------------------
 void
 VISU::Prs3d_i
index 6ce9a3c9c130bf0956893ab766c6236312d30e59..6419d111df1bd8f63e031e60a39a7d24e2fc58b2 100644 (file)
@@ -140,18 +140,9 @@ namespace VISU
     //! To restore paramters of the instance from Storable::TRestoringMap
     virtual
     Storable* 
-    Restore(SALOMEDS::Study_ptr theStudy,
+    Restore(SALOMEDS::SObject_ptr theSObject,
            const Storable::TRestoringMap& theMap);
 
-    //! To keep restoring params till the explicit Restore() call
-    void
-    SaveRestoringState(SALOMEDS::Study_ptr theStudy,
-                      const Storable::TRestoringMap& theMap);
-
-    //! To restore the presentation according to the saved state
-    void 
-    InitFromRestoringState();
-
     //----------------------------------------------------------------------------
     //! Get corresponding SALOMEDS::SObject
     virtual
@@ -319,10 +310,6 @@ namespace VISU
     GetActorEntry();
 
   private:
-    bool myIsRestored;
-    SALOMEDS::Study_var myRestoringStudy;
-    Storable::TRestoringMap myRestoringMap;
-
     void
     SetResultEntry(const std::string& theResultEntry);
 
index 3046fbcde707cff31f319e742a8913685616e54e..bf78b111cc441458c3943b7f94a86afd11a86e67 100644 (file)
@@ -157,10 +157,10 @@ VISU::ScalarMapOnDeformedShape_i
 //---------------------------------------------------------------
 VISU::Storable*
 VISU::ScalarMapOnDeformedShape_i
-::Restore(SALOMEDS::Study_ptr theStudy,
+::Restore(SALOMEDS::SObject_ptr theSObject,
          const Storable::TRestoringMap& theMap)
 {
-  if(!TSuperClass::Restore(theStudy, theMap))
+  if(!TSuperClass::Restore(theSObject, theMap))
     return NULL;
 
   QString aMeshName = VISU::Storable::FindValue(theMap,"myScalarMeshName");
index 4c36ea89eb887ef31299959c8b0c447a7fa45cc4..8a9d34ed89ba8d6f1b5385a24adc5548fb11f30b 100644 (file)
@@ -120,7 +120,7 @@ namespace VISU
     //! Redefines VISU_ColoredPrs3d_i::Restore
     virtual
     Storable* 
-    Restore(SALOMEDS::Study_ptr theStudy,
+    Restore(SALOMEDS::SObject_ptr theSObject,
            const Storable::TRestoringMap& theMap);
     
     static const std::string myComment;
index 9ce78f1c4cd45cdfd7dd0aa6b8ed4d05291821c7..5d621843e9c0ee033a0c0ccb66b9118baba39b07 100644 (file)
@@ -242,10 +242,10 @@ VISU::ScalarMap_i
 //----------------------------------------------------------------------------
 VISU::Storable* 
 VISU::ScalarMap_i
-::Restore(SALOMEDS::Study_ptr theStudy,
+::Restore(SALOMEDS::SObject_ptr theSObject,
          const Storable::TRestoringMap& theMap)
 {
-  if(!TSuperClass::Restore(theStudy, theMap))
+  if(!TSuperClass::Restore(theSObject, theMap))
     return NULL;
 
   SetScaling(VISU::Scaling(VISU::Storable::FindValue(theMap,"myScaling").toInt()));
index 6cbd2ace178671095e42132acecf1cd2d4087a2b..bdefaf637b8ec5e84a9dfa98e6071d43d56f8d5f 100644 (file)
@@ -177,7 +177,7 @@ namespace VISU
 
     virtual 
     Storable* 
-    Restore(SALOMEDS::Study_ptr theStudy,
+    Restore(SALOMEDS::SObject_ptr theSObject,
            const Storable::TRestoringMap& theMap);
 
     virtual
index 5658bd562ed4896658fac6cfcd730afbaf8940b8..86f4cbe045c3594ae1fd340cbb2e97433a49fda8 100644 (file)
@@ -151,10 +151,10 @@ VISU::StreamLines_i
 //---------------------------------------------------------------
 VISU::Storable* 
 VISU::StreamLines_i
-::Restore(SALOMEDS::Study_ptr theStudy,
+::Restore(SALOMEDS::SObject_ptr theSObject,
          const Storable::TRestoringMap& theMap)
 {
-  if(!TSuperClass::Restore(theStudy, theMap))
+  if(!TSuperClass::Restore(theSObject, theMap))
     return NULL;
 
   double anIntegrationStep = VISU::Storable::FindValue(theMap,"myIntegrationStep").toDouble();
index 2b6635ba8defecff4385a598aa77e9c5e0a0827e..f0cee7572d828fe0108b5d10afdf90aa9acbe51f 100644 (file)
@@ -169,7 +169,7 @@ namespace VISU
     //! Extends VISU_ColoredPrs3d_i::Restore
     virtual 
     Storable* 
-    Restore(SALOMEDS::Study_ptr theStudy,
+    Restore(SALOMEDS::SObject_ptr theSObject,
            const Storable::TRestoringMap& theMap);
 
     //! Extends VISU_ColoredPrs3d_i::Update
index 73c609b38169781ff06568b09d03933d78d60ea1..be2046f8ee3635a9482b7a723103fea6df302a9d 100644 (file)
@@ -1690,7 +1690,8 @@ void VISU_TimeAnimation::restoreFromStudy(_PTR(SObject) theField)
       continue;
     generatePresentations(getNbFields()-1);
 
-    if (!aPrsObj->FindAttribute(anAttr, "AttributeString")) continue;
+    if (!aPrsObj->FindAttribute(anAttr, "AttributeString"))
+      continue;
     _PTR(AttributeString) aPrsComment (anAttr);
     string aPrsComm = aPrsComment->Value();
     if (aPrsComm.length() > 0) {
@@ -1698,7 +1699,7 @@ void VISU_TimeAnimation::restoreFromStudy(_PTR(SObject) theField)
       VISU::Storable::TRestoringMap aPrsMap;
       VISU::Storable::StrToMap(strPrsIn,aPrsMap);
 
-      aData.myPrs[0]->Restore(VISU::GetDSStudy(myStudy), aPrsMap);
+      aData.myPrs[0]->Restore(VISU::GetSObject(aPrsObj), aPrsMap);
     }
     aData.myPrs[0]->GetOffset(aData.myOffset);
     for (int i = 1; i < aData.myNbFrames; i++) {
index caee0703274236d185ac884ff0ed9fe1f3464015..8434c0134f84567f2327af1355c359cd38d0693b 100644 (file)
@@ -160,10 +160,10 @@ VISU::Vectors_i
 //---------------------------------------------------------------
 VISU::Storable* 
 VISU::Vectors_i
-::Restore(SALOMEDS::Study_ptr theStudy,
+::Restore(SALOMEDS::SObject_ptr theSObject,
          const Storable::TRestoringMap& theMap)
 {
-  if(!TSuperClass::Restore(theStudy, theMap))
+  if(!TSuperClass::Restore(theSObject, theMap))
     return NULL;
 
   SetGlyphType(VISU::Vectors::GlyphType(VISU::Storable::FindValue(theMap,"myTypeGlyph").toInt()));
index 083452cc7e0ac6160cd9549b863e8cb2e40a08f3..ef4b9d927b02b9679152e8486d45102725f05ac7 100644 (file)
@@ -137,7 +137,7 @@ namespace VISU
     //! Redefines VISU_ColoredPrs3d_i::Restore
     virtual
     Storable* 
-    Restore(SALOMEDS::Study_ptr theStudy,
+    Restore(SALOMEDS::SObject_ptr theSObject,
            const Storable::TRestoringMap& theMap);
 
     static const std::string myComment;