]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
To implement persistent for the Holder objects
authorapo <apo@opencascade.com>
Thu, 21 Dec 2006 16:16:03 +0000 (16:16 +0000)
committerapo <apo@opencascade.com>
Thu, 21 Dec 2006 16:16:03 +0000 (16:16 +0000)
37 files changed:
src/VISU_I/Makefile.in
src/VISU_I/VISUConfig.cc
src/VISU_I/VISU_ColoredPrs3dCache_i.cc
src/VISU_I/VISU_ColoredPrs3dCache_i.hh
src/VISU_I/VISU_ColoredPrs3dHolder_i.cc
src/VISU_I/VISU_ColoredPrs3dHolder_i.hh
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_PrsObject_i.hh
src/VISU_I/VISU_Result_i.cc
src/VISU_I/VISU_Result_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 5c427a1c3eab60c932d905771ead813946648346..f05f455fcf0c44b22f5b94090070d646bfc4a296 100644 (file)
@@ -105,8 +105,6 @@ EXPORT_HEADERS = \
        VISU_View_i.hh \
        VISU_TimeAnimation.h \
        VISU_ScalarMapOnDeformedShape_i.hh \
-       VISU_ColoredPrs3dCache_i.hh \
-       VISU_ColoredPrs3dHolder_i.hh \
        VISU_ColoredPrs3dFactory.hh \
        SALOME_GenericObjPointer.hh
 
index d622e56b0934afdf9388a1bb85d4990b7cdf3876..81e7492d22f49042a3f2a84d141e7c6daae5158a 100644 (file)
@@ -262,19 +262,21 @@ namespace VISU{
   SObjectToObject(SALOMEDS::SObject_ptr theSObject)
   {
     SALOMEDS::GenericAttribute_var anAttr;
-    CORBA::Object_var anObj;
+    CORBA::Object_var anObject;
+    if(CORBA::is_nil(theSObject))
+      return anObject;
     try{
       if(theSObject->FindAttribute(anAttr, "AttributeIOR")){
        SALOMEDS::AttributeIOR_var anIOR  = SALOMEDS::AttributeIOR::_narrow(anAttr);
        CORBA::String_var aValue = anIOR->Value();
        CORBA::ORB_ptr anORB = Base_i::GetORB();
        if(strcmp(aValue,"") != 0)
-         anObj = anORB->string_to_object(aValue);
+         anObject = anORB->string_to_object(aValue);
       }
     }catch(...){
       INFOS("SObjectToObject - Unknown exception was occured!!!");
     }
-    return anObj;
+    return anObject;
   }
 
   //===========================================================================
@@ -282,19 +284,21 @@ namespace VISU{
   ClientSObjectToObject(_PTR(SObject) theSObject)
   {
     _PTR(GenericAttribute) anAttr;
-    CORBA::Object_var anObj;
+    CORBA::Object_var anObject;
+    if(!theSObject)
+      return anObject;
     try{
       if(theSObject->FindAttribute(anAttr, "AttributeIOR")){
        _PTR(AttributeIOR) anIOR  = anAttr;
        CORBA::String_var aValue = anIOR->Value().c_str();
        CORBA::ORB_ptr anORB = Base_i::GetORB();
        if(strcmp(aValue,"") != 0)
-         anObj = anORB->string_to_object(aValue);
+         anObject = anORB->string_to_object(aValue);
       }
     }catch(...){
       INFOS("ClientSObjectToObject - Unknown exception was occured!!!");
     }
-    return anObj;
+    return anObject;
   }
 
 
index ea4f40c65ecffd921b045ef49f420a0bc139e791..79e780fe7a76ed8f4c356058a7c5c1be3694fcdc 100644 (file)
@@ -335,12 +335,12 @@ VISU::ColoredPrs3dCache_i
 {
   CORBA::Float aRequiredMemory = 0.0;
   if(IsPossible(theType, theInput, aRequiredMemory, "")){
-    VISU::ColoredPrs3dHolder_i* aHolder = new VISU::ColoredPrs3dHolder_i(theType, theInput, *this);
+    VISU::ColoredPrs3dHolder_i* aHolder = new VISU::ColoredPrs3dHolder_i(*this);
     VISU::ColoredPrs3d_i* aColoredPrs3d = CreateColoredPrs3d(theType, theInput);
     std::string aComment = std::string("myComment=") + aColoredPrs3d->GetComment();
     std::string aName = aColoredPrs3d->GenerateName().latin1();
     aHolder->PublishInStudy(aName, aComment);
-    RegisterInHolder(aColoredPrs3d, aHolder);
+    RegisterInHolder(aColoredPrs3d, aHolder->GetEntry());
     if( aRequiredMemory > 1.0 / VTK_LARGE_FLOAT )
       ClearMemory( aRequiredMemory, aHolder->GetEntry() );
     return aHolder->_this();
@@ -428,13 +428,13 @@ VISU::ColoredPrs3dCache_i
 VISU::ColoredPrs3d_i*
 VISU::ColoredPrs3dCache_i
 ::RegisterInHolder(VISU::ColoredPrs3d_i* thePrs3d,
-                  VISU::ColoredPrs3dHolder_i* theHolder)
+                  const std::string& theHolderEntry)
 {
   TPrs3dPtr aPrs3d( thePrs3d );
   aPrs3d->Destroy();
 
-  aPrs3d->SetHolderEntry( theHolder->GetEntry() );
-  GetLastVisitedPrsList(theHolder).push_front(aPrs3d);  
+  aPrs3d->SetHolderEntry( theHolderEntry );
+  myHolderMap[theHolderEntry].push_front(aPrs3d);  
   return thePrs3d;
 }
 
@@ -446,7 +446,8 @@ VISU::ColoredPrs3dCache_i
            VISU::ColoredPrs3dHolder::BasicInput theInput,
            VISU::ColoredPrs3dHolder_i* theHolder)
 {
-  return RegisterInHolder(CreateColoredPrs3d(theType, theInput), theHolder);
+  return RegisterInHolder(CreateColoredPrs3d(theType, theInput), 
+                         theHolder->GetEntry());
 }
 
 
index 9e9ee833b0d249c2e8b234b24f333b683f486d90..7c3271fe1d30e7c65828367be5fb6723f14c5f6a 100644 (file)
@@ -37,7 +37,29 @@ namespace VISU
   class ColoredPrs3d_i;
   class ColoredPrs3dHolder_i;
 
-  typedef SALOME::GenericObjPtr<VISU::ColoredPrs3d_i> TPrs3dPtr;
+  struct TPrs3dPtr: SALOME::GenericObjPtr<ColoredPrs3d_i>
+  {
+    typedef SALOME::GenericObjPtr<ColoredPrs3d_i> TSuperClass;
+    // Description:
+    // Initialize smart pointer to given object.
+    TPrs3dPtr(ColoredPrs3d_i* r): TSuperClass(r) {}
+
+    // Description:
+    // Initialize smart pointer with a new reference to the same object
+    // referenced by given smart pointer.
+    TPrs3dPtr(const SALOME::GenericObjPtrBase& r): TSuperClass(r) {}
+
+    // Description:
+    // Provides normal pointer target member access using operator ->.
+    ColoredPrs3d_i* operator->() const
+    {
+      ColoredPrs3d_i* aColoredPrs3d = TSuperClass::operator ->();
+      // To implement postponed restoring of the presentation
+      aColoredPrs3d->InitFromRestoringState();
+      return aColoredPrs3d;
+    }
+  };
+
   typedef std::deque<TPrs3dPtr> TLastVisitedPrsList;
 
   typedef std::string THolderEntry;
@@ -148,7 +170,7 @@ namespace VISU
     //! Registers the given ColoredPrs3d instance for the ColoredPrs3dHolder
     VISU::ColoredPrs3d_i*
     RegisterInHolder(VISU::ColoredPrs3d_i* thePrs3d,
-                    VISU::ColoredPrs3dHolder_i* theHolder);
+                    const std::string& theHolderEntry);
 
     //! Creates and registers corresponding ColoredPrs3d instance for the ColoredPrs3dHolder
     VISU::ColoredPrs3d_i*
index 72aab60faf3366c8828c7c5289265682d1fe7b73..afb4a99ad5be61dd8879009c53d0e4500cfb20b5 100644 (file)
@@ -62,9 +62,7 @@ VISU::ColoredPrs3dHolder_i
 
 //----------------------------------------------------------------------------
 VISU::ColoredPrs3dHolder_i
-::ColoredPrs3dHolder_i(VISU::VISUType theType,
-                      VISU::ColoredPrs3dHolder::BasicInput theInput,
-                      VISU::ColoredPrs3dCache_i& theCache) :
+::ColoredPrs3dHolder_i(VISU::ColoredPrs3dCache_i& theCache) :
   PrsObject_i(theCache.GetStudyDocument()),
   myCache(theCache)
 {
@@ -182,21 +180,10 @@ void
 VISU::ColoredPrs3dHolder_i
 ::ToStream(std::ostringstream& theStr) 
 {
-  Storable::DataToStream( theStr, "myType", GetPrsType() );
+  Storable::DataToStream( theStr, "myPrsType", GetPrsType() );
   GetPrs3dDevice()->ToStream(theStr);
 }
 
-//---------------------------------------------------------------
-VISU::Storable*
-VISU::ColoredPrs3dHolder_i
-::Restore(SALOMEDS::SObject_ptr theSObject,
-         const Storable::TRestoringMap& theMap,
-         const string& thePrefix)
-{
-  VISU::ColoredPrs3d_i* aDevice = GetPrs3dDevice();
-  return aDevice->Restore(theMap);
-}
-
 //---------------------------------------------------------------
 VISU::Storable*
 VISU::ColoredPrs3dHolder_i
@@ -204,60 +191,18 @@ VISU::ColoredPrs3dHolder_i
          const string& thePrefix,
          const Storable::TRestoringMap& theMap)
 {
-  /*
-  Storable::TRestoringMap aMap = theMap;
-
-  std::string aResultEntry = VISU::Storable::FindValue(theMap,"myResultEntry");
-  cout << aResultEntry.c_str() << endl;
-
-  SALOMEDS::SObject_var aFather = theSObject->GetFather();
-  SALOMEDS::SObject_var aGrandFather = aFather->GetFather();
-  cout << aGrandFather->GetName() << endl;
-
-  VISU::Result_var aResult;
+  using namespace VISU;
   SALOMEDS::Study_var aStudy = theSObject->GetStudy();
-  SALOMEDS::SObject_var aSObject = aStudy->FindObjectID();
-
-  SALOMEDS::ChildIterator_var anIter = aStudy->NewChildIterator(aGrandFather);
-  for (anIter->InitEx(true); anIter->More(); anIter->Next())
-  {
-    SALOMEDS::SObject_var gotBranch = anIter->Value();
-    CORBA::Object_var anObj = SObjectToObject(gotBranch);
-    if(CORBA::is_nil(anObj))
-      continue;
-
-    aResult = VISU::Result::_narrow(anObj);
-    if(!CORBA::is_nil(aResult))
-      break;
+  VISUType aType = VISUType(Storable::FindValue(theMap,"myPrsType").toInt());
+  if(ColoredPrs3d_i* aColoredPrs3d = CreatePrs3d_i(aType, aStudy, ColoredPrs3d_i::EDoNotPublish)){
+    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); 
+       CORBA::String_var anEntry = theSObject->GetID();
+       aCache->RegisterInHolder(aColoredPrs3d, anEntry.in());
+       return aHolder;
+      }
   }
-
-  if(CORBA::is_nil(aResult))
-    return NULL;
-
-  VISU::ColoredPrs3dHolder::BasicInput anInput;
-  anInput.myResult = aResult;
-  anInput.myMeshName = VISU::Storable::FindValue(theMap,"myMeshName").latin1();
-  anInput.myEntity = (VISU::Entity)VISU::Storable::FindValue(theMap,"myEntity").toInt();
-  anInput.myFieldName = VISU::Storable::FindValue(theMap,"myFieldName").latin1();
-  anInput.myTimeStampNumber = VISU::Storable::FindValue(theMap,"myIteration").toInt();
-
-  VISU_Gen_i* aVisuGen = VISU::Base_i::GetVisuGenImpl();
-  VISU::ColoredPrs3dCache_i* aCache =
-    dynamic_cast<VISU::ColoredPrs3dCache_i*>( VISU::GetServant(aVisuGen->GetColoredPrs3dCache(aStudy)).in() );
-
-  bool isFind = false;
-  QString aType = Storable::FindValue( theMap, "myType", &isFind );
-  if( !isFind )
-    return NULL;
-
-  VISU::VISUType aVISUType = (VISU::VISUType)( aType.toInt() );
-
-  VISU::ColoredPrs3dHolder_var aHolder = aCache->CreateHolder( aVISUType, anInput );
-
-  VISU::ColoredPrs3dHolder_i* aHolderImpl =
-    dynamic_cast<VISU::ColoredPrs3dHolder_i*>( VISU::GetServant(aHolder).in() );
-
-  return aHolderImpl->Restore(theSObject,theMap,thePrefix);
-  */
   return NULL;
 }
index a47a46b4e88c4f57e0ea15ca3ec346e681551a2b..f2bb397eb41738d2d130d92018b1d6fc2cb6669b 100644 (file)
@@ -53,9 +53,7 @@ namespace VISU
     //----------------------------------------------------------------------------
     //! A constructor to create an instance of the class
     explicit
-    ColoredPrs3dHolder_i(VISU::VISUType theType,
-                        VISU::ColoredPrs3dHolder::BasicInput theInput,
-                        VISU::ColoredPrs3dCache_i& theCache);
+    ColoredPrs3dHolder_i(VISU::ColoredPrs3dCache_i& theCache);
 
     virtual
     ~ColoredPrs3dHolder_i();
@@ -118,12 +116,6 @@ namespace VISU
     void
     ToStream(std::ostringstream&);
 
-    virtual
-    Storable*
-    Restore(SALOMEDS::SObject_ptr theSObject,
-           const Storable::TRestoringMap& theMap,
-           const std::string& thePrefix);
-
     static
     Storable*
     Restore(SALOMEDS::SObject_ptr theSObject,
index acebf2cfe19bba33dc5bcd4e10c0afaf38ae03ec..01e20230fe01d5a88e027c043edfa684f7e2c665 100644 (file)
@@ -48,28 +48,12 @@ static int MYDEBUG = 0;
 //============================================================================
 VISU::ColoredPrs3d_i::
 ColoredPrs3d_i(EPublishInStudyMode thePublishInStudyMode) :
-  PrsObject_i(SALOMEDS::Study::_nil()),
-  Prs3d_i(),
   myPublishInStudyMode(thePublishInStudyMode),
   myIsTimeStampFixed(thePublishInStudyMode == EPublishUnderTimeStamp),
   myScalarMapPL(NULL),
   myIsFixedRange(false)
 {}
 
-
-//---------------------------------------------------------------
-VISU::ColoredPrs3d_i::
-ColoredPrs3d_i(Result_i* theResult,
-              SALOMEDS::SObject_var theSObject) :
-  PrsObject_i(theSObject->GetStudy()),
-  Prs3d_i(theResult,theSObject),
-  myPublishInStudyMode(EDoNotPublish),
-  myIsTimeStampFixed(true),
-  myScalarMapPL(NULL),
-  myIsFixedRange(false)
-{}
-
-
 //---------------------------------------------------------------
 VISU::ColoredPrs3d_i
 ::~ColoredPrs3d_i()
@@ -1053,9 +1037,12 @@ VISU::ColoredPrs3d_i
 //----------------------------------------------------------------------------
 VISU::Storable* 
 VISU::ColoredPrs3d_i
-::Restore(const Storable::TRestoringMap& theMap)
+::Restore(SALOMEDS::Study_ptr theStudy,
+         const Storable::TRestoringMap& theMap)
 {
-  SetMeshName(VISU::Storable::FindValue(theMap,"myMeshName").latin1());
+  if(!TSuperClass::Restore(theStudy, theMap))
+    return NULL;
+
   SetEntity((VISU::Entity)VISU::Storable::FindValue(theMap,"myEntity").toInt());
   SetFieldName(VISU::Storable::FindValue(theMap,"myFieldName").latin1());
   SetTimeStampNumber(VISU::Storable::FindValue(theMap,"myIteration").toInt());
@@ -1066,8 +1053,6 @@ VISU::ColoredPrs3d_i
 
   Build(ERestore);
 
-  TSuperClass::Restore(theMap);
-
   SetScalarMode(VISU::Storable::FindValue(theMap,"myScalarMode").toInt());
   SetNbColors(VISU::Storable::FindValue(theMap,"myNumberOfColors").toInt());
   SetBarOrientation((VISU::ScalarMap::Orientation)VISU::Storable::FindValue(theMap,"myOrientation").toInt());
@@ -1105,13 +1090,11 @@ VISU::ColoredPrs3d_i
 {
   TSuperClass::ToStream(theStr);
 
-  Storable::DataToStream( theStr, "myMeshName",       GetCMeshName() );
   Storable::DataToStream( theStr, "myEntity",         GetEntity() );
   Storable::DataToStream( theStr, "myFieldName",      GetCFieldName() );
   Storable::DataToStream( theStr, "myIteration",      int(GetTimeStampNumber()) );
   Storable::DataToStream( theStr, "myIsTimeStampFixed", int(myIsTimeStampFixed) );
 
-  Storable::DataToStream( theStr, "myResultEntry",    GetCResult()->GetEntry() );
   Storable::DataToStream( theStr, "myHolderEntry",    myHolderEntry );
 
   Storable::DataToStream( theStr, "myScalarMode",     int(GetScalarMode()) );
@@ -1234,7 +1217,6 @@ VISU::ColoredPrs3d_i
                       "",
                       aComment.latin1(),
                       true);
-      SetSObject(GetStudyDocument()->FindObjectIOR(anIOR));
     }else if(myPublishInStudyMode == EPublishIndependently){
       SetName(GenerateName().latin1(), false);
       CORBA::String_var anIOR = GetID();
@@ -1249,7 +1231,6 @@ VISU::ColoredPrs3d_i
                       "",
                       aComment.latin1(),
                       true);
-      SetSObject(GetStudyDocument()->FindObjectIOR(anIOR));
     }
 #ifndef _DEXCEPT_
   }catch(std::exception& exc){
index c8254076cf1dcc7ef4ada7ddd63dadeda3d6aa11..f715a7d389c681df45a64b53908f5fc915be22b8 100644 (file)
@@ -54,9 +54,6 @@ namespace VISU
 
     explicit
     ColoredPrs3d_i(EPublishInStudyMode thePublishInStudyMode);
-    explicit
-    ColoredPrs3d_i(Result_i* theResult,
-                  SALOMEDS::SObject_var theSObject);
 
     virtual
     ~ColoredPrs3d_i();
@@ -256,7 +253,8 @@ namespace VISU
     */
     virtual 
     Storable* 
-    Restore(const Storable::TRestoringMap& theMap);
+    Restore(SALOMEDS::Study_ptr theStudy,
+           const Storable::TRestoringMap& theMap);
 
     /*!
       Writes persistent params of the presentation into the given stream
@@ -476,6 +474,18 @@ namespace VISU
     bool myIsFixedRange;
   };
 
+  //----------------------------------------------------------------------------
+  template<class TColoredPrs3d>
+  Storable* 
+  Restore(SALOMEDS::SObject_ptr theSObject,
+         const std::string& thePrefix,
+         const Storable::TRestoringMap& theMap)
+  {
+    TColoredPrs3d* aColoredPrs3d = new TColoredPrs3d(ColoredPrs3d_i::EDoNotPublish);
+    SALOMEDS::Study_var aStudy = theSObject->GetStudy();
+    return aColoredPrs3d->Restore(aStudy, theMap);
+  }
+  //----------------------------------------------------------------------------
 }
 
 #endif
index eba9b965da534a6c59d584392e253461ae11fe5c..d09bc322d6bfdeb59fd3fe6c3ff72cc4028f4950 100644 (file)
@@ -88,8 +88,6 @@ VISU::CutLines_i
 //---------------------------------------------------------------
 VISU::CutLines_i::
 CutLines_i(EPublishInStudyMode thePublishInStudyMode) :
-  PrsObject_i(SALOMEDS::Study::_nil()), 
-  Prs3d_i(),
   ColoredPrs3d_i(thePublishInStudyMode),
   ScalarMap_i(thePublishInStudyMode),
   myCutLinesPL(NULL)
@@ -97,17 +95,6 @@ CutLines_i(EPublishInStudyMode thePublishInStudyMode) :
 
 
 //---------------------------------------------------------------
-VISU::CutLines_i::
-CutLines_i(Result_i* theResult, 
-          SALOMEDS::SObject_var theSObject) :
-  PrsObject_i(theSObject->GetStudy()), 
-  Prs3d_i(theResult,theSObject),
-  ColoredPrs3d_i(theResult,theSObject),
-  ScalarMap_i(theResult,theSObject),
-  myCutLinesPL(NULL)
-{}
-
-
 /*! Copy map to /a myMapCurvesInverted.
  * \param theCurves - map
  */
@@ -134,9 +121,11 @@ VISU::CutLines_i
 //---------------------------------------------------------------
 VISU::Storable* 
 VISU::CutLines_i
-::Restore(const Storable::TRestoringMap& theMap)
+::Restore(SALOMEDS::Study_ptr theStudy,
+         const Storable::TRestoringMap& theMap)
 {
-  TSuperClass::Restore(theMap);
+  if(!TSuperClass::Restore(theStudy, theMap))
+    return NULL;
 
   SetNbLines(VISU::Storable::FindValue(theMap,"myNbLines").toInt());
   SetDisplacement(VISU::Storable::FindValue(theMap,"myDisplacement[0]").toDouble());
index fc2c11d1b4ccc870631d54d259b418d429854683..216e7a664900126d2c3865765809128e1d8f231c 100644 (file)
@@ -45,9 +45,7 @@ namespace VISU
 
     explicit
     CutLines_i(EPublishInStudyMode thePublishInStudyModep);
-    explicit
-    CutLines_i(Result_i* theResult,
-              SALOMEDS::SObject_var theSObject);
+
     virtual
     ~CutLines_i();
 
@@ -227,7 +225,8 @@ namespace VISU
     //! Extends VISU_ColoredPrs3d_i::Restore
     virtual
     Storable* 
-    Restore(const Storable::TRestoringMap& theMap);
+    Restore(SALOMEDS::Study_ptr theStudy,
+           const Storable::TRestoringMap& theMap);
 
     //! Extends VISU_ColoredPrs3d_i::CreateActor
     virtual 
index c19a4b94d6307280d0144c4ad1ef165b0b6a2f80..a0fb3197da8e5afd14565d1383d32fa4f37353e3 100644 (file)
@@ -78,26 +78,12 @@ VISU::CutPlanes_i
 //----------------------------------------------------------------------------
 VISU::CutPlanes_i
 ::CutPlanes_i(EPublishInStudyMode thePublishInStudyMode):
-  PrsObject_i(SALOMEDS::Study::_nil()), 
-  Prs3d_i(),
   ColoredPrs3d_i(thePublishInStudyMode),
   ScalarMap_i(thePublishInStudyMode),
   myCutPlanesPL(NULL)
 {}
 
 
-//----------------------------------------------------------------------------
-VISU::CutPlanes_i
-::CutPlanes_i(Result_i* theResult, 
-             SALOMEDS::SObject_var theSObject):
-  PrsObject_i(theSObject->GetStudy()), 
-  Prs3d_i(theResult,theSObject),
-  ColoredPrs3d_i(theResult,theSObject),
-  ScalarMap_i(theResult,theSObject),
-  myCutPlanesPL(NULL)
-{}
-
-
 //----------------------------------------------------------------------------
 VISU::Storable* 
 VISU::CutPlanes_i
@@ -113,9 +99,11 @@ VISU::CutPlanes_i
 //----------------------------------------------------------------------------
 VISU::Storable* 
 VISU::CutPlanes_i
-::Restore(const Storable::TRestoringMap& theMap)
+::Restore(SALOMEDS::Study_ptr theStudy,
+         const Storable::TRestoringMap& theMap)
 {
-  TSuperClass::Restore(theMap);
+  if(!TSuperClass::Restore(theStudy, theMap))
+    return NULL;
 
   SetNbPlanes(VISU::Storable::FindValue(theMap,"myNbPlanes").toInt());
   SetDisplacement(VISU::Storable::FindValue(theMap,"myDisplacement").toDouble());
index 45f23f9a109254da5766442dc47affcc59abd699..6f58872d5d3add7761c7ca1db1774a66e2d8be47 100644 (file)
@@ -45,9 +45,7 @@ namespace VISU
 
     explicit
     CutPlanes_i(EPublishInStudyMode thePublishInStudyModep);
-    explicit
-    CutPlanes_i(Result_i* theResult,
-               SALOMEDS::SObject_var theSObject);
+
     virtual
     ~CutPlanes_i();
 
@@ -156,7 +154,8 @@ namespace VISU
     //! Redefines VISU_ColoredPrs3d_i::Restore
     virtual
     Storable* 
-    Restore(const Storable::TRestoringMap& theMap);
+    Restore(SALOMEDS::Study_ptr theStudy,
+           const Storable::TRestoringMap& theMap);
 
     //! Redefines VISU_ColoredPrs3d_i::CreateActor
     virtual 
index 9f7f3969ba89d57b707f88fabaf739472b2ff71e..a41f512e0c3f3f6064c6aa7853636ad01e0bf293 100644 (file)
@@ -103,8 +103,6 @@ VISU::DeformedShape_i
 //---------------------------------------------------------------
 VISU::DeformedShape_i
 ::DeformedShape_i(EPublishInStudyMode thePublishInStudyMode):
-  PrsObject_i(SALOMEDS::Study::_nil()), 
-  Prs3d_i(),
   ColoredPrs3d_i(thePublishInStudyMode),
   ScalarMap_i(thePublishInStudyMode),
   myDeformedShapePL(NULL)
@@ -113,20 +111,6 @@ VISU::DeformedShape_i
 }
 
 
-//---------------------------------------------------------------
-VISU::DeformedShape_i
-::DeformedShape_i(Result_i* theResult, 
-                 SALOMEDS::SObject_var theSObject):
-  PrsObject_i(theSObject->GetStudy()), 
-  Prs3d_i(theResult,theSObject),
-  ColoredPrs3d_i(theResult,theSObject),
-  ScalarMap_i(theResult,theSObject),
-  myDeformedShapePL(NULL)
-{
-  if(MYDEBUG) MESSAGE("DeformedShape_i::DeformedShape_i");
-}
-
-
 //---------------------------------------------------------------
 void 
 VISU::DeformedShape_i
@@ -159,9 +143,11 @@ VISU::DeformedShape_i
 //---------------------------------------------------------------
 VISU::Storable* 
 VISU::DeformedShape_i
-::Restore(const Storable::TRestoringMap& theMap)
+::Restore(SALOMEDS::Study_ptr theStudy,
+         const Storable::TRestoringMap& theMap)
 {
-  TSuperClass::Restore(theMap);
+  if(!TSuperClass::Restore(theStudy, theMap))
+    return NULL;
 
   SetScale(VISU::Storable::FindValue(theMap,"myFactor").toDouble());
   myIsColored = VISU::Storable::FindValue(theMap,"myIsColored").toInt();
index 3cf54aa3ec60efbc44ab5d30222fba80d83719c6..5f3d79cd808ae4e070bb3aa012e112631aead667 100644 (file)
@@ -45,9 +45,7 @@ namespace VISU
 
     explicit
     DeformedShape_i(EPublishInStudyMode thePublishInStudyModep);
-    explicit
-    DeformedShape_i(Result_i* theResult,
-                   SALOMEDS::SObject_var theSObject);
+
     virtual 
     void 
     SameAs(const Prs3d_i* theOrigin);
@@ -142,7 +140,8 @@ namespace VISU
 
     virtual
     Storable* 
-    Restore(const Storable::TRestoringMap& theMap);
+    Restore(SALOMEDS::Study_ptr theStudy,
+           const Storable::TRestoringMap& theMap);
 
     virtual
     void
index 778d0526ca6a9b46cd20eb82e868b81dd9b1ed0a..13c95cfb19b29238441d03c8cd61aab2cfa87767 100644 (file)
@@ -109,8 +109,6 @@ VISU::GaussPoints_i
 //----------------------------------------------------------------------------
 VISU::GaussPoints_i
 ::GaussPoints_i(EPublishInStudyMode thePublishInStudyMode) : 
-  PrsObject_i(SALOMEDS::Study::_nil()), 
-  Prs3d_i(),
   ColoredPrs3d_i(thePublishInStudyMode),
   myGaussPointsPL(NULL),
   myColor(Qt::blue),
@@ -123,23 +121,6 @@ VISU::GaussPoints_i
 }
 
 
-//----------------------------------------------------------------------------
-VISU::GaussPoints_i
-::GaussPoints_i(Result_i* theResult, 
-               SALOMEDS::SObject_var theSObject) : 
-  PrsObject_i(theSObject->GetStudy()), 
-  Prs3d_i(theResult,theSObject),
-  ColoredPrs3d_i(theResult,theSObject),
-  myGaussPointsPL(NULL),
-  myColor(Qt::blue),
-  myIsActiveLocalScalarBar(true),
-  myIsDispGlobalScalarBar(true),
-  myFaceLimit(50000)
-{
-  if(MYDEBUG) MESSAGE("GaussPoints_i::GaussPoints_i - this = "<<this);
-}
-
-
 //----------------------------------------------------------------------------
 VISU::Storable* 
 VISU::GaussPoints_i
@@ -281,9 +262,11 @@ VISU::GaussPoints_i
 //----------------------------------------------------------------------------
 VISU::Storable* 
 VISU::GaussPoints_i
-::Restore(const Storable::TRestoringMap& theMap)
+::Restore(SALOMEDS::Study_ptr theStudy,
+         const Storable::TRestoringMap& theMap)
 {
-  TSuperClass::Restore(theMap);
+  if(!TSuperClass::Restore(theStudy, theMap))
+    return NULL;
 
   SetIsActiveLocalScalarBar(Storable::FindValue(theMap,"myIsActiveLocalScalarBar").toInt());
   SetIsDispGlobalScalarBar(Storable::FindValue(theMap,"myIsDispGlobalScalarBar").toInt());
index 3d651d34cbc4a9b6438c461bc31ad359ba8cf03c..6b6c93c46a04ef62c78cf02418f7537d83232827 100644 (file)
@@ -55,9 +55,6 @@ namespace VISU
 
     explicit
     GaussPoints_i(EPublishInStudyMode thePublishInStudyModep);
-    explicit
-    GaussPoints_i(Result_i* theResult,
-                 SALOMEDS::SObject_var theSObject);
 
     virtual
     ~GaussPoints_i();
@@ -346,7 +343,8 @@ namespace VISU
 
     virtual 
     Storable* 
-    Restore(const Storable::TRestoringMap& theMap);
+    Restore(SALOMEDS::Study_ptr theStudy,
+           const Storable::TRestoringMap& theMap);
 
     //----------------------------------------------------------------------------
     virtual 
index 05e2ab64878acaec12a38aae7b65644123e48409..fdfd89e63af7d5e10570ce133b42aa7eeb1a21ac 100644 (file)
@@ -193,7 +193,7 @@ namespace VISU
   RegistryStorable() 
   {
     Storable::Registry(Result_i::myComment.c_str(),&(Result_i::Restore));
-    Storable::Registry(Mesh_i::myComment.c_str(),&(Restore<Mesh_i>));
+    Storable::Registry(Mesh_i::myComment.c_str(),&(Mesh_i::Restore));
     Storable::Registry(ScalarMap_i::myComment.c_str(),&(Restore<ScalarMap_i>));
     Storable::Registry(GaussPoints_i::myComment.c_str(),&(Restore<GaussPoints_i>));
     Storable::Registry(DeformedShape_i::myComment.c_str(),&(Restore<DeformedShape_i>));
@@ -848,10 +848,10 @@ namespace VISU
   {
     if(myStudyDocument->GetProperties()->IsLocked())
       return Mesh::_nil();
-    Mutex mt(myMutex);
-    if(Result_i* pResult = dynamic_cast<Result_i*>(GetServant(theResult).in())){
-      Mesh_i* aPresent = new Mesh_i(pResult);
-      if(aPresent->Create(theMeshName,theEntity) != NULL)
+
+    if(Result_i* aResult = dynamic_cast<Result_i*>(GetServant(theResult).in())){
+      Mesh_i* aPresent = new Mesh_i();
+      if(!aPresent->Create(aResult, theMeshName, theEntity))
        return aPresent->_this();
       else{
        aPresent->_remove_ref();
@@ -871,10 +871,10 @@ namespace VISU
   {
     if(myStudyDocument->GetProperties()->IsLocked())
       return Mesh::_nil();
-    Mutex mt(myMutex);
-    if(Result_i* pResult = dynamic_cast<Result_i*>(GetServant(theResult).in())){
-      Mesh_i* aPresent = new Mesh_i(pResult);
-      if(aPresent->Create(theMeshName,theEntity,theFamilyName) != NULL)
+
+    if(Result_i* aResult = dynamic_cast<Result_i*>(GetServant(theResult).in())){
+      Mesh_i* aPresent = new Mesh_i();
+      if(!aPresent->Create(aResult, theMeshName, theEntity, theFamilyName))
        return aPresent->_this();
       else{
        aPresent->_remove_ref();
@@ -893,10 +893,10 @@ namespace VISU
   {
     if(myStudyDocument->GetProperties()->IsLocked())
       return Mesh::_nil();
-    Mutex mt(myMutex);
-    if(Result_i* pResult = dynamic_cast<Result_i*>(GetServant(theResult).in())){
-      Mesh_i* aPresent = new Mesh_i(pResult);
-      if(aPresent->Create(theMeshName,theGroupName) != NULL)
+
+    if(Result_i* aResult = dynamic_cast<Result_i*>(GetServant(theResult).in())){
+      Mesh_i* aPresent = new Mesh_i();
+      if(!aPresent->Create(aResult, theMeshName, theGroupName))
        return aPresent->_this();
       else{
        aPresent->_remove_ref();
@@ -932,61 +932,101 @@ namespace VISU
                       const char* theFieldName,
                       CORBA::Long theIteration)
   {
-    return Prs3dOnField<VISU::GaussPoints_i>(theResult,theMeshName,theEntity,theFieldName,theIteration)._retn();
+    return Prs3dOnField<VISU::GaussPoints_i>(theResult,
+                                            theMeshName,
+                                            theEntity,
+                                            theFieldName,
+                                            theIteration)._retn();
   }
 
-  DeformedShape_ptr VISU_Gen_i::DeformedShapeOnField(Result_ptr theResult,
-                                                    const char* theMeshName,
-                                                    VISU::Entity theEntity,
-                                                    const char* theFieldName,
-                                                    CORBA::Long theIteration)
+  DeformedShape_ptr 
+  VISU_Gen_i
+  ::DeformedShapeOnField(Result_ptr theResult,
+                        const char* theMeshName,
+                        VISU::Entity theEntity,
+                        const char* theFieldName,
+                        CORBA::Long theIteration)
   {
-    return Prs3dOnField<VISU::DeformedShape_i>(theResult,theMeshName,theEntity,theFieldName,theIteration)._retn();
+    return Prs3dOnField<VISU::DeformedShape_i>(theResult,
+                                              theMeshName,
+                                              theEntity,
+                                              theFieldName,
+                                              theIteration)._retn();
   }
 
-  ScalarMapOnDeformedShape_ptr VISU_Gen_i::ScalarMapOnDeformedShapeOnField(Result_ptr theResult,
-                                                                          const char* theMeshName,
-                                                                          VISU::Entity theEntity,
-                                                                          const char* theFieldName,
-                                                                          CORBA::Long theIteration)
+  ScalarMapOnDeformedShape_ptr 
+  VISU_Gen_i
+  ::ScalarMapOnDeformedShapeOnField(Result_ptr theResult,
+                                   const char* theMeshName,
+                                   VISU::Entity theEntity,
+                                   const char* theFieldName,
+                                   CORBA::Long theIteration)
   {
-    return Prs3dOnField<VISU::ScalarMapOnDeformedShape_i>(theResult,theMeshName,theEntity,theFieldName,theIteration)._retn();
+    return Prs3dOnField<VISU::ScalarMapOnDeformedShape_i>(theResult,
+                                                         theMeshName,
+                                                         theEntity,
+                                                         theFieldName,
+                                                         theIteration)._retn();
   }
   
-  Vectors_ptr VISU_Gen_i::VectorsOnField(Result_ptr theResult,
-                                        const char* theMeshName,
-                                        VISU::Entity theEntity,
-                                        const char* theFieldName,
-                                        CORBA::Long theIteration)
+  Vectors_ptr 
+  VISU_Gen_i
+  ::VectorsOnField(Result_ptr theResult,
+                  const char* theMeshName,
+                  VISU::Entity theEntity,
+                  const char* theFieldName,
+                  CORBA::Long theIteration)
   {
-    return Prs3dOnField<VISU::Vectors_i>(theResult,theMeshName,theEntity,theFieldName,theIteration)._retn();
+    return Prs3dOnField<VISU::Vectors_i>(theResult,
+                                        theMeshName,
+                                        theEntity,
+                                        theFieldName,
+                                        theIteration)._retn();
   }
 
-  IsoSurfaces_ptr VISU_Gen_i::IsoSurfacesOnField(Result_ptr theResult,
-                                                const char* theMeshName,
-                                                VISU::Entity theEntity,
-                                                const char* theFieldName,
-                                                CORBA::Long theIteration)
+  IsoSurfaces_ptr 
+  VISU_Gen_i
+  ::IsoSurfacesOnField(Result_ptr theResult,
+                      const char* theMeshName,
+                      VISU::Entity theEntity,
+                      const char* theFieldName,
+                      CORBA::Long theIteration)
   {
-    return Prs3dOnField<VISU::IsoSurfaces_i>(theResult,theMeshName,theEntity,theFieldName,theIteration)._retn();
+    return Prs3dOnField<VISU::IsoSurfaces_i>(theResult,
+                                            theMeshName,
+                                            theEntity,
+                                            theFieldName,
+                                            theIteration)._retn();
   }
 
-  StreamLines_ptr VISU_Gen_i::StreamLinesOnField(Result_ptr theResult,
-                                                const char* theMeshName,
-                                                VISU::Entity theEntity,
-                                                const char* theFieldName,
-                                                CORBA::Long theIteration)
+  StreamLines_ptr 
+  VISU_Gen_i
+  ::StreamLinesOnField(Result_ptr theResult,
+                      const char* theMeshName,
+                      VISU::Entity theEntity,
+                      const char* theFieldName,
+                      CORBA::Long theIteration)
   {
-    return Prs3dOnField<VISU::StreamLines_i>(theResult,theMeshName,theEntity,theFieldName,theIteration)._retn();
+    return Prs3dOnField<VISU::StreamLines_i>(theResult,
+                                            theMeshName,
+                                            theEntity,
+                                            theFieldName,
+                                            theIteration)._retn();
   }
 
-  Plot3D_ptr VISU_Gen_i::Plot3DOnField(Result_ptr theResult,
-                                      const char* theMeshName,
-                                      VISU::Entity theEntity,
-                                      const char* theFieldName,
-                                      CORBA::Long theIteration)
+  Plot3D_ptr 
+  VISU_Gen_i
+  ::Plot3DOnField(Result_ptr theResult,
+                 const char* theMeshName,
+                 VISU::Entity theEntity,
+                 const char* theFieldName,
+                 CORBA::Long theIteration)
   {
-    return Prs3dOnField<VISU::Plot3D_i>(theResult,theMeshName,theEntity,theFieldName,theIteration)._retn();
+    return Prs3dOnField<VISU::Plot3D_i>(theResult,
+                                       theMeshName,
+                                       theEntity,
+                                       theFieldName,
+                                       theIteration)._retn();
   }
 
   CutPlanes_ptr VISU_Gen_i::CutPlanesOnField(Result_ptr theResult,
@@ -995,7 +1035,11 @@ namespace VISU
                                             const char* theFieldName,
                                             CORBA::Long theIteration)
   {
-    return Prs3dOnField<VISU::CutPlanes_i>(theResult,theMeshName,theEntity,theFieldName,theIteration)._retn();
+    return Prs3dOnField<VISU::CutPlanes_i>(theResult,
+                                          theMeshName,
+                                          theEntity,
+                                          theFieldName,
+                                          theIteration)._retn();
   }
 
   CutLines_ptr VISU_Gen_i::CutLinesOnField(Result_ptr theResult,
@@ -1004,7 +1048,11 @@ namespace VISU
                                           const char* theFieldName,
                                           CORBA::Long theIteration)
   {
-    return Prs3dOnField<VISU::CutLines_i>(theResult,theMeshName,theEntity,theFieldName,theIteration)._retn();
+    return Prs3dOnField<VISU::CutLines_i>(theResult,
+                                         theMeshName,
+                                         theEntity,
+                                         theFieldName,
+                                         theIteration)._retn();
   }
 
   Table_ptr VISU_Gen_i::CreateTable(const char* theTableEntry){
index 4e97cdd7458b4704789bfca2a74ccc32f501e4f3..b1e533e18c00ec9d956fd9ca0ce43f34224cadb7 100644 (file)
@@ -79,26 +79,12 @@ VISU::IsoSurfaces_i
 //---------------------------------------------------------------
 VISU::IsoSurfaces_i
 ::IsoSurfaces_i(EPublishInStudyMode thePublishInStudyMode) :
-  PrsObject_i(SALOMEDS::Study::_nil()), 
-  Prs3d_i(),
   ColoredPrs3d_i(thePublishInStudyMode),
   ScalarMap_i(thePublishInStudyMode),
   myIsoSurfacesPL(NULL)
 {}
 
 
-//---------------------------------------------------------------
-VISU::IsoSurfaces_i
-::IsoSurfaces_i(Result_i* theResult, 
-               SALOMEDS::SObject_var theSObject) :
-  PrsObject_i(theSObject->GetStudy()), 
-  Prs3d_i(theResult,theSObject),
-  ColoredPrs3d_i(theResult,theSObject),
-  ScalarMap_i(theResult,theSObject),
-  myIsoSurfacesPL(NULL)
-{}
-
-
 //---------------------------------------------------------------
 VISU::Storable* 
 VISU::IsoSurfaces_i
@@ -114,9 +100,11 @@ VISU::IsoSurfaces_i
 //---------------------------------------------------------------
 VISU::Storable* 
 VISU::IsoSurfaces_i
-::Restore(const Storable::TRestoringMap& theMap)
+::Restore(SALOMEDS::Study_ptr theStudy,
+         const Storable::TRestoringMap& theMap)
 {
-  TSuperClass::Restore(theMap);
+  if(!TSuperClass::Restore(theStudy, theMap))
+    return NULL;
 
   SetNbSurfaces(VISU::Storable::FindValue(theMap,"myNbSurface").toInt());
   float aMin = VISU::Storable::FindValue(theMap,"myRange[0]").toDouble();
index 4723ebbc88debd001ef4d70159f8454ec6a75a4f..0daa2b2c003062fc73eb9121cf3d8f11a0e20b78 100644 (file)
@@ -45,9 +45,7 @@ namespace VISU
 
     explicit
     IsoSurfaces_i(EPublishInStudyMode thePublishInStudyModep);
-    explicit
-    IsoSurfaces_i(Result_i* theResult,
-                 SALOMEDS::SObject_var theSObject);
+
     virtual 
     ~IsoSurfaces_i();
 
@@ -137,7 +135,8 @@ namespace VISU
 
     virtual
     Storable* 
-    Restore(const Storable::TRestoringMap& theMap);
+    Restore(SALOMEDS::Study_ptr theStudy,
+           const Storable::TRestoringMap& theMap);
 
     virtual 
     VISU_Actor* 
index 2a75b5c3e2771af5a4b8f0e6cee39abba4435bcb..a88515f537c9b12b273430c87c9af171185a6450 100644 (file)
@@ -52,7 +52,7 @@ QString
 VISU::Mesh_i
 ::GenerateName() 
 { 
-  return VISU::GenerateName("Mesh",myNbPresent++);
+  return VISU::GenerateName("Mesh", myNbPresent++);
 }
 
 //----------------------------------------------------------------------------
@@ -68,9 +68,7 @@ VISU::Mesh_i
 
 //----------------------------------------------------------------------------
 VISU::Mesh_i
-::Mesh_i(VISU::Result_i* theResult) :
-  PrsObject_i(theResult->GetStudyDocument()),
-  Prs3d_i(theResult,false),
+::Mesh_i():
   myMeshPL(VISU_MeshPL::New())
 {
   SetPipeLine(myMeshPL);
@@ -78,18 +76,194 @@ VISU::Mesh_i
 
 
 //----------------------------------------------------------------------------
+size_t
 VISU::Mesh_i
-::Mesh_i(VISU::Result_i* theResult,
-        SALOMEDS::SObject_ptr theSObject) :
-  PrsObject_i(theResult->GetStudyDocument()),
-  Prs3d_i(theResult,theSObject),
-  myMeshPL(VISU_MeshPL::New())
+::IsPossible(Result_i* theResult, 
+            const std::string& theMeshName,
+            Entity theEntity, 
+            const std::string& theFamilyName)
 {
-  SetPipeLine(myMeshPL);
+  try{
+    MESSAGE("Mesh_i::IsPossible - theMeshName = '"<<theMeshName<<"'; theEntity = "<<theEntity<<"; theFamilyName = '"<<theFamilyName<<"'");
+    size_t aSize = INCMEMORY*
+      theResult->GetInput()->GetMeshOnEntitySize(theMeshName,(VISU::TEntity)theEntity);
+    size_t aResult = VISU_PipeLine::CheckAvailableMemory(aSize);
+    MESSAGE("Mesh_i::IsPossible - CheckAvailableMemory = "<<float(aSize)<<"; aResult = "<<aResult);
+    return aResult;
+  }catch(std::exception& exc){
+    INFOS("Follow exception was occured :\n"<<exc.what());
+  }catch(...){
+    INFOS("Unknown exception was occured!");
+  }
+  return 0;
+}
+
+
+//----------------------------------------------------------------------------
+VISU::Storable* 
+VISU::Mesh_i
+::Create(VISU::Result_i* theResult, 
+        const std::string& theMeshName, 
+        VISU::Entity theEntity, 
+        const std::string& theFamilyName)
+{
+  SetCResult(theResult);
+  SetMeshName(theMeshName.c_str());
+  myEntity = int(theEntity);//jfa IPAL9284
+  mySubMeshName = theFamilyName;
+  return Build(false);
 }
 
 
 //----------------------------------------------------------------------------
+size_t 
+VISU::Mesh_i
+::IsPossible(Result_i* theResult, 
+            const std::string& theMeshName, 
+            const std::string& theGroupName)
+{
+  try{
+    MESSAGE("Mesh_i::IsPossible - theMeshName = '"<<theMeshName<<"'; theGroupName = '"<<theGroupName<<"'");
+    size_t aSize = INCMEMORY*
+      theResult->GetInput()->GetMeshOnGroupSize(theMeshName,theGroupName);
+    size_t aResult = VISU_PipeLine::CheckAvailableMemory(aSize);
+    INFOS("Mesh_i::IsPossible - CheckAvailableMemory = "<<float(aSize)<<"; aResult = "<<aResult);
+    return aResult;
+  }catch(std::exception& exc){
+    INFOS("Follow exception was occured :\n"<<exc.what());
+  }catch(...){
+    INFOS("Unknown exception was occured!");
+  }
+  return 0;
+}
+
+
+//----------------------------------------------------------------------------
+VISU::Storable* 
+VISU::Mesh_i
+::Create(VISU::Result_i* theResult, 
+        const std::string& theMeshName, 
+        const std::string& theGroupName)
+{
+  SetCResult(theResult);
+  SetMeshName(theMeshName.c_str());
+  myEntity = -1;//jfa IPAL9284
+  mySubMeshName = theGroupName;
+  return Build(false);
+}
+
+
+//----------------------------------------------------------------------------
+//----------------------------------------------------------------------------
+VISU::Mesh_i
+::~Mesh_i()
+{
+  if(MYDEBUG) MESSAGE("Mesh_i::~Mesh_i()");
+}
+
+
+//----------------------------------------------------------------------------
+VISU::Storable* 
+VISU::Mesh_i
+::Build(int theRestoring)
+{
+  SALOMEDS::StudyBuilder_var aStudyBuilder = GetStudyDocument()->NewBuilder();
+  aStudyBuilder->NewCommand();  // There is a transaction
+  try {
+    if (GetCResult()->GetInput() == NULL)
+      throw std::runtime_error("Mesh_i::Build - GetCResult()->GetInput() == NULL !!!");
+    if (!theRestoring) {
+      myPresentType =  VISU::PresentationType(VISU::GetResourceMgr()->integerValue("VISU" , "mesh_represent", 2));
+      if(myEntity == VISU::NODE_ENTITY)
+       myPresentType = VISU::POINT;
+      SetName(GenerateName().latin1(), false);
+      myCellColor.R = 0.0;  myCellColor.G = myCellColor.B = 1.0;
+      myNodeColor.R = myNodeColor.G = 1.0;  myNodeColor.B = 1.0;
+      myLinkColor.R = myLinkColor.G = myLinkColor.B = 83/255.;
+    }
+
+    if(myEntity >= 0)
+      if(mySubMeshName == "")
+       myType = VISU::TENTITY;
+      else
+       myType = VISU::TFAMILY;
+    else
+      myType = VISU::TGROUP;
+
+    if(MYDEBUG) MESSAGE("Mesh_i::Build - myType = "<<myType);
+    QString aComment,aTmp;
+
+    VISU::PIDMapper anIDMapper;
+    VISU::Result_i::TInput* anInput = GetCResult()->GetInput();
+    switch(myType){
+    case VISU::TENTITY :
+      anIDMapper = anInput->GetMeshOnEntity(GetCMeshName(),
+                                           (VISU::TEntity)myEntity);//jfa IPAL9284
+      aComment = "";
+      aComment.append(aTmp.sprintf("myComment=ENTITY;myType=%d;",VISU::TENTITY));
+      aComment.append("myMeshName=");
+      aComment.append(GetCMeshName().c_str());
+      aComment.append(";");
+      aComment.append(aTmp.sprintf("myId=%d",myEntity));
+      break;
+    case VISU::TFAMILY :
+      anIDMapper = anInput->GetFamilyOnEntity(GetCMeshName(),
+                                             (VISU::TEntity)myEntity,
+                                             mySubMeshName);
+      aComment = "";
+      aComment.append(aTmp.sprintf("myComment=FAMILY;myType=%d;",VISU::TFAMILY));
+      aComment.append("myMeshName=");
+      aComment.append(GetCMeshName().c_str());
+      aComment.append(";");
+      aComment.append(aTmp.sprintf("myEntityId=%d;",myEntity));
+      aComment.append("myName=");
+      aComment.append(mySubMeshName);
+      break;
+    case VISU::TGROUP :
+      anIDMapper = anInput->GetMeshOnGroup(GetCMeshName(),
+                                          mySubMeshName);
+      aComment = "";
+      aComment.append(aTmp.sprintf("myComment=GROUP;myType=%d;",VISU::TGROUP));
+      aComment.append("myMeshName=");
+      aComment.append(GetCMeshName().c_str());
+      aComment.append(";");
+      aComment.append("myName=");
+      aComment.append(mySubMeshName);
+      
+      break;
+    }
+    if(!anIDMapper) 
+      throw std::runtime_error("Mesh_i::Build - !anIDMapper !!!");
+
+    myMeshPL->SetIDMapper(anIDMapper);
+    myMeshPL->Build();
+
+    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);
+      CORBA::String_var aString = GetID();
+      anIOR->SetValue(aString);
+    }
+  }catch(std::exception& exc){
+    INFOS("Follow exception was occured :\n"<<exc.what());
+    return NULL;
+  }catch(...){
+    INFOS("Unknown exception was occured!");
+    return NULL;
+  }
+  aStudyBuilder->CommitCommand();
+  return this;
+}
+
+
+//---------------------------------------------------------------
 void
 VISU::Mesh_i
 ::SameAs(const VISU::Prs3d_i* theOrigin)
@@ -213,87 +387,15 @@ VISU::Mesh_i
 }
 
 
-//----------------------------------------------------------------------------
-size_t
-VISU::Mesh_i
-::IsPossible(Result_i* theResult, 
-            const std::string& theMeshName,
-            Entity theEntity, 
-            const std::string& theFamilyName)
-{
-  try{
-    MESSAGE("Mesh_i::IsPossible - theMeshName = '"<<theMeshName<<"'; theEntity = "<<theEntity<<"; theFamilyName = '"<<theFamilyName<<"'");
-    size_t aSize = INCMEMORY*
-      theResult->GetInput()->GetMeshOnEntitySize(theMeshName,(VISU::TEntity)theEntity);
-    size_t aResult = VISU_PipeLine::CheckAvailableMemory(aSize);
-    MESSAGE("Mesh_i::IsPossible - CheckAvailableMemory = "<<float(aSize)<<"; aResult = "<<aResult);
-    return aResult;
-  }catch(std::exception& exc){
-    INFOS("Follow exception was occured :\n"<<exc.what());
-  }catch(...){
-    INFOS("Unknown exception was occured!");
-  }
-  return 0;
-}
-
 //----------------------------------------------------------------------------
 VISU::Storable* 
 VISU::Mesh_i
-::Create(const std::string& theMeshName,
-        Entity theEntity,
-        const std::string& theFamilyName)
-{
-  SetMeshName(theMeshName.c_str());
-  myEntity = int(theEntity);//jfa IPAL9284
-  mySubMeshName = theFamilyName;
-  return Build(false);
-}
-
-
-//----------------------------------------------------------------------------
-size_t 
-VISU::Mesh_i
-::IsPossible(Result_i* theResult, 
-            const std::string& theMeshName, 
-            const std::string& theGroupName)
+::Restore(SALOMEDS::Study_ptr theStudy,
+         const Storable::TRestoringMap& theMap)
 {
-  try{
-    MESSAGE("Mesh_i::IsPossible - theMeshName = '"<<theMeshName<<"'; theGroupName = '"<<theGroupName<<"'");
-    size_t aSize = INCMEMORY*
-      theResult->GetInput()->GetMeshOnGroupSize(theMeshName,theGroupName);
-    size_t aResult = VISU_PipeLine::CheckAvailableMemory(aSize);
-    INFOS("Mesh_i::IsPossible - CheckAvailableMemory = "<<float(aSize)<<"; aResult = "<<aResult);
-    return aResult;
-  }catch(std::exception& exc){
-    INFOS("Follow exception was occured :\n"<<exc.what());
-  }catch(...){
-    INFOS("Unknown exception was occured!");
-  }
-  return 0;
-}
-
-
-//----------------------------------------------------------------------------
-VISU::Storable* 
-VISU::Mesh_i
-::Create(const std::string& theMeshName,
-        const std::string& theGroupName)
-{
-  SetMeshName(theMeshName.c_str());
-  myEntity = -1;//jfa IPAL9284
-  mySubMeshName = theGroupName;
-  return Build(false);
-}
-
-
-//----------------------------------------------------------------------------
-VISU::Storable* 
-VISU::Mesh_i
-::Restore(const Storable::TRestoringMap& theMap)
-{
-  Prs3d_i::Restore(theMap);
+  if(!TSuperClass::Restore(theStudy, theMap))
+    return NULL;
 
-  SetMeshName(VISU::Storable::FindValue(theMap,"myMeshName").latin1());
   myEntity = VISU::Storable::FindValue(theMap,"myEntity").toInt();//jfa IPAL9284
   mySubMeshName = VISU::Storable::FindValue(theMap,"mySubMeshName").latin1();
 
@@ -315,14 +417,26 @@ VISU::Mesh_i
 }
 
 
+//----------------------------------------------------------------------------
+VISU::Storable*
+VISU::Mesh_i
+::Restore(SALOMEDS::SObject_ptr theSObject,
+         const string& thePrefix,
+         const Storable::TRestoringMap& theMap)
+{
+  Mesh_i* aMesh = new Mesh_i();
+  SALOMEDS::Study_var aStudy = theSObject->GetStudy();
+  return aMesh->Restore(aStudy, theMap);
+}
+
+
 //----------------------------------------------------------------------------
 void 
 VISU::Mesh_i
 ::ToStream(std::ostringstream& theStr)
 {
-  Prs3d_i::ToStream(theStr);
+  TSuperClass::ToStream(theStr);
 
-  Storable::DataToStream( theStr, "myMeshName", GetCMeshName() );
   Storable::DataToStream( theStr, "myEntity", myEntity );
   Storable::DataToStream( theStr, "mySubMeshName", mySubMeshName.c_str() );
 
@@ -342,116 +456,6 @@ VISU::Mesh_i
 }
 
 
-//----------------------------------------------------------------------------
-VISU::Mesh_i
-::~Mesh_i()
-{
-  if(MYDEBUG) MESSAGE("Mesh_i::~Mesh_i()");
-}
-
-
-//----------------------------------------------------------------------------
-VISU::Storable* 
-VISU::Mesh_i
-::Build(int theRestoring)
-{
-  SALOMEDS::StudyBuilder_var aStudyBuilder = GetStudyDocument()->NewBuilder();
-  aStudyBuilder->NewCommand();  // There is a transaction
-  try {
-    if (GetCResult()->GetInput() == NULL)
-      throw std::runtime_error("Mesh_i::Build - GetCResult()->GetInput() == NULL !!!");
-    if (!theRestoring) {
-      myPresentType =  VISU::PresentationType(VISU::GetResourceMgr()->integerValue("VISU" , "mesh_represent", 2));
-      if(myEntity == VISU::NODE_ENTITY)
-       myPresentType = VISU::POINT;
-      SetName(GenerateName().latin1(), false);
-      myCellColor.R = 0.0;  myCellColor.G = myCellColor.B = 1.0;
-      myNodeColor.R = myNodeColor.G = 1.0;  myNodeColor.B = 1.0;
-      myLinkColor.R = myLinkColor.G = myLinkColor.B = 83/255.;
-    }
-
-    if(myEntity >= 0)
-      if(mySubMeshName == "")
-       myType = VISU::TENTITY;
-      else
-       myType = VISU::TFAMILY;
-    else
-      myType = VISU::TGROUP;
-
-    if(MYDEBUG) MESSAGE("Mesh_i::Build - myType = "<<myType);
-    QString aComment,aTmp;
-
-    VISU::PIDMapper anIDMapper;
-    VISU::Result_i::TInput* anInput = GetCResult()->GetInput();
-    switch(myType){
-    case VISU::TENTITY :
-      anIDMapper = anInput->GetMeshOnEntity(GetCMeshName(),
-                                           (VISU::TEntity)myEntity);//jfa IPAL9284
-      aComment = "";
-      aComment.append(aTmp.sprintf("myComment=ENTITY;myType=%d;",VISU::TENTITY));
-      aComment.append("myMeshName=");
-      aComment.append(GetCMeshName().c_str());
-      aComment.append(";");
-      aComment.append(aTmp.sprintf("myId=%d",myEntity));
-      break;
-    case VISU::TFAMILY :
-      anIDMapper = anInput->GetFamilyOnEntity(GetCMeshName(),
-                                             (VISU::TEntity)myEntity,
-                                             mySubMeshName);
-      aComment = "";
-      aComment.append(aTmp.sprintf("myComment=FAMILY;myType=%d;",VISU::TFAMILY));
-      aComment.append("myMeshName=");
-      aComment.append(GetCMeshName().c_str());
-      aComment.append(";");
-      aComment.append(aTmp.sprintf("myEntityId=%d;",myEntity));
-      aComment.append("myName=");
-      aComment.append(mySubMeshName);
-      break;
-    case VISU::TGROUP :
-      anIDMapper = anInput->GetMeshOnGroup(GetCMeshName(),
-                                          mySubMeshName);
-      aComment = "";
-      aComment.append(aTmp.sprintf("myComment=GROUP;myType=%d;",VISU::TGROUP));
-      aComment.append("myMeshName=");
-      aComment.append(GetCMeshName().c_str());
-      aComment.append(";");
-      aComment.append("myName=");
-      aComment.append(mySubMeshName);
-      
-      break;
-    }
-    if(!anIDMapper) 
-      throw std::runtime_error("Mesh_i::Build - !anIDMapper !!!");
-
-    myMeshPL->SetIDMapper(anIDMapper);
-    myMeshPL->Build();
-
-    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);
-      CORBA::String_var aString = GetID();
-      anIOR->SetValue(aString);
-      SetSObject(aSObject);
-    }
-  }catch(std::exception& exc){
-    INFOS("Follow exception was occured :\n"<<exc.what());
-    return NULL;
-  }catch(...){
-    INFOS("Unknown exception was occured!");
-    return NULL;
-  }
-  aStudyBuilder->CommitCommand();
-  return this;
-}
-
-
 //----------------------------------------------------------------------------
 VISU_Actor* 
 VISU::Mesh_i
index d27262a58605304bc8a2f304205c1d4e8e347232..fd1b2958ce0a30053df6eaf474607c72fa791817 100644 (file)
@@ -38,18 +38,12 @@ namespace VISU
   {
     static int myNbPresent;
     Mesh_i(const Mesh_i&);
-    Mesh_i();
 
   public:
     typedef Prs3d_i TSuperClass;
     typedef VISU::Mesh TInterface;
 
-    explicit
-    Mesh_i(Result_i* theResult);
-
-    explicit
-    Mesh_i(Result_i* theResult,
-          SALOMEDS::SObject_ptr theSObject);
+    Mesh_i();
 
     virtual
     ~Mesh_i();
@@ -124,24 +118,26 @@ namespace VISU
   public:
     static 
     size_t
-    IsPossible(Result_i* theResult, 
+    IsPossible(VISU::Result_i* theResult, 
               const std::string& theMeshName,
               VISU::Entity theEntity, 
               const std::string& theFamilyName = "");
     virtual 
     Storable* 
-    Create(const std::string& theMeshName, 
+    Create(VISU::Result_i* theResult, 
+          const std::string& theMeshName, 
           VISU::Entity theEntity, 
           const std::string& theFamilyName = "");
 
     static 
     size_t
-    IsPossible(Result_i* theResult, 
+    IsPossible(VISU::Result_i* theResult, 
               const std::string& theMeshName, 
               const std::string& theGroupName);
     virtual 
     Storable* 
-    Create(const std::string& theMeshName, 
+    Create(VISU::Result_i* theResult, 
+          const std::string& theMeshName, 
           const std::string& theGroupName);
 
     VISU::Entity
@@ -166,8 +162,15 @@ namespace VISU
 
     virtual
     Storable* 
-    Restore(const Storable::TRestoringMap& theMap);
+    Restore(SALOMEDS::Study_ptr theStudy,
+           const Storable::TRestoringMap& theMap);
 
+    static 
+    Storable* 
+    Restore(SALOMEDS::SObject_ptr theSObject,
+           const std::string& thePrefix,
+           const Storable::TRestoringMap& theMap);
+    
     virtual
     VISU_Actor* 
     CreateActor();
index 2d4d8696ea5575310f41abe08a63b522515b8cfe..205f9563a0e4a485de7815625bab7e2ddb2b0f84 100644 (file)
@@ -75,26 +75,12 @@ VISU::Plot3D_i
 //---------------------------------------------------------------
 VISU::Plot3D_i
 ::Plot3D_i(EPublishInStudyMode thePublishInStudyMode) :
-  PrsObject_i(SALOMEDS::Study::_nil()),
-  Prs3d_i(),
   ColoredPrs3d_i(thePublishInStudyMode),
   ScalarMap_i(thePublishInStudyMode),
   myPlot3DPL(NULL)
 {}
 
 
-//---------------------------------------------------------------
-VISU::Plot3D_i
-::Plot3D_i(Result_i* theResult, 
-          SALOMEDS::SObject_var theSObject) :
-  PrsObject_i(theSObject->GetStudy()),
-  Prs3d_i(theResult,theSObject),
-  ColoredPrs3d_i(theResult,theSObject),
-  ScalarMap_i(theResult,theSObject),
-  myPlot3DPL(NULL)
-{}
-
-
 //---------------------------------------------------------------
 VISU::Storable* 
 VISU::Plot3D_i
@@ -110,9 +96,11 @@ VISU::Plot3D_i
 //---------------------------------------------------------------
 VISU::Storable* 
 VISU::Plot3D_i
-::Restore(const Storable::TRestoringMap& theMap)
+::Restore(SALOMEDS::Study_ptr theStudy,
+         const Storable::TRestoringMap& theMap)
 {
-  TSuperClass::Restore(theMap);
+  if(!TSuperClass::Restore(theStudy, theMap))
+    return NULL;
 
   SetOrientation(VISU::Plot3D::Orientation(VISU::Storable::FindValue(theMap,"myBasePlane").toInt()),
                 Storable::FindValue(theMap,"aRot[0]").toDouble(),
index 4a34b4ca1568146e668207548ec140ad0d8bca61..e87571c14339160b122cccfa2a56b22ad535237b 100644 (file)
@@ -39,9 +39,6 @@ namespace VISU
 
     explicit
     Plot3D_i(EPublishInStudyMode thePublishInStudyModep);
-    explicit
-    Plot3D_i(Result_i* theResult, 
-            SALOMEDS::SObject_var theSObject);
 
     virtual 
     ~Plot3D_i();
@@ -151,7 +148,8 @@ namespace VISU
 
     virtual
     Storable* 
-    Restore(const Storable::TRestoringMap& theMap);
+    Restore(SALOMEDS::Study_ptr theStudy,
+           const Storable::TRestoringMap& theMap);
 
     virtual 
     VISU_Actor* 
index 1f580b266a69e1b0d62b1bffbe33179b2a6862e0..ca2d29779166b77919acc4fc776a463631ccbd03 100644 (file)
@@ -51,9 +51,8 @@ VISU::Prs3d_i
 ::Prs3d_i() :
   PrsObject_i(SALOMEDS::Study::_nil()),
   myActorCollection(vtkActorCollection::New()),
-  mySObject(SALOMEDS::SObject::_nil()),
   myIsActiveSatate(true),
-  myResult(NULL)
+  myIsRestored(true)
 {
   if(MYDEBUG) MESSAGE("Prs3d_i::Prs3d_i - this = "<<this);
   myOffset[0] = myOffset[1] = myOffset[2] = 0;
@@ -61,26 +60,6 @@ VISU::Prs3d_i
 }
 
 
-//----------------------------------------------------------------------------
-VISU::Prs3d_i
-::Prs3d_i(Result_i* theResult,
-         SALOMEDS::SObject_var theSObject) :
-  PrsObject_i(theSObject->GetStudy()),
-  mySObject(theSObject),
-  myActorCollection(vtkActorCollection::New()),
-  myIsActiveSatate(true),
-  myResult(theResult)
-{
-  if(MYDEBUG) MESSAGE("Prs3d_i::Prs3d_i - this = "<<this);
-  myOffset[0] = myOffset[1] = myOffset[2] = 0;
-  myActorCollection->Delete();
-  if(theResult){
-    SetStudyDocument(theResult->GetStudyDocument());
-    theResult->Register();
-  }
-}
-
-
 //----------------------------------------------------------------------------
 void
 VISU::Prs3d_i
@@ -99,8 +78,6 @@ VISU::Prs3d_i
 {
   if(MYDEBUG) MESSAGE("Prs3d_i::~Prs3d_i - this = "<<this);
   myRemoveActorsFromRendererSignal();
-  if(myResult)
-    myResult->Destroy();
 }
 
 
@@ -109,17 +86,14 @@ bool
 VISU::Prs3d_i
 ::SetInput(bool theReInit)
 {
-  if(!myResult)
-    return false;
-
-  myPreviousResult = myResult;
-
-  if(myMeshName == "")
-    return false;
-
-  myPreviousMeshName = myMeshName;
-
-  return true;
+  if(GetCResult()){
+    if(myMeshName != ""){
+      myPreviousResult = myResult;
+      myPreviousMeshName = myMeshName;
+      return true;
+    }
+  }
+  return false;
 }
 
 
@@ -128,7 +102,7 @@ void
 VISU::Prs3d_i
 ::OnRestoreInput()
 {
-  myResult = myPreviousResult;
+  SetCResult(myPreviousResult.GetPointer());
   myMeshName = myPreviousMeshName;
 }
 
@@ -158,9 +132,10 @@ void
 VISU::Prs3d_i
 ::SetCResult(VISU::Result_i* theResult)
 {
-  if(myResult != theResult){
-    if(myResult)
-      myResult->Destroy();
+  VISU::Result_i* aResult = GetCResult();
+  if(aResult != theResult){
+    if(aResult)
+      aResult->Destroy();
     if(theResult){
       theResult->Register();
       SetStudyDocument(theResult->GetStudyDocument());
@@ -170,12 +145,30 @@ VISU::Prs3d_i
   }
 }
 
+//----------------------------------------------------------------------------
+void
+VISU::Prs3d_i
+::SetResultEntry(const std::string& theResultEntry)
+{
+  SetCResult(VISU::GetResult(GetStudyDocument(), theResultEntry));
+}
+
+//----------------------------------------------------------------------------
+std::string
+VISU::Prs3d_i
+::GetResultEntry()
+{
+  if(VISU::Result_i* aResult = GetCResult())
+    return aResult->GetEntry();
+  return "";
+}
+
 //----------------------------------------------------------------------------
 VISU::Result_i* 
 VISU::Prs3d_i
 ::GetCResult() const 
 { 
-  return myResult;
+  return myResult.GetPointer();
 }
 
 
@@ -193,7 +186,7 @@ VISU::Result_ptr
 VISU::Prs3d_i
 ::GetResultObject()
 {
-  return myResult->_this();
+  return GetCResult()->_this();
 }
 
 
@@ -263,8 +256,15 @@ VISU::Prs3d_i
 //----------------------------------------------------------------------------
 VISU::Storable* 
 VISU::Prs3d_i
-::Restore(const Storable::TRestoringMap& theMap)
+::Restore(SALOMEDS::Study_ptr theStudy,
+         const Storable::TRestoringMap& theMap)
 {
+  SetStudyDocument(theStudy);
+  SetResultEntry(VISU::Storable::FindValue(theMap,"myResultEntry").latin1());
+  if(!GetCResult())
+    return NULL;
+
+  SetMeshName(VISU::Storable::FindValue(theMap,"myMeshName").latin1());
   SetName(VISU::Storable::FindValue(theMap,"myName").latin1(), false);
   myOffset[0] = VISU::Storable::FindValue(theMap,"myOffset[0]").toFloat();
   myOffset[1] = VISU::Storable::FindValue(theMap,"myOffset[1]").toFloat();
@@ -273,12 +273,36 @@ VISU::Prs3d_i
   return this;
 }
 
+//----------------------------------------------------------------------------
+void
+VISU::Prs3d_i
+::SaveRestoringState(SALOMEDS::Study_ptr theStudy,
+                    const Storable::TRestoringMap& theMap)
+{
+  myRestoringStudy = theStudy;
+  myRestoringMap = theMap;
+  myIsRestored = false;
+}
+
+//----------------------------------------------------------------------------
+void
+VISU::Prs3d_i
+::InitFromRestoringState()
+{
+  if(!myIsRestored){
+    Restore(myRestoringStudy, myRestoringMap);
+    myIsRestored = true;
+  }
+}
+
 //----------------------------------------------------------------------------
 void
 VISU::Prs3d_i
 ::ToStream(std::ostringstream& theStr)
 {
-  Storable::DataToStream( theStr, "myName",   GetName().c_str() );
+  Storable::DataToStream( theStr, "myResultEntry", GetResultEntry() );
+  Storable::DataToStream( theStr, "myMeshName", GetCMeshName() );
+  Storable::DataToStream( theStr, "myName", GetName().c_str() );
   Storable::DataToStream( theStr, "myOffset[0]", myOffset[0] );
   Storable::DataToStream( theStr, "myOffset[1]", myOffset[1] );
   Storable::DataToStream( theStr, "myOffset[2]", myOffset[2] );
@@ -290,21 +314,12 @@ SALOMEDS::SObject_var
 VISU::Prs3d_i
 ::GetSObject()
 {
-  if(CORBA::is_nil(mySObject.in())){
-    const SALOMEDS::Study_var& aStudy = myResult->GetStudyDocument();
+  const SALOMEDS::Study_var& aStudy = GetStudyDocument();
+  if(CORBA::is_nil(aStudy.in())){
     CORBA::String_var anIOR = GetID();
-    mySObject = aStudy->FindObjectIOR(anIOR);
+    return aStudy->FindObjectIOR(anIOR);
   }
-  return mySObject;
-}
-
-
-//----------------------------------------------------------------------------
-void 
-VISU::Prs3d_i
-::SetSObject(SALOMEDS::SObject_var theSObject)
-{
-  mySObject = theSObject;
+  return SALOMEDS::SObject::_nil();
 }
 
 
@@ -643,13 +658,3 @@ VISU::Prs3d_i
   // Convert to mega bytes
   return aSize / (1024.0 * 1024.0);
 }
-
-//----------------------------------------------------------------------------
-VISU::Result_i* 
-VISU::GetResult(SALOMEDS::SObject_var theSObject)
-{
-  VISU::Result_var aResult = FindResult(theSObject);
-  if(!aResult->_is_nil())
-    return dynamic_cast<VISU::Result_i*>(VISU::GetServant(aResult.in()).in());
-  return NULL;
-}
index 71331db5ba5600de941872c23c223938b736ef9b..11cf5dabfc591c2b77a5bdc3a65f7e30798b6fe6 100644 (file)
@@ -32,7 +32,8 @@
 #include "VISU_ActorFactory.h"
 #include "VISU_ConvertorDef.hxx"
 
-#include "SALOME_GenericObj_i.hh"
+#include "SALOME_GenericObj.hh"
+#include "SALOME_GenericObjPointer.hh"
 #include "SALOME_InteractiveObject.hxx"
 
 #include "VTKViewer.h"
@@ -80,11 +81,6 @@ namespace VISU
     //! A constructor to create a fresh instance of the class
     Prs3d_i();
 
-    //! A constructor to restore an instance of the class
-    explicit
-    Prs3d_i(Result_i* theResult,
-           SALOMEDS::SObject_var theSObject);
-
     //! To create a deep copy from another instance of the class
     virtual
     void
@@ -136,15 +132,25 @@ namespace VISU
     QString
     GenerateName() = 0;
 
+    //! To save paramters of the instance to std::ostringstream
+    virtual
+    void
+    ToStream(std::ostringstream& theStr);
+
     //! To restore paramters of the instance from Storable::TRestoringMap
     virtual
     Storable* 
-    Restore(const Storable::TRestoringMap& theMap);
+    Restore(SALOMEDS::Study_ptr theStudy,
+           const Storable::TRestoringMap& theMap);
 
-    //! To save paramters of the instance to std::ostringstream
-    virtual
+    //! To keep restoring params till the explicit Restore() call
     void
-    ToStream(std::ostringstream& theStr);
+    SaveRestoringState(SALOMEDS::Study_ptr theStudy,
+                      const Storable::TRestoringMap& theMap);
+
+    //! To restore the presentation according to the saved state
+    void 
+    InitFromRestoringState();
 
     //----------------------------------------------------------------------------
     //! Get corresponding SALOMEDS::SObject
@@ -303,10 +309,6 @@ namespace VISU
     void
     CheckDataSet();
 
-    //! Used in derived classes to initilize the mySObject member
-    void 
-    SetSObject(SALOMEDS::SObject_var theSObject);
-
     //! Used in derived classes to initilize the myIO member
     void
     SetIO(const Handle(SALOME_InteractiveObject)& theIO);
@@ -316,16 +318,25 @@ namespace VISU
     vtkTimeStamp myParamsTime;
 
   private:
-    Result_i *myResult;
-    Result_i *myPreviousResult;
+    bool myIsRestored;
+    SALOMEDS::Study_var myRestoringStudy;
+    Storable::TRestoringMap myRestoringMap;
+
+    void
+    SetResultEntry(const std::string& theResultEntry);
+
+    std::string
+    GetResultEntry();
+
+    typedef SALOME::GenericObjPtr<VISU::Result_i> TResultPtr;
+    TResultPtr myResult;
+    TResultPtr myPreviousResult;
 
     std::string myMeshName;
     std::string myPreviousMeshName;
 
     CORBA::Float myOffset[3];
 
-    SALOMEDS::SObject_var mySObject;
-
     boost::signal0<void> myUpdateActorsSignal;
     boost::signal0<void> myRemoveActorsFromRendererSignal;
     vtkSmartPointer<vtkActorCollection> myActorCollection;
@@ -335,34 +346,16 @@ namespace VISU
     Handle(SALOME_InteractiveObject) myIO;
 
   private:
+    friend class ColoredPrs3dCache_i;
+
     //! Sets activity flag for the factory instance
     void
     SetActiveState(bool theState);
     
     bool myIsActiveSatate;
-
-    friend class ColoredPrs3dCache_i;
   };
 
   //----------------------------------------------------------------------------
-  Result_i* 
-  GetResult(SALOMEDS::SObject_var theSObject);
-
-  //----------------------------------------------------------------------------
-  template<class TPrs3d>
-  Storable* 
-  Restore(SALOMEDS::SObject_ptr theSObject,
-         const std::string& thePrefix,
-         const Storable::TRestoringMap& theMap)
-  {
-    if(VISU::Result_i* aResult = GetResult(theSObject)){
-      SALOMEDS::SObject_var aSObject = SALOMEDS::SObject::_duplicate(theSObject);
-      TPrs3d* aPrs3d = new TPrs3d(aResult,aSObject);
-      return aPrs3d->Restore(theMap);
-    }
-    return NULL;
-  }
-  //----------------------------------------------------------------------------
 }
 
 #endif
index c898cc6e375f5dbe0404f2e7fe8d46edfedbfe81..f12a48b8de3efef7a3081fdbaf81a6c195c76e91 100644 (file)
@@ -81,7 +81,7 @@ namespace VISU
   public:
     typedef RemovableObject_i TSuperClass;
 
-    PrsObject_i(SALOMEDS::Study_ptr theStudy);
+    PrsObject_i(SALOMEDS::Study_ptr theStudy = SALOMEDS::Study::_nil());
   };
 }
 
index 0587f81d904c4c006f3586cc7c33e5e959758bd2..818523ccb6209518581748ef411066fd679288dc 100644 (file)
@@ -96,6 +96,20 @@ namespace VISU
   }
 
 
+  //---------------------------------------------------------------
+  Result_i* 
+  GetResult(SALOMEDS::Study_ptr theStudy,
+           const std::string& theResultEntry)
+  {
+    if(CORBA::is_nil(theStudy))
+      return NULL;
+
+    SALOMEDS::SObject_var aSObject = theStudy->FindObjectID(theResultEntry.c_str());
+    CORBA::Object_var anObject = SObjectToObject(aSObject);
+    return dynamic_cast<VISU::Result_i*>(GetServant(anObject).in());
+  }
+
+
   //---------------------------------------------------------------
   typedef boost::recursive_mutex TMutex;
   typedef TMutex::scoped_lock TLock;
@@ -1503,12 +1517,12 @@ VISU::Result_i
   return "";
 }
 
-string
+std::string
 VISU::Result_i
 ::GetEntry()
 {
   CORBA::String_var anEntry = mySObject->GetID();
-  return string(anEntry);
+  return anEntry.in();
 }
 
 const SALOMEDS::SObject_var& 
index 370d146d98dc4dff145348a2194ea3087166f0e8..c29903c2838c6e1fbdc2fac23df21fc5f178eff0 100644 (file)
@@ -191,7 +191,14 @@ namespace VISU
     std::map< std::string, TGridInfo > myMeshName2GridInfoMap;
   };
 
-  Result_var FindResult(SALOMEDS::SObject_ptr theSObject);
+  //! To find Result object as published on father of the given SObject
+  Result_var 
+  FindResult(SALOMEDS::SObject_ptr theSObject);
+
+  //! To get VISU::Result object published on the given SALOMEDS::SObject
+  Result_i* 
+  GetResult(SALOMEDS::Study_ptr theStudy,
+           const std::string& theResultEntry);
 }
 
 #endif
index 11c12cfba1b50eb67f0c7c51a44553319db2ab70..9314cbc7a1fe67d3ca77785aa2529e206b2b78da 100644 (file)
@@ -112,28 +112,16 @@ VISU::ScalarMapOnDeformedShape_i
   return myComment.c_str();
 }
 
+
 //---------------------------------------------------------------
 VISU::ScalarMapOnDeformedShape_i
 ::ScalarMapOnDeformedShape_i(EPublishInStudyMode thePublishInStudyMode) :
-  PrsObject_i(SALOMEDS::Study::_nil()), 
-  Prs3d_i(),
   ColoredPrs3d_i(thePublishInStudyMode),
   ScalarMap_i(thePublishInStudyMode),
   myScalarMapOnDeformedShapePL(NULL),
   myScalarIteration(1)
 {}
 
-//---------------------------------------------------------------
-VISU::ScalarMapOnDeformedShape_i
-::ScalarMapOnDeformedShape_i(Result_i* theResult, 
-                            SALOMEDS::SObject_var theSObject):
-  PrsObject_i(theSObject->GetStudy()), 
-  Prs3d_i(theResult,theSObject),
-  ColoredPrs3d_i(theResult,theSObject),
-  ScalarMap_i(theResult,theSObject),
-  myScalarMapOnDeformedShapePL(NULL),
-  myScalarIteration(1)
-{}
 
 //---------------------------------------------------------------
 VISU::Storable* 
@@ -159,9 +147,11 @@ VISU::ScalarMapOnDeformedShape_i
 //---------------------------------------------------------------
 VISU::Storable* 
 VISU::ScalarMapOnDeformedShape_i
-::Restore(const Storable::TRestoringMap& theMap)
+::Restore(SALOMEDS::Study_ptr theStudy,
+         const Storable::TRestoringMap& theMap)
 {
-  TSuperClass::Restore(theMap);
+  if(!TSuperClass::Restore(theStudy, theMap))
+    return NULL;
   
   SetScalarFieldName(VISU::Storable::FindValue(theMap,"myScalarFieldName"));
   SetScalarMeshName(VISU::Storable::FindValue(theMap,"myScalarMeshName"));
index 7a6ad5154fc48a42ed95880f172ffc65a9307710..8be0305f1ea26e698bd2b2acdfe6ae5617633e66 100644 (file)
@@ -48,13 +48,13 @@ namespace VISU
     
     explicit
     ScalarMapOnDeformedShape_i(EPublishInStudyMode thePublishInStudyModep);
-    explicit
-    ScalarMapOnDeformedShape_i(Result_i* theResult,
-                              SALOMEDS::SObject_var theSObject);
     
-    virtual ~ScalarMapOnDeformedShape_i();
+    virtual
+    ~ScalarMapOnDeformedShape_i();
 
-    virtual VISU::VISUType GetType()
+    virtual
+    VISU::VISUType
+    GetType()
     { 
       return VISU::TSCALARMAPONDEFORMEDSHAPE;
     }
@@ -141,14 +141,9 @@ namespace VISU
     //! Redefines VISU_ColoredPrs3d_i::Restore
     virtual
     Storable* 
-    Restore(const Storable::TRestoringMap& theMap);
-    
-    static
-    Storable* 
-    Restore(SALOMEDS::SObject_ptr theSObject,
-           const std::string& thePrefix, 
+    Restore(SALOMEDS::Study_ptr theStudy,
            const Storable::TRestoringMap& theMap);
-
+    
     static const std::string myComment;
 
     virtual
index 0742fb911c7e10bd7a899ff19d8116025fc929ff..d72072fb70da1c95b86cb02f961e7a62c1520d8e 100644 (file)
@@ -106,20 +106,9 @@ VISU::ScalarMap_i
 //----------------------------------------------------------------------------
 VISU::ScalarMap_i::
 ScalarMap_i(EPublishInStudyMode thePublishInStudyMode) :
-  PrsObject_i(SALOMEDS::Study::_nil()),
-  Prs3d_i(),
   ColoredPrs3d_i(thePublishInStudyMode)
 {}
 
-//----------------------------------------------------------------------------
-VISU::ScalarMap_i::
-ScalarMap_i(Result_i* theResult,
-           SALOMEDS::SObject_var theSObject) :
-  PrsObject_i(theSObject->GetStudy()),
-  Prs3d_i(theResult,theSObject),
-  ColoredPrs3d_i(theResult,theSObject)
-{}
-
 //----------------------------------------------------------------------------
 VISU::ScalarMap_i
 ::~ScalarMap_i()
@@ -203,9 +192,11 @@ VISU::ScalarMap_i
 //----------------------------------------------------------------------------
 VISU::Storable* 
 VISU::ScalarMap_i
-::Restore(const Storable::TRestoringMap& theMap)
+::Restore(SALOMEDS::Study_ptr theStudy,
+         const Storable::TRestoringMap& theMap)
 {
-  TSuperClass::Restore(theMap);
+  if(!TSuperClass::Restore(theStudy, theMap))
+    return NULL;
 
   SetScaling(VISU::Scaling(VISU::Storable::FindValue(theMap,"myScaling").toInt()));
 
index c8515e20324e9036fb2b1fee1d1303b53764aaab..81836445baaa99b904ea763bc393918f34af9208 100644 (file)
@@ -47,9 +47,7 @@ namespace VISU
 
     explicit
     ScalarMap_i(EPublishInStudyMode thePublishInStudyModep);
-    explicit
-    ScalarMap_i(Result_i* theResult,
-               SALOMEDS::SObject_var theSObject);
+
     virtual
     ~ScalarMap_i();
 
@@ -141,12 +139,7 @@ namespace VISU
 
     virtual 
     Storable* 
-    Restore(const Storable::TRestoringMap& theMap);
-
-    static 
-    Storable* 
-    Restore(SALOMEDS::SObject_ptr theSObject,
-           const std::string& thePrefix, 
+    Restore(SALOMEDS::Study_ptr theStudy,
            const Storable::TRestoringMap& theMap);
 
     virtual
index 393b79faa7fea947a7afe3a146a2e1a970c930c1..f7ffe872df285e8f2758834820e48b8e150763c5 100644 (file)
@@ -99,8 +99,6 @@ VISU::StreamLines_i
 //---------------------------------------------------------------
 VISU::StreamLines_i
 ::StreamLines_i(EPublishInStudyMode thePublishInStudyMode) :
-  PrsObject_i(SALOMEDS::Study::_nil()), 
-  Prs3d_i(),
   ColoredPrs3d_i(thePublishInStudyMode),
   ScalarMap_i(thePublishInStudyMode),
   DeformedShape_i(thePublishInStudyMode),
@@ -109,20 +107,6 @@ VISU::StreamLines_i
 {}
 
 
-//---------------------------------------------------------------
-VISU::StreamLines_i
-::StreamLines_i(Result_i* theResult, 
-               SALOMEDS::SObject_var theSObject) :
-  PrsObject_i(theSObject->GetStudy()), 
-  Prs3d_i(theResult,theSObject),
-  ColoredPrs3d_i(theResult,theSObject),
-  ScalarMap_i(theResult,theSObject),
-  DeformedShape_i(theResult,theSObject),
-  myStreamLinesPL(NULL),
-  myAppendFilter(vtkAppendFilter::New())
-{}
-
-
 //---------------------------------------------------------------
 void
 VISU::StreamLines_i
@@ -152,9 +136,11 @@ VISU::StreamLines_i
 //---------------------------------------------------------------
 VISU::Storable* 
 VISU::StreamLines_i
-::Restore(const Storable::TRestoringMap& theMap)
+::Restore(SALOMEDS::Study_ptr theStudy,
+         const Storable::TRestoringMap& theMap)
 {
-  TSuperClass::Restore(theMap);
+  if(!TSuperClass::Restore(theStudy, theMap))
+    return NULL;
 
   double anIntegrationStep = VISU::Storable::FindValue(theMap,"myIntegrationStep").toDouble();
   double aPropagationTime = VISU::Storable::FindValue(theMap,"myPropagationTime").toDouble();
index 6aec9ba0e51d926bacec085fdf697c84907783a7..8815eaf7109f8763b2c0d33200414b54c402a8c4 100644 (file)
@@ -46,9 +46,6 @@ namespace VISU
 
     explicit
     StreamLines_i(EPublishInStudyMode thePublishInStudyModep);
-    explicit
-    StreamLines_i(Result_i* theResult,
-                 SALOMEDS::SObject_var theSObject);
 
     virtual
     void
@@ -168,7 +165,8 @@ namespace VISU
     //! Extends VISU_ColoredPrs3d_i::Restore
     virtual 
     Storable* 
-    Restore(const Storable::TRestoringMap& theMap);
+    Restore(SALOMEDS::Study_ptr theStudy,
+           const Storable::TRestoringMap& theMap);
 
     //! Extends VISU_ColoredPrs3d_i::Update
     virtual 
index ee9b07cedead34362a5d653321d76db9469af020..0f59e786f210db4c0f5a3ae59944d1f114d4a87a 100644 (file)
@@ -1111,7 +1111,7 @@ void VISU_TimeAnimation::restoreFromStudy(_PTR(SObject) theField)
       VISU::Storable::TRestoringMap aPrsMap;
       VISU::Storable::StrToMap(strPrsIn,aPrsMap);
 
-      aData.myPrs[0]->Restore(aPrsMap);
+      aData.myPrs[0]->Restore(VISU::GetDSStudy(myStudy), aPrsMap);
     }
     aData.myPrs[0]->GetOffset(aData.myOffset);
     for (int i = 1; i < aData.myNbFrames; i++) {
index 7a95878b392d2ff5ce2001df31b3ecc6837a2be9..da4b789a02a7b157067ab75554ae2d6a79ccdd01 100644 (file)
@@ -107,8 +107,6 @@ VISU::Vectors_i
 //---------------------------------------------------------------
 VISU::Vectors_i
 ::Vectors_i(EPublishInStudyMode thePublishInStudyMode) :
-  PrsObject_i(SALOMEDS::Study::_nil()), 
-  Prs3d_i(),
   ColoredPrs3d_i(thePublishInStudyMode),
   ScalarMap_i(thePublishInStudyMode),
   DeformedShape_i(thePublishInStudyMode),
@@ -117,20 +115,6 @@ VISU::Vectors_i
 {}
 
 
-//---------------------------------------------------------------
-VISU::Vectors_i
-::Vectors_i(Result_i* theResult, 
-           SALOMEDS::SObject_var theSObject) :
-  PrsObject_i(theSObject->GetStudy()), 
-  Prs3d_i(theResult,theSObject),
-  ColoredPrs3d_i(theResult,theSObject),
-  ScalarMap_i(theResult,theSObject),
-  DeformedShape_i(theResult,theSObject),
-  myLineWidth(1.0),
-  myVectorsPL(NULL)
-{}
-
-
 //---------------------------------------------------------------
 void
 VISU::Vectors_i
@@ -160,9 +144,11 @@ VISU::Vectors_i
 //---------------------------------------------------------------
 VISU::Storable* 
 VISU::Vectors_i
-::Restore(const Storable::TRestoringMap& theMap)
+::Restore(SALOMEDS::Study_ptr theStudy,
+         const Storable::TRestoringMap& theMap)
 {
-  TSuperClass::Restore(theMap);
+  if(!TSuperClass::Restore(theStudy, theMap))
+    return NULL;
 
   SetGlyphType(VISU::Vectors::GlyphType(VISU::Storable::FindValue(theMap,"myTypeGlyph").toInt()));
   SetGlyphPos(VISU::Vectors::GlyphPos(VISU::Storable::FindValue(theMap,"myPosGlyph").toInt()));
index c84c2837ed30213b5b00182cf10ce1637c988fea..f37080cedd3a77587821cb605e8931c49691e802 100644 (file)
@@ -45,9 +45,6 @@ namespace VISU
 
     explicit
     Vectors_i(EPublishInStudyMode thePublishInStudyModep);
-    explicit
-    Vectors_i(Result_i* theResult,
-             SALOMEDS::SObject_var theSObject);
 
     virtual
     void
@@ -140,7 +137,8 @@ namespace VISU
     //! Redefines VISU_ColoredPrs3d_i::Restore
     virtual
     Storable* 
-    Restore(const Storable::TRestoringMap& theMap);
+    Restore(SALOMEDS::Study_ptr theStudy,
+           const Storable::TRestoringMap& theMap);
 
     static const std::string myComment;