From: apo Date: Thu, 21 Dec 2006 16:16:03 +0000 (+0000) Subject: To implement persistent for the Holder objects X-Git-Tag: WP1_2_3_25-12-2006_persistent_for_cache~5 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=6792ea58fa4f1e32f2a60e20f16a87b8f4621db9;p=modules%2Fvisu.git To implement persistent for the Holder objects --- diff --git a/src/VISU_I/Makefile.in b/src/VISU_I/Makefile.in index 5c427a1c..f05f455f 100644 --- a/src/VISU_I/Makefile.in +++ b/src/VISU_I/Makefile.in @@ -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 diff --git a/src/VISU_I/VISUConfig.cc b/src/VISU_I/VISUConfig.cc index d622e56b..81e7492d 100644 --- a/src/VISU_I/VISUConfig.cc +++ b/src/VISU_I/VISUConfig.cc @@ -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; } diff --git a/src/VISU_I/VISU_ColoredPrs3dCache_i.cc b/src/VISU_I/VISU_ColoredPrs3dCache_i.cc index ea4f40c6..79e780fe 100644 --- a/src/VISU_I/VISU_ColoredPrs3dCache_i.cc +++ b/src/VISU_I/VISU_ColoredPrs3dCache_i.cc @@ -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()); } diff --git a/src/VISU_I/VISU_ColoredPrs3dCache_i.hh b/src/VISU_I/VISU_ColoredPrs3dCache_i.hh index 9e9ee833..7c3271fe 100644 --- a/src/VISU_I/VISU_ColoredPrs3dCache_i.hh +++ b/src/VISU_I/VISU_ColoredPrs3dCache_i.hh @@ -37,7 +37,29 @@ namespace VISU class ColoredPrs3d_i; class ColoredPrs3dHolder_i; - typedef SALOME::GenericObjPtr TPrs3dPtr; + struct TPrs3dPtr: SALOME::GenericObjPtr + { + typedef SALOME::GenericObjPtr 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 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* diff --git a/src/VISU_I/VISU_ColoredPrs3dHolder_i.cc b/src/VISU_I/VISU_ColoredPrs3dHolder_i.cc index 72aab60f..afb4a99a 100644 --- a/src/VISU_I/VISU_ColoredPrs3dHolder_i.cc +++ b/src/VISU_I/VISU_ColoredPrs3dHolder_i.cc @@ -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::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::GetServant(aHolder).in() ); - - return aHolderImpl->Restore(theSObject,theMap,thePrefix); - */ return NULL; } diff --git a/src/VISU_I/VISU_ColoredPrs3dHolder_i.hh b/src/VISU_I/VISU_ColoredPrs3dHolder_i.hh index a47a46b4..f2bb397e 100644 --- a/src/VISU_I/VISU_ColoredPrs3dHolder_i.hh +++ b/src/VISU_I/VISU_ColoredPrs3dHolder_i.hh @@ -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, diff --git a/src/VISU_I/VISU_ColoredPrs3d_i.cc b/src/VISU_I/VISU_ColoredPrs3d_i.cc index acebf2cf..01e20230 100644 --- a/src/VISU_I/VISU_ColoredPrs3d_i.cc +++ b/src/VISU_I/VISU_ColoredPrs3d_i.cc @@ -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){ diff --git a/src/VISU_I/VISU_ColoredPrs3d_i.hh b/src/VISU_I/VISU_ColoredPrs3d_i.hh index c8254076..f715a7d3 100644 --- a/src/VISU_I/VISU_ColoredPrs3d_i.hh +++ b/src/VISU_I/VISU_ColoredPrs3d_i.hh @@ -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 + 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 diff --git a/src/VISU_I/VISU_CutLines_i.cc b/src/VISU_I/VISU_CutLines_i.cc index eba9b965..d09bc322 100644 --- a/src/VISU_I/VISU_CutLines_i.cc +++ b/src/VISU_I/VISU_CutLines_i.cc @@ -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()); diff --git a/src/VISU_I/VISU_CutLines_i.hh b/src/VISU_I/VISU_CutLines_i.hh index fc2c11d1..216e7a66 100644 --- a/src/VISU_I/VISU_CutLines_i.hh +++ b/src/VISU_I/VISU_CutLines_i.hh @@ -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 diff --git a/src/VISU_I/VISU_CutPlanes_i.cc b/src/VISU_I/VISU_CutPlanes_i.cc index c19a4b94..a0fb3197 100644 --- a/src/VISU_I/VISU_CutPlanes_i.cc +++ b/src/VISU_I/VISU_CutPlanes_i.cc @@ -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()); diff --git a/src/VISU_I/VISU_CutPlanes_i.hh b/src/VISU_I/VISU_CutPlanes_i.hh index 45f23f9a..6f58872d 100644 --- a/src/VISU_I/VISU_CutPlanes_i.hh +++ b/src/VISU_I/VISU_CutPlanes_i.hh @@ -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 diff --git a/src/VISU_I/VISU_DeformedShape_i.cc b/src/VISU_I/VISU_DeformedShape_i.cc index 9f7f3969..a41f512e 100644 --- a/src/VISU_I/VISU_DeformedShape_i.cc +++ b/src/VISU_I/VISU_DeformedShape_i.cc @@ -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(); diff --git a/src/VISU_I/VISU_DeformedShape_i.hh b/src/VISU_I/VISU_DeformedShape_i.hh index 3cf54aa3..5f3d79cd 100644 --- a/src/VISU_I/VISU_DeformedShape_i.hh +++ b/src/VISU_I/VISU_DeformedShape_i.hh @@ -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 diff --git a/src/VISU_I/VISU_GaussPoints_i.cc b/src/VISU_I/VISU_GaussPoints_i.cc index 778d0526..13c95cfb 100644 --- a/src/VISU_I/VISU_GaussPoints_i.cc +++ b/src/VISU_I/VISU_GaussPoints_i.cc @@ -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 = "<)); + Storable::Registry(Mesh_i::myComment.c_str(),&(Mesh_i::Restore)); Storable::Registry(ScalarMap_i::myComment.c_str(),&(Restore)); Storable::Registry(GaussPoints_i::myComment.c_str(),&(Restore)); Storable::Registry(DeformedShape_i::myComment.c_str(),&(Restore)); @@ -848,10 +848,10 @@ namespace VISU { if(myStudyDocument->GetProperties()->IsLocked()) return Mesh::_nil(); - Mutex mt(myMutex); - if(Result_i* pResult = dynamic_cast(GetServant(theResult).in())){ - Mesh_i* aPresent = new Mesh_i(pResult); - if(aPresent->Create(theMeshName,theEntity) != NULL) + + if(Result_i* aResult = dynamic_cast(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(GetServant(theResult).in())){ - Mesh_i* aPresent = new Mesh_i(pResult); - if(aPresent->Create(theMeshName,theEntity,theFamilyName) != NULL) + + if(Result_i* aResult = dynamic_cast(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(GetServant(theResult).in())){ - Mesh_i* aPresent = new Mesh_i(pResult); - if(aPresent->Create(theMeshName,theGroupName) != NULL) + + if(Result_i* aResult = dynamic_cast(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(theResult,theMeshName,theEntity,theFieldName,theIteration)._retn(); + return Prs3dOnField(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(theResult,theMeshName,theEntity,theFieldName,theIteration)._retn(); + return Prs3dOnField(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(theResult,theMeshName,theEntity,theFieldName,theIteration)._retn(); + return Prs3dOnField(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(theResult,theMeshName,theEntity,theFieldName,theIteration)._retn(); + return Prs3dOnField(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(theResult,theMeshName,theEntity,theFieldName,theIteration)._retn(); + return Prs3dOnField(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(theResult,theMeshName,theEntity,theFieldName,theIteration)._retn(); + return Prs3dOnField(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(theResult,theMeshName,theEntity,theFieldName,theIteration)._retn(); + return Prs3dOnField(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(theResult,theMeshName,theEntity,theFieldName,theIteration)._retn(); + return Prs3dOnField(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(theResult,theMeshName,theEntity,theFieldName,theIteration)._retn(); + return Prs3dOnField(theResult, + theMeshName, + theEntity, + theFieldName, + theIteration)._retn(); } Table_ptr VISU_Gen_i::CreateTable(const char* theTableEntry){ diff --git a/src/VISU_I/VISU_IsoSurfaces_i.cc b/src/VISU_I/VISU_IsoSurfaces_i.cc index 4e97cdd7..b1e533e1 100644 --- a/src/VISU_I/VISU_IsoSurfaces_i.cc +++ b/src/VISU_I/VISU_IsoSurfaces_i.cc @@ -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(); diff --git a/src/VISU_I/VISU_IsoSurfaces_i.hh b/src/VISU_I/VISU_IsoSurfaces_i.hh index 4723ebbc..0daa2b2c 100644 --- a/src/VISU_I/VISU_IsoSurfaces_i.hh +++ b/src/VISU_I/VISU_IsoSurfaces_i.hh @@ -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* diff --git a/src/VISU_I/VISU_Mesh_i.cc b/src/VISU_I/VISU_Mesh_i.cc index 2a75b5c3..a88515f5 100644 --- a/src/VISU_I/VISU_Mesh_i.cc +++ b/src/VISU_I/VISU_Mesh_i.cc @@ -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 = '"<GetInput()->GetMeshOnEntitySize(theMeshName,(VISU::TEntity)theEntity); + size_t aResult = VISU_PipeLine::CheckAvailableMemory(aSize); + MESSAGE("Mesh_i::IsPossible - CheckAvailableMemory = "<GetInput()->GetMeshOnGroupSize(theMeshName,theGroupName); + size_t aResult = VISU_PipeLine::CheckAvailableMemory(aSize); + INFOS("Mesh_i::IsPossible - CheckAvailableMemory = "<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 = "<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"<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 = '"<GetInput()->GetMeshOnEntitySize(theMeshName,(VISU::TEntity)theEntity); - size_t aResult = VISU_PipeLine::CheckAvailableMemory(aSize); - MESSAGE("Mesh_i::IsPossible - CheckAvailableMemory = "<GetInput()->GetMeshOnGroupSize(theMeshName,theGroupName); - size_t aResult = VISU_PipeLine::CheckAvailableMemory(aSize); - INFOS("Mesh_i::IsPossible - CheckAvailableMemory = "<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 = "<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"<CommitCommand(); - return this; -} - - //---------------------------------------------------------------------------- VISU_Actor* VISU::Mesh_i diff --git a/src/VISU_I/VISU_Mesh_i.hh b/src/VISU_I/VISU_Mesh_i.hh index d27262a5..fd1b2958 100644 --- a/src/VISU_I/VISU_Mesh_i.hh +++ b/src/VISU_I/VISU_Mesh_i.hh @@ -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(); diff --git a/src/VISU_I/VISU_Plot3D_i.cc b/src/VISU_I/VISU_Plot3D_i.cc index 2d4d8696..205f9563 100644 --- a/src/VISU_I/VISU_Plot3D_i.cc +++ b/src/VISU_I/VISU_Plot3D_i.cc @@ -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(), diff --git a/src/VISU_I/VISU_Plot3D_i.hh b/src/VISU_I/VISU_Plot3D_i.hh index 4a34b4ca..e87571c1 100644 --- a/src/VISU_I/VISU_Plot3D_i.hh +++ b/src/VISU_I/VISU_Plot3D_i.hh @@ -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* diff --git a/src/VISU_I/VISU_Prs3d_i.cc b/src/VISU_I/VISU_Prs3d_i.cc index 1f580b26..ca2d2977 100644 --- a/src/VISU_I/VISU_Prs3d_i.cc +++ b/src/VISU_I/VISU_Prs3d_i.cc @@ -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 = "<GetStudy()), - mySObject(theSObject), - myActorCollection(vtkActorCollection::New()), - myIsActiveSatate(true), - myResult(theResult) -{ - if(MYDEBUG) MESSAGE("Prs3d_i::Prs3d_i - this = "<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 = "<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::GetServant(aResult.in()).in()); - return NULL; -} diff --git a/src/VISU_I/VISU_Prs3d_i.hh b/src/VISU_I/VISU_Prs3d_i.hh index 71331db5..11cf5dab 100644 --- a/src/VISU_I/VISU_Prs3d_i.hh +++ b/src/VISU_I/VISU_Prs3d_i.hh @@ -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 TResultPtr; + TResultPtr myResult; + TResultPtr myPreviousResult; std::string myMeshName; std::string myPreviousMeshName; CORBA::Float myOffset[3]; - SALOMEDS::SObject_var mySObject; - boost::signal0 myUpdateActorsSignal; boost::signal0 myRemoveActorsFromRendererSignal; vtkSmartPointer 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 - 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 diff --git a/src/VISU_I/VISU_PrsObject_i.hh b/src/VISU_I/VISU_PrsObject_i.hh index c898cc6e..f12a48b8 100644 --- a/src/VISU_I/VISU_PrsObject_i.hh +++ b/src/VISU_I/VISU_PrsObject_i.hh @@ -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()); }; } diff --git a/src/VISU_I/VISU_Result_i.cc b/src/VISU_I/VISU_Result_i.cc index 0587f81d..818523cc 100644 --- a/src/VISU_I/VISU_Result_i.cc +++ b/src/VISU_I/VISU_Result_i.cc @@ -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(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& diff --git a/src/VISU_I/VISU_Result_i.hh b/src/VISU_I/VISU_Result_i.hh index 370d146d..c29903c2 100644 --- a/src/VISU_I/VISU_Result_i.hh +++ b/src/VISU_I/VISU_Result_i.hh @@ -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 diff --git a/src/VISU_I/VISU_ScalarMapOnDeformedShape_i.cc b/src/VISU_I/VISU_ScalarMapOnDeformedShape_i.cc index 11c12cfb..9314cbc7 100644 --- a/src/VISU_I/VISU_ScalarMapOnDeformedShape_i.cc +++ b/src/VISU_I/VISU_ScalarMapOnDeformedShape_i.cc @@ -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")); diff --git a/src/VISU_I/VISU_ScalarMapOnDeformedShape_i.hh b/src/VISU_I/VISU_ScalarMapOnDeformedShape_i.hh index 7a6ad515..8be0305f 100644 --- a/src/VISU_I/VISU_ScalarMapOnDeformedShape_i.hh +++ b/src/VISU_I/VISU_ScalarMapOnDeformedShape_i.hh @@ -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 diff --git a/src/VISU_I/VISU_ScalarMap_i.cc b/src/VISU_I/VISU_ScalarMap_i.cc index 0742fb91..d72072fb 100644 --- a/src/VISU_I/VISU_ScalarMap_i.cc +++ b/src/VISU_I/VISU_ScalarMap_i.cc @@ -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())); diff --git a/src/VISU_I/VISU_ScalarMap_i.hh b/src/VISU_I/VISU_ScalarMap_i.hh index c8515e20..81836445 100644 --- a/src/VISU_I/VISU_ScalarMap_i.hh +++ b/src/VISU_I/VISU_ScalarMap_i.hh @@ -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 diff --git a/src/VISU_I/VISU_StreamLines_i.cc b/src/VISU_I/VISU_StreamLines_i.cc index 393b79fa..f7ffe872 100644 --- a/src/VISU_I/VISU_StreamLines_i.cc +++ b/src/VISU_I/VISU_StreamLines_i.cc @@ -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(); diff --git a/src/VISU_I/VISU_StreamLines_i.hh b/src/VISU_I/VISU_StreamLines_i.hh index 6aec9ba0..8815eaf7 100644 --- a/src/VISU_I/VISU_StreamLines_i.hh +++ b/src/VISU_I/VISU_StreamLines_i.hh @@ -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 diff --git a/src/VISU_I/VISU_TimeAnimation.cxx b/src/VISU_I/VISU_TimeAnimation.cxx index ee9b07ce..0f59e786 100644 --- a/src/VISU_I/VISU_TimeAnimation.cxx +++ b/src/VISU_I/VISU_TimeAnimation.cxx @@ -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++) { diff --git a/src/VISU_I/VISU_Vectors_i.cc b/src/VISU_I/VISU_Vectors_i.cc index 7a95878b..da4b789a 100644 --- a/src/VISU_I/VISU_Vectors_i.cc +++ b/src/VISU_I/VISU_Vectors_i.cc @@ -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())); diff --git a/src/VISU_I/VISU_Vectors_i.hh b/src/VISU_I/VISU_Vectors_i.hh index c84c2837..f37080ce 100644 --- a/src/VISU_I/VISU_Vectors_i.hh +++ b/src/VISU_I/VISU_Vectors_i.hh @@ -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;