From d0f085401ff963438e925afee177f9c726207a66 Mon Sep 17 00:00:00 2001 From: apo Date: Wed, 30 May 2007 14:50:18 +0000 Subject: [PATCH] Fix for Bug IPAL16080 - IOLS. Impossible to display and edit presentations created in 3x --- src/VISU_I/VISUConfig.cc | 115 ++++++++++++++++-- src/VISU_I/VISUConfig.hh | 4 + src/VISU_I/VISU_ColoredPrs3dHolder_i.cc | 2 +- src/VISU_I/VISU_ColoredPrs3d_i.cc | 32 ++++- src/VISU_I/VISU_ColoredPrs3d_i.hh | 18 ++- src/VISU_I/VISU_CutLines_i.cc | 4 +- src/VISU_I/VISU_CutLines_i.hh | 2 +- src/VISU_I/VISU_CutPlanes_i.cc | 4 +- src/VISU_I/VISU_CutPlanes_i.hh | 2 +- src/VISU_I/VISU_DeformedShape_i.cc | 4 +- src/VISU_I/VISU_DeformedShape_i.hh | 2 +- src/VISU_I/VISU_GaussPoints_i.cc | 4 +- src/VISU_I/VISU_GaussPoints_i.hh | 2 +- src/VISU_I/VISU_Gen_i.cc | 55 +-------- src/VISU_I/VISU_IsoSurfaces_i.cc | 4 +- src/VISU_I/VISU_IsoSurfaces_i.hh | 2 +- src/VISU_I/VISU_Mesh_i.cc | 18 +-- src/VISU_I/VISU_Mesh_i.hh | 2 +- src/VISU_I/VISU_Plot3D_i.cc | 4 +- src/VISU_I/VISU_Plot3D_i.hh | 2 +- src/VISU_I/VISU_Prs3d_i.cc | 48 ++++---- src/VISU_I/VISU_Prs3d_i.hh | 15 +-- src/VISU_I/VISU_ScalarMapOnDeformedShape_i.cc | 4 +- src/VISU_I/VISU_ScalarMapOnDeformedShape_i.hh | 2 +- src/VISU_I/VISU_ScalarMap_i.cc | 4 +- src/VISU_I/VISU_ScalarMap_i.hh | 2 +- src/VISU_I/VISU_StreamLines_i.cc | 4 +- src/VISU_I/VISU_StreamLines_i.hh | 2 +- src/VISU_I/VISU_TimeAnimation.cxx | 5 +- src/VISU_I/VISU_Vectors_i.cc | 4 +- src/VISU_I/VISU_Vectors_i.hh | 2 +- 31 files changed, 222 insertions(+), 152 deletions(-) diff --git a/src/VISU_I/VISUConfig.cc b/src/VISU_I/VISUConfig.cc index c0e51c20..02ea2d14 100644 --- a/src/VISU_I/VISUConfig.cc +++ b/src/VISU_I/VISUConfig.cc @@ -29,10 +29,11 @@ #include "SUIT_ResourceMgr.h" #include "SUIT_Session.h" -#include -#include +#include "SALOMEDSClient_GenericAttribute.hxx" +#include "SALOMEDSClient_AttributeIOR.hxx" -#include +#include "SalomeApp_Application.h" +#include using namespace std; @@ -120,6 +121,99 @@ namespace VISU{ } } + std::string + Storable + ::CorrectPersistentString(const std::string& thePersistentString) + { + QString aString(thePersistentString.c_str()); + if(aString.isEmpty()) + return aString.latin1(); + + VISU::Storable::TRestoringMap aRestoringMap; + Storable::StrToMap( aString, aRestoringMap ); + + bool anIsFound = false; + QString aComment = Storable::FindValue( aRestoringMap, "myComment", &anIsFound ); + if ( anIsFound ) { + QString aType = Storable::FindValue( aRestoringMap, "myType", &anIsFound ); + VISU::VISUType aVISUType = (VISU::VISUType)( aType.toInt() ); + if ( anIsFound ) { + if ( aComment == "NONE" ) + aVISUType = VISU::TNONE; + else if ( aComment == "CURVE" ) + aVISUType = VISU::TCURVE; + else if ( aComment == "TABLE" ) + aVISUType = VISU::TTABLE; + else if ( aComment == "CONTAINER" ) + aVISUType = VISU::TCONTAINER; + else if ( aComment == "MESH" ) + aVISUType = VISU::TMESH; + else if ( aComment == "SCALARMAP" ) + aVISUType = VISU::TSCALARMAP; + else if ( aComment == "PRSMERGER" ) + aVISUType = VISU::TSCALARMAP; + else if ( aComment == "ISOSURFACE" ) + aVISUType = VISU::TISOSURFACE; + else if ( aComment == "DEFORMEDSHAPE" ) + aVISUType = VISU::TDEFORMEDSHAPE; + else if ( aComment == "SCALARMAPONDEFORMEDSHAPE" ) + aVISUType = VISU::TSCALARMAPONDEFORMEDSHAPE; + else if ( aComment == "GAUSSPOINTS" ) + aVISUType = VISU::TGAUSSPOINTS; + else if ( aComment == "PLOT3D" ) + aVISUType = VISU::TPLOT3D; + else if ( aComment == "CUTPLANES" ) + aVISUType = VISU::TCUTPLANES; + else if ( aComment == "CUTLINES" ) + aVISUType = VISU::TCUTLINES; + else if ( aComment == "VECTORS" ) + aVISUType = VISU::TVECTORS; + else if ( aComment == "STREAMLINES" ) + aVISUType = VISU::TSTREAMLINES; + else if ( aComment == "VISUGEN" ) + aVISUType = VISU::TVISUGEN; + else if ( aComment == "VIEWMANAGER" ) + aVISUType = VISU::TVIEWMANAGER; + else if ( aComment == "RESULT" ) + aVISUType = VISU::TRESULT; + else if ( aComment == "XYPLOT" ) + aVISUType = VISU::TXYPLOT; + else if ( aComment == "TABLEVIEW" ) + aVISUType = VISU::TTABLEVIEW; + else if ( aComment == "VIEW3D" ) + aVISUType = VISU::TVIEW3D; + else if ( aComment == "GAUSSVIEW" ) + aVISUType = VISU::TGAUSSVIEW; + else if ( aComment == "ENTITY" ) + aVISUType = VISU::TENTITY; + else if ( aComment == "FAMILY" ) + aVISUType = VISU::TFAMILY; + else if ( aComment == "PART" ) + aVISUType = VISU::TPART; // MULTIPR + else if ( aComment == "GROUP" ) + aVISUType = VISU::TGROUP; + else if ( aComment == "FIELD" ) + aVISUType = VISU::TFIELD; + else if ( aComment == "TIMESTAMP" ) + aVISUType = VISU::TTIMESTAMP; + else if ( aComment == "ANIMATION" ) + aVISUType = VISU::TANIMATION; + else if ( aComment == "ALL" ) + aVISUType = VISU::TALL; + else + INFOS("Error : Unknown type of VISU object!"); + } + if(aType != QString::number(aVISUType)) + aString.replace( QString("myType=") + aType + ";", + QString("myType=") + QString::number(aVISUType) + ";"); + } + + if ( aComment == "PRSMERGER" ) + aString.replace( "myComment=PRSMERGER", "myComment=SCALARMAP" ); + + return aString.latin1(); + } + void Storable ::StrToMap(const QString& theStr, @@ -189,17 +283,18 @@ namespace VISU{ const std::string& theLocalPersistentID) { try{ - QString strIn( theLocalPersistentID.c_str() ); - TRestoringMap aMap; - StrToMap(strIn,aMap); - bool isExist; - QString aComment = VISU::Storable::FindValue(aMap,"myComment",&isExist); - if ( isExist ) { + QString aString( CorrectPersistentString( theLocalPersistentID ) ); + TRestoringMap aRestoringMap; + StrToMap(aString, aRestoringMap); + bool anIsExists; + QString aComment = VISU::Storable::FindValue(aRestoringMap, "myComment", &anIsExists); + if ( anIsExists ) { TCallbackMap::const_iterator anIter = VisuStoreMap.find(aComment.latin1()); if(MYDEBUG) MESSAGE("Storable::Create - "<second)(theSObject, thePrefix, aMap); + TStorableEngine aStorableEngine = anIter->second; + return aStorableEngine(theSObject, thePrefix, aRestoringMap); } }catch(std::exception& exc){ INFOS("Follow exception was occured :\n"< TCallbackMap; + static + std::string + CorrectPersistentString(const std::string& thePersistentString); + static void Registry(const std::string& theComment, diff --git a/src/VISU_I/VISU_ColoredPrs3dHolder_i.cc b/src/VISU_I/VISU_ColoredPrs3dHolder_i.cc index 9927e98b..5f543b34 100644 --- a/src/VISU_I/VISU_ColoredPrs3dHolder_i.cc +++ b/src/VISU_I/VISU_ColoredPrs3dHolder_i.cc @@ -251,7 +251,7 @@ VISU::ColoredPrs3dHolder_i if(ColoredPrs3dCache_i* aCache = ColoredPrs3dCache_i::GetInstance_i(aStudy)) if(ColoredPrs3dHolder_i* aHolder = new ColoredPrs3dHolder_i(*aCache)){ // To postpone restoring of the device - aColoredPrs3d->SaveRestoringState(aStudy, theMap); + aColoredPrs3d->SaveRestoringState(theSObject, theMap); CORBA::String_var anEntry = theSObject->GetID(); aCache->RegisterInHolder(aColoredPrs3d, anEntry.in()); return aHolder; diff --git a/src/VISU_I/VISU_ColoredPrs3d_i.cc b/src/VISU_I/VISU_ColoredPrs3d_i.cc index 351952dc..8824261f 100644 --- a/src/VISU_I/VISU_ColoredPrs3d_i.cc +++ b/src/VISU_I/VISU_ColoredPrs3d_i.cc @@ -79,7 +79,8 @@ ColoredPrs3d_i(EPublishInStudyMode thePublishInStudyMode) : myPublishInStudyMode(thePublishInStudyMode), myIsTimeStampFixed(thePublishInStudyMode == EPublishUnderTimeStamp), myColoredPL(NULL), - myIsFixedRange(false) + myIsFixedRange(false), + myIsRestored(true) {} //--------------------------------------------------------------- @@ -1128,13 +1129,38 @@ VISU::ColoredPrs3d_i return this; } + +//---------------------------------------------------------------------------- +void +VISU::ColoredPrs3d_i +::SaveRestoringState(SALOMEDS::SObject_ptr theSObject, + const Storable::TRestoringMap& theMap) +{ + myRestoringSObject = SALOMEDS::SObject::_duplicate(theSObject); + myRestoringMap = theMap; + myIsRestored = false; +} + + +//---------------------------------------------------------------------------- +void +VISU::ColoredPrs3d_i +::InitFromRestoringState() +{ + if(!myIsRestored){ + Restore(myRestoringSObject, myRestoringMap); + myIsRestored = true; + } +} + + //---------------------------------------------------------------------------- VISU::Storable* VISU::ColoredPrs3d_i -::Restore(SALOMEDS::Study_ptr theStudy, +::Restore(SALOMEDS::SObject_ptr theSObject, const Storable::TRestoringMap& theMap) { - if(!TSuperClass::Restore(theStudy, theMap)) + if(!TSuperClass::Restore(theSObject, theMap)) return NULL; SetEntity((VISU::Entity)VISU::Storable::FindValue(theMap,"myEntity").toInt()); diff --git a/src/VISU_I/VISU_ColoredPrs3d_i.hh b/src/VISU_I/VISU_ColoredPrs3d_i.hh index 6d242070..a255c6a6 100644 --- a/src/VISU_I/VISU_ColoredPrs3d_i.hh +++ b/src/VISU_I/VISU_ColoredPrs3d_i.hh @@ -237,6 +237,15 @@ namespace VISU std::string GetHolderEntry(); + //! To keep restoring params till the explicit Restore() call + void + SaveRestoringState(SALOMEDS::SObject_ptr theSObject, + const Storable::TRestoringMap& theMap); + + //! To restore the presentation according to the saved state + void + InitFromRestoringState(); + //---------------------------------------------------------------------------- virtual const char* @@ -259,7 +268,7 @@ namespace VISU */ virtual Storable* - Restore(SALOMEDS::Study_ptr theStudy, + Restore(SALOMEDS::SObject_ptr theSObject, const Storable::TRestoringMap& theMap); /*! @@ -445,6 +454,10 @@ namespace VISU GetActorEntry(); private: + bool myIsRestored; + Storable::TRestoringMap myRestoringMap; + SALOMEDS::SObject_var myRestoringSObject; + // Decalare basic input parameters VISU::Entity myEntity; VISU::Entity myPreviousEntity; @@ -494,8 +507,7 @@ namespace VISU const Storable::TRestoringMap& theMap) { TColoredPrs3d* aColoredPrs3d = new TColoredPrs3d(ColoredPrs3d_i::EDoNotPublish); - SALOMEDS::Study_var aStudy = theSObject->GetStudy(); - return aColoredPrs3d->Restore(aStudy, theMap); + return aColoredPrs3d->Restore(theSObject, theMap); } //---------------------------------------------------------------------------- } diff --git a/src/VISU_I/VISU_CutLines_i.cc b/src/VISU_I/VISU_CutLines_i.cc index e634111b..ede2fea6 100644 --- a/src/VISU_I/VISU_CutLines_i.cc +++ b/src/VISU_I/VISU_CutLines_i.cc @@ -147,10 +147,10 @@ VISU::CutLines_i //--------------------------------------------------------------- VISU::Storable* VISU::CutLines_i -::Restore(SALOMEDS::Study_ptr theStudy, +::Restore(SALOMEDS::SObject_ptr theSObject, const Storable::TRestoringMap& theMap) { - if(!TSuperClass::Restore(theStudy, theMap)) + if(!TSuperClass::Restore(theSObject, theMap)) return NULL; SetNbLines(VISU::Storable::FindValue(theMap,"myNbLines").toInt()); diff --git a/src/VISU_I/VISU_CutLines_i.hh b/src/VISU_I/VISU_CutLines_i.hh index 21a97641..ab01a4f9 100644 --- a/src/VISU_I/VISU_CutLines_i.hh +++ b/src/VISU_I/VISU_CutLines_i.hh @@ -238,7 +238,7 @@ namespace VISU //! Extends VISU_ColoredPrs3d_i::Restore virtual Storable* - Restore(SALOMEDS::Study_ptr theStudy, + Restore(SALOMEDS::SObject_ptr theSObject, const Storable::TRestoringMap& theMap); virtual diff --git a/src/VISU_I/VISU_CutPlanes_i.cc b/src/VISU_I/VISU_CutPlanes_i.cc index 4d9583d2..f899ee38 100644 --- a/src/VISU_I/VISU_CutPlanes_i.cc +++ b/src/VISU_I/VISU_CutPlanes_i.cc @@ -112,10 +112,10 @@ VISU::CutPlanes_i //---------------------------------------------------------------------------- VISU::Storable* VISU::CutPlanes_i -::Restore(SALOMEDS::Study_ptr theStudy, +::Restore(SALOMEDS::SObject_ptr theSObject, const Storable::TRestoringMap& theMap) { - if(!TSuperClass::Restore(theStudy, theMap)) + if(!TSuperClass::Restore(theSObject, theMap)) return NULL; SetNbPlanes(VISU::Storable::FindValue(theMap,"myNbPlanes").toInt()); diff --git a/src/VISU_I/VISU_CutPlanes_i.hh b/src/VISU_I/VISU_CutPlanes_i.hh index 6dc9c870..9386f9f3 100644 --- a/src/VISU_I/VISU_CutPlanes_i.hh +++ b/src/VISU_I/VISU_CutPlanes_i.hh @@ -154,7 +154,7 @@ namespace VISU //! Redefines VISU_ColoredPrs3d_i::Restore virtual Storable* - Restore(SALOMEDS::Study_ptr theStudy, + Restore(SALOMEDS::SObject_ptr theSObject, const Storable::TRestoringMap& theMap); //! Redefines VISU_ColoredPrs3d_i::CreateActor diff --git a/src/VISU_I/VISU_DeformedShape_i.cc b/src/VISU_I/VISU_DeformedShape_i.cc index b942c81a..805cbd60 100644 --- a/src/VISU_I/VISU_DeformedShape_i.cc +++ b/src/VISU_I/VISU_DeformedShape_i.cc @@ -156,10 +156,10 @@ VISU::DeformedShape_i //--------------------------------------------------------------- VISU::Storable* VISU::DeformedShape_i -::Restore(SALOMEDS::Study_ptr theStudy, +::Restore(SALOMEDS::SObject_ptr theSObject, const Storable::TRestoringMap& theMap) { - if(!TSuperClass::Restore(theStudy, theMap)) + if(!TSuperClass::Restore(theSObject, theMap)) return NULL; SetScale(VISU::Storable::FindValue(theMap,"myFactor").toDouble()); diff --git a/src/VISU_I/VISU_DeformedShape_i.hh b/src/VISU_I/VISU_DeformedShape_i.hh index e433be3e..b5f877e1 100644 --- a/src/VISU_I/VISU_DeformedShape_i.hh +++ b/src/VISU_I/VISU_DeformedShape_i.hh @@ -144,7 +144,7 @@ namespace VISU virtual Storable* - Restore(SALOMEDS::Study_ptr theStudy, + Restore(SALOMEDS::SObject_ptr theSObject, const Storable::TRestoringMap& theMap); virtual diff --git a/src/VISU_I/VISU_GaussPoints_i.cc b/src/VISU_I/VISU_GaussPoints_i.cc index b58064b3..a9a19426 100644 --- a/src/VISU_I/VISU_GaussPoints_i.cc +++ b/src/VISU_I/VISU_GaussPoints_i.cc @@ -253,10 +253,10 @@ VISU::GaussPoints_i //---------------------------------------------------------------------------- VISU::Storable* VISU::GaussPoints_i -::Restore(SALOMEDS::Study_ptr theStudy, +::Restore(SALOMEDS::SObject_ptr theSObject, const Storable::TRestoringMap& theMap) { - if(!TSuperClass::Restore(theStudy, theMap)) + if(!TSuperClass::Restore(theSObject, theMap)) return NULL; SetIsActiveLocalScalarBar(Storable::FindValue(theMap,"myIsActiveLocalScalarBar").toInt()); diff --git a/src/VISU_I/VISU_GaussPoints_i.hh b/src/VISU_I/VISU_GaussPoints_i.hh index 5b79bf60..b4b150ec 100644 --- a/src/VISU_I/VISU_GaussPoints_i.hh +++ b/src/VISU_I/VISU_GaussPoints_i.hh @@ -346,7 +346,7 @@ namespace VISU virtual Storable* - Restore(SALOMEDS::Study_ptr theStudy, + Restore(SALOMEDS::SObject_ptr theSObject, const Storable::TRestoringMap& theMap); //---------------------------------------------------------------------------- diff --git a/src/VISU_I/VISU_Gen_i.cc b/src/VISU_I/VISU_Gen_i.cc index 93cf423c..8b152b68 100644 --- a/src/VISU_I/VISU_Gen_i.cc +++ b/src/VISU_I/VISU_Gen_i.cc @@ -67,7 +67,6 @@ // QT Includes #include #include -#include // VTK Includes #include @@ -283,57 +282,9 @@ namespace VISU if ( isAttrStringFound || theSObject->FindAttribute(anAttr, "AttributeString") ) { SALOMEDS::AttributeString_var aAttComment = SALOMEDS::AttributeString::_narrow(anAttr); if ( aAttComment ) { - string aValue = aAttComment->Value(); - if ( aValue.compare("") ) { - const QString aStr = QString( aValue.c_str() ); - VISU::Storable::TRestoringMap aMap; - Storable::StrToMap( aStr, aMap ); - - bool isFind = false; - QString aType = Storable::FindValue( aMap, "myType", &isFind ); - if ( isFind ) { - VISU::VISUType aVISUType = (VISU::VISUType)( aType.toInt() ); - QString aComment = Storable::FindValue( aMap, "myComment", &isFind ); - if ( isFind ) { - if ( !aComment.compare(QString("NONE")) ) aVISUType = VISU::TNONE; - else if ( !aComment.compare(QString("CURVE")) ) aVISUType = VISU::TCURVE; - else if ( !aComment.compare(QString("TABLE")) ) aVISUType = VISU::TTABLE; - else if ( !aComment.compare(QString("CONTAINER")) ) aVISUType = VISU::TCONTAINER; - else if ( !aComment.compare(QString("MESH")) ) aVISUType = VISU::TMESH; - else if ( !aComment.compare(QString("SCALARMAP")) ) aVISUType = VISU::TSCALARMAP; - else if ( !aComment.compare(QString("PRSMERGER")) ) aVISUType = VISU::TSCALARMAP; - else if ( !aComment.compare(QString("ISOSURFACE")) ) aVISUType = VISU::TISOSURFACE; - else if ( !aComment.compare(QString("DEFORMEDSHAPE")) ) aVISUType = VISU::TDEFORMEDSHAPE; - else if ( !aComment.compare(QString("SCALARMAPONDEFORMEDSHAPE")) ) aVISUType = VISU::TSCALARMAPONDEFORMEDSHAPE; - else if ( !aComment.compare(QString("GAUSSPOINTS")) ) aVISUType = VISU::TGAUSSPOINTS; - else if ( !aComment.compare(QString("PLOT3D")) ) aVISUType = VISU::TPLOT3D; - else if ( !aComment.compare(QString("CUTPLANES")) ) aVISUType = VISU::TCUTPLANES; - else if ( !aComment.compare(QString("CUTLINES")) ) aVISUType = VISU::TCUTLINES; - else if ( !aComment.compare(QString("VECTORS")) ) aVISUType = VISU::TVECTORS; - else if ( !aComment.compare(QString("STREAMLINES")) ) aVISUType = VISU::TSTREAMLINES; - else if ( !aComment.compare(QString("VISUGEN")) ) aVISUType = VISU::TVISUGEN; - else if ( !aComment.compare(QString("VIEWMANAGER")) ) aVISUType = VISU::TVIEWMANAGER; - else if ( !aComment.compare(QString("RESULT")) ) aVISUType = VISU::TRESULT; - else if ( !aComment.compare(QString("XYPLOT")) ) aVISUType = VISU::TXYPLOT; - else if ( !aComment.compare(QString("TABLEVIEW,")) ) aVISUType = VISU::TTABLEVIEW; - else if ( !aComment.compare(QString("VIEW3D")) ) aVISUType = VISU::TVIEW3D; - else if ( !aComment.compare(QString("GAUSSVIEW")) ) aVISUType = VISU::TGAUSSVIEW; - else if ( !aComment.compare(QString("ENTITY")) ) aVISUType = VISU::TENTITY; - else if ( !aComment.compare(QString("FAMILY")) ) aVISUType = VISU::TFAMILY; - else if ( !aComment.compare(QString("PART")) ) aVISUType = VISU::TPART; // MULTIPR - else if ( !aComment.compare(QString("GROUP")) ) aVISUType = VISU::TGROUP; - else if ( !aComment.compare(QString("FIELD")) ) aVISUType = VISU::TFIELD; - else if ( !aComment.compare(QString("TIMESTAMP")) ) aVISUType = VISU::TTIMESTAMP; - else if ( !aComment.compare(QString("ANIMATION")) ) aVISUType = VISU::TANIMATION; - else if ( !aComment.compare(QString("ALL")) ) aVISUType = VISU::TALL; - else - if (MYDEBUG) MESSAGE("Error : Unknown type of VISU object!"); - } - QString aNewStr = aStr; - aAttComment->SetValue( aNewStr.replace( QRegExp( QString("myType=") + aType ) , - QString("myType=") + QString::number(aVISUType) ).latin1() ); - } - } + CORBA::String_var aValue = aAttComment->Value(); + std::string aString = Storable::CorrectPersistentString(aValue.in()); + aAttComment->SetValue( aString.c_str() ); } } } diff --git a/src/VISU_I/VISU_IsoSurfaces_i.cc b/src/VISU_I/VISU_IsoSurfaces_i.cc index c152e8da..769e48de 100644 --- a/src/VISU_I/VISU_IsoSurfaces_i.cc +++ b/src/VISU_I/VISU_IsoSurfaces_i.cc @@ -111,10 +111,10 @@ VISU::IsoSurfaces_i //--------------------------------------------------------------- VISU::Storable* VISU::IsoSurfaces_i -::Restore(SALOMEDS::Study_ptr theStudy, +::Restore(SALOMEDS::SObject_ptr theSObject, const Storable::TRestoringMap& theMap) { - if(!TSuperClass::Restore(theStudy, theMap)) + if(!TSuperClass::Restore(theSObject, theMap)) return NULL; SetNbSurfaces(VISU::Storable::FindValue(theMap,"myNbSurface").toInt()); diff --git a/src/VISU_I/VISU_IsoSurfaces_i.hh b/src/VISU_I/VISU_IsoSurfaces_i.hh index 63dc9347..7046e997 100644 --- a/src/VISU_I/VISU_IsoSurfaces_i.hh +++ b/src/VISU_I/VISU_IsoSurfaces_i.hh @@ -139,7 +139,7 @@ namespace VISU virtual Storable* - Restore(SALOMEDS::Study_ptr theStudy, + Restore(SALOMEDS::SObject_ptr theSObject, const Storable::TRestoringMap& theMap); virtual diff --git a/src/VISU_I/VISU_Mesh_i.cc b/src/VISU_I/VISU_Mesh_i.cc index 45669d75..0c27e8c6 100644 --- a/src/VISU_I/VISU_Mesh_i.cc +++ b/src/VISU_I/VISU_Mesh_i.cc @@ -252,13 +252,14 @@ VISU::Mesh_i myMeshPL->SetUnstructuredGridIDMapper(anIDMapper); + string anEntry = GetCResult()->GetEntry(aComment.latin1()); + if(anEntry == "") + throw std::runtime_error("Mesh_i::Build - anEntry was not found !!!"); + SALOMEDS::SObject_var aSObject = GetStudyDocument()->FindObjectID(anEntry.c_str()); + if(!theRestoring) { //Setting IOR on the label myMeshPL->Init(); string aResultEntry = GetCResult()->GetEntry(); - string anEntry = GetCResult()->GetEntry(aComment.latin1()); - if(anEntry == "") - throw std::runtime_error("Mesh_i::Build - anEntry was not found !!!"); - SALOMEDS::SObject_var aSObject = GetStudyDocument()->FindObjectID(anEntry.c_str()); SALOMEDS::StudyBuilder_var aStudyBuilder = GetStudyDocument()->NewBuilder(); SALOMEDS::GenericAttribute_var anAttr = aStudyBuilder->FindOrCreateAttribute(aSObject,"AttributeIOR"); SALOMEDS::AttributeIOR_var anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); @@ -270,7 +271,7 @@ VISU::Mesh_i SALOMEDS::GenericAttribute_var anAttr; SALOMEDS::AttributePixMap_var aPixmap; - anAttr = aStudyBuilder->FindOrCreateAttribute(GetSObject(), "AttributePixMap"); + anAttr = aStudyBuilder->FindOrCreateAttribute(aSObject, "AttributePixMap"); aPixmap = SALOMEDS::AttributePixMap::_narrow( anAttr ); aPixmap->SetPixMap("ICON_TREE_MESH"); @@ -433,10 +434,10 @@ VISU::Mesh_i //---------------------------------------------------------------------------- VISU::Storable* VISU::Mesh_i -::Restore(SALOMEDS::Study_ptr theStudy, +::Restore(SALOMEDS::SObject_ptr theSObject, const Storable::TRestoringMap& theMap) { - if(!TSuperClass::Restore(theStudy, theMap)) + if(!TSuperClass::Restore(theSObject, theMap)) return NULL; myEntity = VISU::Storable::FindValue(theMap,"myEntity").toInt();//jfa IPAL9284 @@ -468,8 +469,7 @@ VISU::Mesh_i const Storable::TRestoringMap& theMap) { Mesh_i* aMesh = new Mesh_i(); - SALOMEDS::Study_var aStudy = theSObject->GetStudy(); - return aMesh->Restore(aStudy, theMap); + return aMesh->Restore(theSObject, theMap); } diff --git a/src/VISU_I/VISU_Mesh_i.hh b/src/VISU_I/VISU_Mesh_i.hh index 27f3cc20..a6b45221 100644 --- a/src/VISU_I/VISU_Mesh_i.hh +++ b/src/VISU_I/VISU_Mesh_i.hh @@ -162,7 +162,7 @@ namespace VISU virtual Storable* - Restore(SALOMEDS::Study_ptr theStudy, + Restore(SALOMEDS::SObject_ptr theSObject, const Storable::TRestoringMap& theMap); static diff --git a/src/VISU_I/VISU_Plot3D_i.cc b/src/VISU_I/VISU_Plot3D_i.cc index 34ac5d2a..cf2b8ebb 100644 --- a/src/VISU_I/VISU_Plot3D_i.cc +++ b/src/VISU_I/VISU_Plot3D_i.cc @@ -109,10 +109,10 @@ VISU::Plot3D_i //--------------------------------------------------------------- VISU::Storable* VISU::Plot3D_i -::Restore(SALOMEDS::Study_ptr theStudy, +::Restore(SALOMEDS::SObject_ptr theSObject, const Storable::TRestoringMap& theMap) { - if(!TSuperClass::Restore(theStudy, theMap)) + if(!TSuperClass::Restore(theSObject, theMap)) return NULL; SetOrientation(VISU::Plot3D::Orientation(VISU::Storable::FindValue(theMap,"myBasePlane").toInt()), diff --git a/src/VISU_I/VISU_Plot3D_i.hh b/src/VISU_I/VISU_Plot3D_i.hh index fb614495..de7ffb09 100644 --- a/src/VISU_I/VISU_Plot3D_i.hh +++ b/src/VISU_I/VISU_Plot3D_i.hh @@ -148,7 +148,7 @@ namespace VISU virtual Storable* - Restore(SALOMEDS::Study_ptr theStudy, + Restore(SALOMEDS::SObject_ptr theSObject, const Storable::TRestoringMap& theMap); virtual diff --git a/src/VISU_I/VISU_Prs3d_i.cc b/src/VISU_I/VISU_Prs3d_i.cc index afb7eee5..f1e8d226 100644 --- a/src/VISU_I/VISU_Prs3d_i.cc +++ b/src/VISU_I/VISU_Prs3d_i.cc @@ -51,8 +51,7 @@ VISU::Prs3d_i ::Prs3d_i() : PrsObject_i(SALOMEDS::Study::_nil()), myActorCollection(vtkActorCollection::New()), - myIsActiveSatate(true), - myIsRestored(true) + myIsActiveSatate(true) { if(MYDEBUG) MESSAGE("Prs3d_i::Prs3d_i - this = "<GetStudy(); + SetStudyDocument(aStudy); + + bool anIsExists = false; + QString aResultEntry = VISU::Storable::FindValue(theMap,"myResultEntry", &anIsExists); + if(!anIsExists){ + SALOMEDS::SObject_var aSObject = SALOMEDS::SObject::_duplicate(theSObject); + for(; aSObject->Depth() > 2 && !aResultEntry.isEmpty(); aSObject = aSObject->GetFather()){ + CORBA::Object_var anObject = VISU::SObjectToObject(aSObject); + if(CORBA::is_nil(anObject)) + continue; + VISU::Result_var aResult = VISU::Result::_narrow(anObject); + if(CORBA::is_nil(aResult)) + continue; + CORBA::String_var anEntry = aSObject->GetID(); + aResultEntry = anEntry.in(); + } + } + SetResultEntry(aResultEntry.latin1()); if(!GetCResult()) return NULL; @@ -289,28 +305,6 @@ VISU::Prs3d_i return this; } -//---------------------------------------------------------------------------- -void -VISU::Prs3d_i -::SaveRestoringState(SALOMEDS::Study_ptr theStudy, - const Storable::TRestoringMap& theMap) -{ - myRestoringStudy = SALOMEDS::Study::_duplicate(theStudy); - myRestoringMap = theMap; - myIsRestored = false; -} - -//---------------------------------------------------------------------------- -void -VISU::Prs3d_i -::InitFromRestoringState() -{ - if(!myIsRestored){ - Restore(myRestoringStudy, myRestoringMap); - myIsRestored = true; - } -} - //---------------------------------------------------------------------------- void VISU::Prs3d_i diff --git a/src/VISU_I/VISU_Prs3d_i.hh b/src/VISU_I/VISU_Prs3d_i.hh index 6ce9a3c9..6419d111 100644 --- a/src/VISU_I/VISU_Prs3d_i.hh +++ b/src/VISU_I/VISU_Prs3d_i.hh @@ -140,18 +140,9 @@ namespace VISU //! To restore paramters of the instance from Storable::TRestoringMap virtual Storable* - Restore(SALOMEDS::Study_ptr theStudy, + Restore(SALOMEDS::SObject_ptr theSObject, const Storable::TRestoringMap& theMap); - //! To keep restoring params till the explicit Restore() call - void - SaveRestoringState(SALOMEDS::Study_ptr theStudy, - const Storable::TRestoringMap& theMap); - - //! To restore the presentation according to the saved state - void - InitFromRestoringState(); - //---------------------------------------------------------------------------- //! Get corresponding SALOMEDS::SObject virtual @@ -319,10 +310,6 @@ namespace VISU GetActorEntry(); private: - bool myIsRestored; - SALOMEDS::Study_var myRestoringStudy; - Storable::TRestoringMap myRestoringMap; - void SetResultEntry(const std::string& theResultEntry); diff --git a/src/VISU_I/VISU_ScalarMapOnDeformedShape_i.cc b/src/VISU_I/VISU_ScalarMapOnDeformedShape_i.cc index 3046fbcd..bf78b111 100644 --- a/src/VISU_I/VISU_ScalarMapOnDeformedShape_i.cc +++ b/src/VISU_I/VISU_ScalarMapOnDeformedShape_i.cc @@ -157,10 +157,10 @@ VISU::ScalarMapOnDeformedShape_i //--------------------------------------------------------------- VISU::Storable* VISU::ScalarMapOnDeformedShape_i -::Restore(SALOMEDS::Study_ptr theStudy, +::Restore(SALOMEDS::SObject_ptr theSObject, const Storable::TRestoringMap& theMap) { - if(!TSuperClass::Restore(theStudy, theMap)) + if(!TSuperClass::Restore(theSObject, theMap)) return NULL; QString aMeshName = VISU::Storable::FindValue(theMap,"myScalarMeshName"); diff --git a/src/VISU_I/VISU_ScalarMapOnDeformedShape_i.hh b/src/VISU_I/VISU_ScalarMapOnDeformedShape_i.hh index 4c36ea89..8a9d34ed 100644 --- a/src/VISU_I/VISU_ScalarMapOnDeformedShape_i.hh +++ b/src/VISU_I/VISU_ScalarMapOnDeformedShape_i.hh @@ -120,7 +120,7 @@ namespace VISU //! Redefines VISU_ColoredPrs3d_i::Restore virtual Storable* - Restore(SALOMEDS::Study_ptr theStudy, + Restore(SALOMEDS::SObject_ptr theSObject, const Storable::TRestoringMap& theMap); static const std::string myComment; diff --git a/src/VISU_I/VISU_ScalarMap_i.cc b/src/VISU_I/VISU_ScalarMap_i.cc index 9ce78f1c..5d621843 100644 --- a/src/VISU_I/VISU_ScalarMap_i.cc +++ b/src/VISU_I/VISU_ScalarMap_i.cc @@ -242,10 +242,10 @@ VISU::ScalarMap_i //---------------------------------------------------------------------------- VISU::Storable* VISU::ScalarMap_i -::Restore(SALOMEDS::Study_ptr theStudy, +::Restore(SALOMEDS::SObject_ptr theSObject, const Storable::TRestoringMap& theMap) { - if(!TSuperClass::Restore(theStudy, theMap)) + if(!TSuperClass::Restore(theSObject, theMap)) return NULL; SetScaling(VISU::Scaling(VISU::Storable::FindValue(theMap,"myScaling").toInt())); diff --git a/src/VISU_I/VISU_ScalarMap_i.hh b/src/VISU_I/VISU_ScalarMap_i.hh index 6cbd2ace..bdefaf63 100644 --- a/src/VISU_I/VISU_ScalarMap_i.hh +++ b/src/VISU_I/VISU_ScalarMap_i.hh @@ -177,7 +177,7 @@ namespace VISU virtual Storable* - Restore(SALOMEDS::Study_ptr theStudy, + Restore(SALOMEDS::SObject_ptr theSObject, const Storable::TRestoringMap& theMap); virtual diff --git a/src/VISU_I/VISU_StreamLines_i.cc b/src/VISU_I/VISU_StreamLines_i.cc index 5658bd56..86f4cbe0 100644 --- a/src/VISU_I/VISU_StreamLines_i.cc +++ b/src/VISU_I/VISU_StreamLines_i.cc @@ -151,10 +151,10 @@ VISU::StreamLines_i //--------------------------------------------------------------- VISU::Storable* VISU::StreamLines_i -::Restore(SALOMEDS::Study_ptr theStudy, +::Restore(SALOMEDS::SObject_ptr theSObject, const Storable::TRestoringMap& theMap) { - if(!TSuperClass::Restore(theStudy, theMap)) + if(!TSuperClass::Restore(theSObject, theMap)) return NULL; double anIntegrationStep = VISU::Storable::FindValue(theMap,"myIntegrationStep").toDouble(); diff --git a/src/VISU_I/VISU_StreamLines_i.hh b/src/VISU_I/VISU_StreamLines_i.hh index 2b6635ba..f0cee757 100644 --- a/src/VISU_I/VISU_StreamLines_i.hh +++ b/src/VISU_I/VISU_StreamLines_i.hh @@ -169,7 +169,7 @@ namespace VISU //! Extends VISU_ColoredPrs3d_i::Restore virtual Storable* - Restore(SALOMEDS::Study_ptr theStudy, + Restore(SALOMEDS::SObject_ptr theSObject, const Storable::TRestoringMap& theMap); //! Extends VISU_ColoredPrs3d_i::Update diff --git a/src/VISU_I/VISU_TimeAnimation.cxx b/src/VISU_I/VISU_TimeAnimation.cxx index 73c609b3..be2046f8 100644 --- a/src/VISU_I/VISU_TimeAnimation.cxx +++ b/src/VISU_I/VISU_TimeAnimation.cxx @@ -1690,7 +1690,8 @@ void VISU_TimeAnimation::restoreFromStudy(_PTR(SObject) theField) continue; generatePresentations(getNbFields()-1); - if (!aPrsObj->FindAttribute(anAttr, "AttributeString")) continue; + if (!aPrsObj->FindAttribute(anAttr, "AttributeString")) + continue; _PTR(AttributeString) aPrsComment (anAttr); string aPrsComm = aPrsComment->Value(); if (aPrsComm.length() > 0) { @@ -1698,7 +1699,7 @@ void VISU_TimeAnimation::restoreFromStudy(_PTR(SObject) theField) VISU::Storable::TRestoringMap aPrsMap; VISU::Storable::StrToMap(strPrsIn,aPrsMap); - aData.myPrs[0]->Restore(VISU::GetDSStudy(myStudy), aPrsMap); + aData.myPrs[0]->Restore(VISU::GetSObject(aPrsObj), aPrsMap); } aData.myPrs[0]->GetOffset(aData.myOffset); for (int i = 1; i < aData.myNbFrames; i++) { diff --git a/src/VISU_I/VISU_Vectors_i.cc b/src/VISU_I/VISU_Vectors_i.cc index caee0703..8434c013 100644 --- a/src/VISU_I/VISU_Vectors_i.cc +++ b/src/VISU_I/VISU_Vectors_i.cc @@ -160,10 +160,10 @@ VISU::Vectors_i //--------------------------------------------------------------- VISU::Storable* VISU::Vectors_i -::Restore(SALOMEDS::Study_ptr theStudy, +::Restore(SALOMEDS::SObject_ptr theSObject, const Storable::TRestoringMap& theMap) { - if(!TSuperClass::Restore(theStudy, theMap)) + if(!TSuperClass::Restore(theSObject, theMap)) return NULL; SetGlyphType(VISU::Vectors::GlyphType(VISU::Storable::FindValue(theMap,"myTypeGlyph").toInt())); diff --git a/src/VISU_I/VISU_Vectors_i.hh b/src/VISU_I/VISU_Vectors_i.hh index 083452cc..ef4b9d92 100644 --- a/src/VISU_I/VISU_Vectors_i.hh +++ b/src/VISU_I/VISU_Vectors_i.hh @@ -137,7 +137,7 @@ namespace VISU //! Redefines VISU_ColoredPrs3d_i::Restore virtual Storable* - Restore(SALOMEDS::Study_ptr theStudy, + Restore(SALOMEDS::SObject_ptr theSObject, const Storable::TRestoringMap& theMap); static const std::string myComment; -- 2.39.2