]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
To fix Bug IPAL16138
authorapo <apo@opencascade.com>
Wed, 6 Jun 2007 11:00:31 +0000 (11:00 +0000)
committerapo <apo@opencascade.com>
Wed, 6 Jun 2007 11:00:31 +0000 (11:00 +0000)
 - IOLS. Impossible to show animation dumped by python in 3.2.6
(To fix the bug properly it was necessary to remove usage of "myType" parameter of VISU objects at all)

25 files changed:
src/VISUGUI/VisuGUI.cxx
src/VISUGUI/VisuGUI_FieldFilter.cxx
src/VISUGUI/VisuGUI_InputPane.cxx
src/VISUGUI/VisuGUI_Module.cxx
src/VISUGUI/VisuGUI_PopupTools.cxx
src/VISUGUI/VisuGUI_Prs3dTools.h
src/VISUGUI/VisuGUI_ScalarMapOnDeformedShapeDlg.cxx
src/VISUGUI/VisuGUI_Selection.cxx
src/VISUGUI/VisuGUI_StreamLinesDlg.cxx
src/VISUGUI/VisuGUI_TimeAnimation.cxx
src/VISUGUI/VisuGUI_Tools.cxx
src/VISUGUI/VisuGUI_Tools.h
src/VISU_I/VISUConfig.cc
src/VISU_I/VISUConfig.hh
src/VISU_I/VISU_ColoredPrs3d_i.cc
src/VISU_I/VISU_DumpPython.cc
src/VISU_I/VISU_Gen_i.cc
src/VISU_I/VISU_I.hxx
src/VISU_I/VISU_Mesh_i.cc
src/VISU_I/VISU_Result_i.cc
src/VISU_I/VISU_Result_i.hh
src/VISU_I/VISU_Table_i.cc
src/VISU_I/VISU_TimeAnimation.cxx
src/VISU_I/VISU_TimeAnimation.h
src/VISU_I/VISU_View_i.cc

index 68aee34699008538ea17306e465aabfe1c43fd0d..6f1c7e16b20ca9c397bb45ff4710b9fe59006b04 100644 (file)
@@ -485,20 +485,19 @@ CreateCurves( SalomeApp_Module* theModule,
       if( aTblObj ) {
         _PTR(GenericAttribute) anAttr;
         if (aTblObj->FindAttribute( anAttr, "AttributeName" ) ) {
-
          _PTR(ChildIterator) aChildIter = aStudy->NewChildIterator( aTblObj );
          SalomeApp_Study* salome_study = GetAppStudy( theModule );
          for( aChildIter->InitEx( false ); aChildIter->More(); aChildIter->Next() ){
            salome_study->deleteReferencesTo( aChildIter->Value() );
            _PTR(SObject) aSO = aChildIter->Value();
            if(aSO){
-             if (getValue(aSO, "myComment") == QString("CURVE")) {
+             Storable::TRestoringMap aRestoringMap = Storable::GetStorableMap(aSO);
+             if (aRestoringMap["myComment"] == "CURVE") {
                CORBA::Object_var aCORBAObject = VISU::ClientSObjectToObject(aSO);
                if(!CORBA::is_nil(aCORBAObject)){
                  PortableServer::ServantBase_var aServant = VISU::GetServant(aCORBAObject);
-                 VISU::Curve_i* pCrv = dynamic_cast<VISU::Curve_i*>(aServant.in());
-                 if(pCrv){
-                   PlotRemoveCurve(theModule,pCrv);
+                 if(VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(aServant.in())){
+                   PlotRemoveCurve(theModule, aCurve);
                  }
                }
              }
@@ -1723,19 +1722,12 @@ VisuGUI
   _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
 
   _PTR(SObject) aSObj = aCStudy->FindObjectID(anIO->getEntry());
-  if (!aSObj) return;
-
-  VISU::Storable::TRestoringMap aMap;
-  _PTR(GenericAttribute) anAttr;
-  if (!aSObj->FindAttribute(anAttr, "AttributeString")) return;
+  if (!aSObj) 
+    return;
 
-  _PTR(AttributeString) aComment (anAttr);
-  string aComm = aComment->Value();
-  QString strIn (aComm.c_str());
-  VISU::Storable::StrToMap(strIn, aMap);
-  bool isExist;
-  VISU::VISUType aType = (VISU::VISUType)VISU::Storable::FindValue(aMap,"myType",&isExist).toInt();
-  if (aType != VISU::TANIMATION) return;
+  VISU::VISUType aType = VISU::Storable::SObject2Type( aSObj );
+  if (aType != VISU::TANIMATION) 
+    return;
 
   VisuGUI_TimeAnimationDlg* aAnimationDlg =
     new VisuGUI_TimeAnimationDlg(this, aCStudy);
@@ -2688,7 +2680,7 @@ void VisuGUI::contextMenuPopup( const QString& theClient, QPopupMenu* theMenu, Q
 
   OB_Browser* ob = getApp()->objectBrowser();
   bool isOBClient = (ob && theClient == ob->popupClientType());
-
+  
   LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
   SALOME_ListIO aListIO;
   aSelectionMgr->selectedObjects(aListIO);
@@ -2702,33 +2694,25 @@ void VisuGUI::contextMenuPopup( const QString& theClient, QPopupMenu* theMenu, Q
   SALOME_ListIteratorOfListIO It (aListIO);
   for (; It.More(); It.Next()) {
     Handle(SALOME_InteractiveObject)& anIO = It.Value();
-
+    
     if (!anIO.IsNull() && anIO->hasEntry()) {
       _PTR(SObject) aSObject = aCStudy->FindObjectID(anIO->getEntry());
       if ( !aSObject )
        continue;
       CORBA::Object_var aCORBAObject = VISU::ClientSObjectToObject(aSObject);
       if (CORBA::is_nil(aCORBAObject)) {
-        _PTR(GenericAttribute) anAttr;
-        if (aSObject->FindAttribute(anAttr, "AttributeString")) {
-          _PTR(AttributeString) aComment (anAttr);
-          string aComm = aComment->Value();
-          QString strIn (aComm.c_str());
-          VISU::Storable::TRestoringMap pMap;
-          VISU::Storable::StrToMap(strIn, pMap);
-          bool isExist;
-          VISU::VISUType aType = (VISU::VISUType)VISU::Storable::FindValue(pMap,"myType",&isExist).toInt();
-          if (isExist && aType == VISU::TTIMESTAMP) {
-            _PTR(ChildIterator) anIter = aCStudy->NewChildIterator(aSObject);
-            _PTR(SObject) aPrs;
-            for (; anIter->More(); anIter->Next()) {
-              aPrs = anIter->Value();
-              if (!aPrs) continue;
-              std::vector<VISU::Prs3d_i*> aSubList = GetPrs3dList(this, aPrs);
-              nbPrs += aSubList.size();
-            }
-          }
-        }
+       VISU::VISUType aType = VISU::Storable::SObject2Type( aSObject );
+       if (aType == VISU::TTIMESTAMP) {
+         _PTR(ChildIterator) anIter = aCStudy->NewChildIterator(aSObject);
+         _PTR(SObject) aPrs;
+         for (; anIter->More(); anIter->Next()) {
+           aPrs = anIter->Value();
+           if (!aPrs) 
+             continue;
+           std::vector<VISU::Prs3d_i*> aSubList = GetPrs3dList(this, aPrs);
+           nbPrs += aSubList.size();
+         }
+       }
       }
     }
   }
@@ -2744,31 +2728,19 @@ void VisuGUI::contextMenuPopup( const QString& theClient, QPopupMenu* theMenu, Q
   SALOME_ListIteratorOfListIO It1 (aListIO);
   for (; It1.More() && !isCurves; It1.Next()) {
     Handle(SALOME_InteractiveObject)& anIO = It1.Value();
-
     if (!anIO.IsNull() && anIO->hasEntry()) {
       _PTR(SObject) aSObject = aCStudy->FindObjectID(anIO->getEntry());
       if ( !aSObject )
        continue;
-      _PTR(GenericAttribute) anAttr;
-      if (aSObject->FindAttribute(anAttr, "AttributeString")) {
-        _PTR(AttributeString) aComment (anAttr);
-        string aComm = aComment->Value();
-        QString strIn (aComm.c_str());
-        VISU::Storable::TRestoringMap pMap;
-        VISU::Storable::StrToMap(strIn, pMap);
-        bool isExist;
-        VISU::VISUType aType = (VISU::VISUType)VISU::Storable::FindValue(pMap,"myType",&isExist).toInt();
-       if (isExist && aType == VISU::TCURVE) {
-          isCurves = true;
-        }  else {
-         VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry(GetAppStudy(this), anIO->getEntry());
-         if(VISU::Prs3d_i* aPrsObject = VISU::GetPrs3dFromBase(anObjectInfo.myBase)){
-           if (aPrsObject->GetType() == VISU::TCUTPLANES) {
-             VISU::CutPlanes_i* aCutPrs = dynamic_cast<VISU::CutPlanes_i*>(aPrsObject);
-             if (aCutPrs) {
-               isOneCutPlane = aCutPrs->GetNbPlanes() == 1;
-             }
-           }
+      VISU::VISUType aType = VISU::Storable::SObject2Type( aSObject );
+      if (aType == VISU::TCURVE) {
+       isCurves = true;
+      }  else {
+       VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry(GetAppStudy(this), anIO->getEntry());
+       if(VISU::Prs3d_i* aPrsObject = VISU::GetPrs3dFromBase(anObjectInfo.myBase)){
+         if (aPrsObject->GetType() == VISU::TCUTPLANES) {
+           if (VISU::CutPlanes_i* aCutPrs = dynamic_cast<VISU::CutPlanes_i*>(aPrsObject))
+             isOneCutPlane = aCutPrs->GetNbPlanes() == 1;
          }
        }
       }
@@ -2785,7 +2757,7 @@ void VisuGUI::contextMenuPopup( const QString& theClient, QPopupMenu* theMenu, Q
   VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
   Handle(SALOME_InteractiveObject) anIO = aSelectionItem.myIO;
   _PTR(SObject) aSObject = aSelectionItem.myObjectInfo.mySObject;
-  VISU::Storable::TRestoringMap aMap = VISU::GetStorableMap(aSObject);
+  Storable::TRestoringMap aMap = Storable::GetStorableMap(aSObject);
   CORBA::Object_var anObject = VISU::ClientSObjectToObject(aSObject);
 
   if(VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase){
@@ -2810,9 +2782,7 @@ void VisuGUI::contextMenuPopup( const QString& theClient, QPopupMenu* theMenu, Q
   if (aListIO.Extent() != 1) 
     return;
 
-  bool isExist;
-  VISU::VISUType aType = (VISU::VISUType)VISU::Storable::FindValue(aMap,"myType",&isExist).toInt();
-
+  VISU::VISUType aType = VISU::Storable::RestoringMap2Type( aMap );
   if (aType == VISU::TANIMATION) {
     action( VISU_SHOW_ANIMATION )->addTo(theMenu);
 
@@ -3402,23 +3372,22 @@ void VisuGUI::OnPlot3dFromCutPlane()
  if (aCutPrs) {
    _PTR(SObject) aTimeStampSObj = aSObject->GetFather();
    if (SUIT_ViewManager* aViewManager = getApp()->activeViewManager()) {
-     QString aType = aViewManager->getType();
-     bool isVVTK = aType == VVTK_Viewer::Type();
+     QString aViewType = aViewManager->getType();
+     bool anIsVVTK = (aViewType == VVTK_Viewer::Type());
 
-     Storable::TRestoringMap aMap = getMapOfValue(aTimeStampSObj);
-     bool isExist;
-     aType = Storable::FindValue(aMap,"myType",&isExist);
-     if (!isExist || aType.toInt() != TTIMESTAMP )
+     Storable::TRestoringMap aRestoringMap = Storable::GetStorableMap(aTimeStampSObj);
+     VISU::VISUType aType = VISU::Storable::RestoringMap2Type( aRestoringMap );
+     if (aType != TTIMESTAMP )
        return;
      
-     QString aMeshName = Storable::FindValue(aMap,"myMeshName",&isExist).latin1();
-     QString anEntity = Storable::FindValue(aMap,"myEntityId",&isExist).latin1();
-     QString aFieldName = Storable::FindValue(aMap,"myFieldName",&isExist).latin1();
-     QString aTimeStampId = Storable::FindValue(aMap,"myTimeStampId",&isExist).latin1();
+     QString aMeshName = aRestoringMap["myMeshName"];
+     QString anEntity = aRestoringMap["myEntityId"];
+     QString aFieldName = aRestoringMap["myFieldName"];
+     QString aTimeStampId = aRestoringMap["myTimeStampId"];
 
      int aPos;
      SUIT_ViewWindow* aViewWindow = 0;
-     if (isVVTK) {
+     if (anIsVVTK) {
        aViewWindow = GetViewWindow<VVTK_Viewer>(this);
        aPos = GetFreePositionOfDefaultScalarBar(this, dynamic_cast<VVTK_ViewWindow*>(aViewWindow));
      } else {
index 50c42cdc7ac8387bc8cf9331a33f14c688c4b006..c2a0ca799813950648e03b81eee16d1d3c8a0759 100644 (file)
@@ -78,25 +78,16 @@ bool VisuGUI_FieldFilter::isOk( const SUIT_DataOwner* theDataOwner ) const
     if( !aSObject )
       return false;
 
-    _PTR(GenericAttribute) anAttr;
-    if( !aSObject->FindAttribute( anAttr, "AttributeString" ) )
+    VISU::Storable::TRestoringMap aRestoringMap = VISU::Storable::GetStorableMap( aSObject );
+    if( aRestoringMap.empty() )
       return false;
 
-    _PTR(AttributeString) aComment( anAttr );
-    string aComm = aComment->Value();
-    QString strIn( aComm.c_str() );
-
-    bool isExist;
-    VISU::Storable::TRestoringMap aMap;
-    VISU::Storable::StrToMap( strIn, aMap );
-    VISU::VISUType aType = ( VISU::VISUType )VISU::Storable::FindValue( aMap, "myType", &isExist ).toInt();
-
-    if( aType == VISU::TFIELD )
-    {
+    VISU::VISUType aType = VISU::Storable::RestoringMap2Type( aRestoringMap );
+    if( aType == VISU::TFIELD ) {
       VISU::Result_var aResult = FindResult( VISU::GetSObject( aSObject ).in() );
-      QString aMeshName = VISU::getValue( aSObject, "myMeshName" );
-      int anEntity = VISU::getValue( aSObject, "myEntityId" ).toInt();
-      QString aFieldName = VISU::getValue( aSObject, "myName" );
+      QString aMeshName =  aRestoringMap["myMeshName"];
+      int anEntity = aRestoringMap["myEntityId"].toInt();
+      QString aFieldName = aRestoringMap["myName"];
 
       VISU::ColoredPrs3dHolder::BasicInput anInput;
       anInput.myResult = aResult;
index 776d8d59ed61e178c2f9ce4f969f41251f677aa0..4f7379bbee246fb6a79faee3a5f93ffa04a9d885 100644 (file)
@@ -356,17 +356,7 @@ void VisuGUI_InputPane::onSelectionChanged()
   if (!aSObject)
     return;
 
-  VISU::Storable::TRestoringMap aMap;
-  _PTR(GenericAttribute) anAttr;
-  if (!aSObject->FindAttribute(anAttr, "AttributeString"))
-    return;
-
-  _PTR(AttributeString) aComment (anAttr);
-  string aComm = aComment->Value();
-  QString strIn (aComm.c_str());
-  VISU::Storable::StrToMap(strIn, aMap);
-  bool isExist;
-  VISU::VISUType aType = (VISU::VISUType)VISU::Storable::FindValue(aMap,"myType",&isExist).toInt();
+  VISU::VISUType aType = VISU::Storable::SObject2Type(aSObject);
   if (aType == VISU::TFIELD)
   {
     _PTR(SObject) aMedObject = aSObject->GetFather()->GetFather()->GetFather();
@@ -392,7 +382,8 @@ void VisuGUI_InputPane::onSelectionChanged()
          anEntityName = aRefObj->GetName().c_str();
       }
 
-      if( VISU::getValue(aChildObj, "myComment") == "TIMESTAMP" )
+      VISU::Storable::TRestoringMap aRestoringMap = VISU::Storable::GetStorableMap(aChildObj);
+      if( aRestoringMap["myComment"] == "TIMESTAMP" )
       {
        aTimeStampName = aChildObj->GetName().c_str();
        myTimeStamps->insertItem( aTimeStampName );
@@ -401,11 +392,12 @@ void VisuGUI_InputPane::onSelectionChanged()
 
     myResult = VISU::FindResult( VISU::GetSObject( aSObject ).in() );
 
-    myEntity = VISU::getValue( aSObject, "myEntityId" ).toInt();
+    VISU::Storable::TRestoringMap aRestoringMap = VISU::Storable::GetStorableMap(aSObject);
+    myEntity = aRestoringMap["myEntityId"].toInt();
 
     QString aMedFile = aMedObject->GetName().c_str();
-    QString aMeshName = VISU::getValue(aSObject, "myMeshName");
-    QString aFieldName = VISU::getValue(aSObject, "myName");
+    QString aMeshName = aRestoringMap["myMeshName"];
+    QString aFieldName = aRestoringMap["myName"];
 
     myMedFile->setText( aMedFile );
     myMeshName->setText( aMeshName );
index af5fea406718e8df011c45b5f65b64ef330585f4..7efafbf6c2bd321797969d30d5009f8c3dadd80d 100644 (file)
@@ -1357,17 +1357,11 @@ namespace
          anIsFirst = false;
          
          // To update selection
-         _PTR(GenericAttribute) anAttr;
-         if(aChildSObject->FindAttribute(anAttr,"AttributeString")){
-           _PTR(AttributeString) aComment(anAttr);
-           
-           QString aStream(aComment->Value().c_str());
-           Storable::TRestoringMap aMap;
-           Storable::StrToMap(aStream,aMap);
-           
-           bool anIsSelected = Storable::FindValue(aMap,"myIsSelected").toInt();
-           bool aHasSubId = Storable::FindValue(aMap,"myHasSubId").toInt();
-           int aSubId = Storable::FindValue(aMap,"mySubId").toInt();
+         Storable::TRestoringMap aMap = Storable::GetStorableMap(aChildSObject);
+         if(!aMap.empty()){
+           bool anIsSelected = aMap["myIsSelected"].toInt();
+           bool aHasSubId = aMap["myHasSubId"].toInt();
+           int aSubId = aMap["mySubId"].toInt();
            
            if(anIsSelected){
              std::string anEntry = aSObject->GetID();
@@ -1485,14 +1479,9 @@ namespace
   {
     _PTR(Study) aCStudy = GetCStudy(GetAppStudy(theModule));
 
-    _PTR(GenericAttribute) anAttr;
-    if(theSObject->FindAttribute(anAttr,"AttributeString")){
-      _PTR(AttributeString) aComment(anAttr);
-      QString aStream(aComment->Value().c_str());
-      Storable::TRestoringMap aMap;
-      Storable::StrToMap(aStream,aMap);
-      SetViewParams(theMainWindow,aMap);
-    }
+    Storable::TRestoringMap aMap = Storable::GetStorableMap(theSObject);
+    if(!aMap.empty())
+      SetViewParams(theMainWindow, aMap);
   }
 }
 
@@ -1532,12 +1521,8 @@ OnRestoreConfiguration()
     _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
     _PTR(SObject) aSObject = aCStudy->FindObjectID(anIO->getEntry());
     myConfigSObject = aSObject;
-    _PTR(GenericAttribute) anAttr;
-    if(aSObject->FindAttribute(anAttr,"AttributeString")){
-      _PTR(AttributeString) aComment(anAttr);
-      QString aStream(aComment->Value().c_str());
-      Storable::TRestoringMap aMap;
-      Storable::StrToMap(aStream,aMap);
+    Storable::TRestoringMap aMap = Storable::GetStorableMap(aSObject);
+    if(!aMap.empty()){
       SUIT_ViewWindow* aWindow = aViewManager->getActiveView();
       VVTK_ViewWindow* aViewWindow = dynamic_cast<VVTK_ViewWindow*>(aWindow);
       
index 43c665852fbf36fac0bef8a9ecf2e07627527c12..043db8bd2131a78c5766810974035fd9085d0850 100644 (file)
@@ -82,7 +82,7 @@ QString VisuGUI_Selection::type( const int ind ) const
     return aResStr;
 
   VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry(aStudy, entry( ind ));
-  VISU::Storable::TRestoringMap aMap = VISU::GetStorableMap(anObjectInfo.mySObject);
+  VISU::Storable::TRestoringMap aMap = VISU::Storable::GetStorableMap(anObjectInfo.mySObject);
 
   VISU::Base_i* aBase = anObjectInfo.myBase;
   if(aBase){
@@ -113,24 +113,21 @@ QString VisuGUI_Selection::type( const int ind ) const
   }
 
   if(aResStr.isNull()){
-    bool isExist;
-    VISU::VISUType aType = (VISU::VISUType)VISU::Storable::FindValue( aMap, "myType", &isExist).toInt();
-    if( isExist ){
-      switch (aType) {
-       ENUM2STRING( aResStr, VISU::TENTITY );
-       ENUM2STRING( aResStr, VISU::TFAMILY );
-       ENUM2STRING( aResStr, VISU::TGROUP );
-       ENUM2STRING( aResStr, VISU::TVIEW3D );
-       ENUM2STRING( aResStr, VISU::TFIELD );
-       ENUM2STRING( aResStr, VISU::TTIMESTAMP );
-      }
+    VISU::VISUType aType = VISU::Storable::RestoringMap2Type(aMap);
+    switch (aType) {
+      ENUM2STRING( aResStr, VISU::TENTITY );
+      ENUM2STRING( aResStr, VISU::TFAMILY );
+      ENUM2STRING( aResStr, VISU::TGROUP );
+      ENUM2STRING( aResStr, VISU::TVIEW3D );
+      ENUM2STRING( aResStr, VISU::TFIELD );
+      ENUM2STRING( aResStr, VISU::TTIMESTAMP );
     }
   }
 
   if(aResStr.isNull()){
-    bool isExist;
-    QString aVal = VISU::Storable::FindValue(aMap,"myComment",&isExist);
-    if ( isExist && aVal!="MESH" )
+    bool anIsExist;
+    QString aVal = VISU::Storable::FindValue(aMap, "myComment", &anIsExist);
+    if ( anIsExist && aVal != "MESH" )
       aResStr = "VISU::T" + aVal;
   }
 
@@ -145,7 +142,7 @@ QString VisuGUI_Selection::nbComponents( const int ind ) const
     return aResStr;
 
   VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry(aStudy, entry( ind ));
-  VISU::Storable::TRestoringMap aMap = VISU::GetStorableMap(anObjectInfo.mySObject);
+  VISU::Storable::TRestoringMap aMap = VISU::Storable::GetStorableMap(anObjectInfo.mySObject);
 
   bool isExist;
   QString aVal = VISU::Storable::FindValue(aMap,"myNumComponent",&isExist);
@@ -161,7 +158,7 @@ QString VisuGUI_Selection::medEntity( const int ind ) const
     return QString();
 
   VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry(aStudy, entry( ind ));
-  VISU::Storable::TRestoringMap aMap = VISU::GetStorableMap(anObjectInfo.mySObject);
+  VISU::Storable::TRestoringMap aMap = VISU::Storable::GetStorableMap(anObjectInfo.mySObject);
 
   bool isExist;
   QString aVal = VISU::Storable::FindValue(aMap,"myEntityId",&isExist);
@@ -217,7 +214,7 @@ QString VisuGUI_Selection::nbTimeStamps( const int ind ) const
     return aResStr;
 
   VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry(aStudy, entry( ind ));
-  VISU::Storable::TRestoringMap aMap = VISU::GetStorableMap(anObjectInfo.mySObject);
+  VISU::Storable::TRestoringMap aMap = VISU::Storable::GetStorableMap(anObjectInfo.mySObject);
 
   bool isExist;
   const QString& aVal = VISU::Storable::FindValue(aMap,"myNbTimeStamps",&isExist);
index a9285458b808dce5e432e2d87a58011ca69511a8..2030835de831945febdc0d94e5cdec0634f0a5ea 100644 (file)
@@ -197,17 +197,15 @@ namespace VISU
                     _PTR(SObject) theTimeStamp,
                     ColoredPrs3d_i::EPublishInStudyMode thePublishInStudyMode)
   {
-    Storable::TRestoringMap aMap = getMapOfValue(theTimeStamp);
-
-    bool isExist;
-    QString aType = Storable::FindValue(aMap,"myType",&isExist);
-    if (!isExist || aType.toInt() != TTIMESTAMP )
+    Storable::TRestoringMap aRestoringMap = Storable::GetStorableMap(theTimeStamp);
+    VISU::VISUType aType = VISU::Storable::RestoringMap2Type(aRestoringMap);
+    if ( aType != TTIMESTAMP )
       return NULL;
 
-    QString aMeshName = Storable::FindValue(aMap,"myMeshName",&isExist).latin1();
-    QString anEntity = Storable::FindValue(aMap,"myEntityId",&isExist).latin1();
-    QString aFieldName = Storable::FindValue(aMap,"myFieldName",&isExist).latin1();
-    QString aTimeStampId = Storable::FindValue(aMap,"myTimeStampId",&isExist).latin1();
+    QString aMeshName = aRestoringMap["myMeshName"];
+    QString anEntity = aRestoringMap["myEntityId"];
+    QString aFieldName = aRestoringMap["myFieldName"];
+    QString aTimeStampId = aRestoringMap["myTimeStampId"];
 
     // Create new TViewWindow instance, if it does not exist.
     typedef typename TViewer::TViewWindow TViewWindow;
index 482f8c5714ec83878c3ced22a910b0ef13a87cca..13c8046de98c9031e6eac71c6e13c799119e7f03 100644 (file)
@@ -190,48 +190,33 @@ void VisuGUI_ScalarMapOnDeformedShapeDlg::initFromPrsObject(VISU::ColoredPrs3d_i
       Handle(SALOME_InteractiveObject) aIO = selected.First();
       if (aIO->hasEntry()) {
        _PTR(SObject) aSObject = aActiveStudy->FindObjectID(aIO->getEntry());
-
-       _PTR(GenericAttribute) anTmpAttr;
-       if (aSObject->FindAttribute(anTmpAttr, "AttributeString")) {
-         _PTR(AttributeString) aTmpComment (anTmpAttr);
-         string aTmpComm = aTmpComment->Value();
-         QString aTmpstrIn (aTmpComm.c_str());
-         VISU::Storable::TRestoringMap aTmpaMap;
-         VISU::Storable::StrToMap(aTmpstrIn,aTmpaMap);
-         bool aTmpisExist;
-         VISU::VISUType aTmpType =
-            (VISU::VISUType)VISU::Storable::FindValue(aTmpaMap,"myType",&aTmpisExist).toInt();
-         switch(aTmpType){
-         case VISU::TTIMESTAMP:
-           {
-             aSObject = aSObject->GetFather();
-             aSObject = aSObject->GetFather();
-             break;
-           }
-         case VISU::TFIELD:
-           {
-             _PTR(SObject) newSObject;
-             if(aSObject->ReferencedObject(newSObject)) aSObject = newSObject;
-             aSObject = aSObject->GetFather();
-             break;
-           }
-         case VISU::TANIMATION:
-           {
-             _PTR(ChildIterator) aTmpIter = aActiveStudy->NewChildIterator(aSObject);
-             for (aTmpIter->InitEx(true); aTmpIter->More(); aTmpIter->Next()) {
-               _PTR(SObject) aTmpChildSObj = aTmpIter->Value();
-               _PTR(SObject) newSObject;
-               if(aTmpChildSObj->ReferencedObject(newSObject)){
-                 aSObject = newSObject;
-                 aSObject->GetFather();
-                 break;
-               }
-             }
+       VISU::VISUType aType = VISU::Storable::SObject2Type( aSObject );
+       switch(aType){
+       case VISU::TTIMESTAMP: {
+         aSObject = aSObject->GetFather();
+         aSObject = aSObject->GetFather();
+         break;
+       }
+       case VISU::TFIELD: {
+         _PTR(SObject) newSObject;
+         if(aSObject->ReferencedObject(newSObject)) aSObject = newSObject;
+         aSObject = aSObject->GetFather();
+         break;
+       }
+       case VISU::TANIMATION: {
+         _PTR(ChildIterator) aTmpIter = aActiveStudy->NewChildIterator(aSObject);
+         for (aTmpIter->InitEx(true); aTmpIter->More(); aTmpIter->Next()) {
+           _PTR(SObject) aTmpChildSObj = aTmpIter->Value();
+           _PTR(SObject) newSObject;
+           if(aTmpChildSObj->ReferencedObject(newSObject)){
+             aSObject = newSObject;
+             aSObject->GetFather();
              break;
            }
          }
-       }
-
+         break;
+       }}
+       
        aSObject = aSObject->GetFather();
        aSObject = aSObject->GetFather();
 
@@ -248,47 +233,34 @@ void VisuGUI_ScalarMapOnDeformedShapeDlg::initFromPrsObject(VISU::ColoredPrs3d_i
 
       for (aIter->InitEx(true); aIter->More(); aIter->Next()) {
         _PTR(SObject) aChildSObj = aIter->Value();
-        _PTR(GenericAttribute) anAttr;
-        if (aChildSObj->FindAttribute(anAttr, "AttributeString")) {
-          _PTR(AttributeString) aComment (anAttr);
-          string aComm = aComment->Value();
-          QString strIn (aComm.c_str());
-          VISU::Storable::TRestoringMap aMap;
-          VISU::Storable::StrToMap(strIn,aMap);
-          bool isExist;
-          VISU::VISUType aType = (VISU::VISUType)VISU::Storable::FindValue(aMap,"myType",&isExist).toInt();
-          if (isExist) {
-            if ((aType == VISU::TTIMESTAMP)) {
-              _PTR(GenericAttribute) anAttr;
-              if (aChildSObj->FindAttribute(anAttr, "AttributeName")) {
-                _PTR(AttributeName) aNameAttr(anAttr);
-                QString aMeshName = VISU::getValue(aChildSObj, "myMeshName");
-               CORBA::String_var aName = myPrsCopy->GetMeshName();
-                if (aMeshName != aName.in()) 
-                 continue;
-                QString aFieldName = VISU::getValue(aChildSObj, "myFieldName");
-                QString aTimeIter  = VISU::getValue(aChildSObj, "myTimeStampId");
-                QString aEntity    = VISU::getValue(aChildSObj, "myEntityId");
-                VISU::Entity anEntity;
-                switch (aEntity.toInt()) {
-                case 0: anEntity = VISU::NODE; break;
-                case 1: anEntity = VISU::EDGE; break;
-                case 2: anEntity = VISU::FACE; break;
-                case 3: anEntity = VISU::CELL; break;
-                }
-                TFieldName2TimeStamps& aFieldName2TimeStamps = myEntity2Fields[anEntity];
-                TTimeStampNumber2Time& aTimeStampNumber2Time = aFieldName2TimeStamps[aFieldName];
-               aTimeStampNumber2Time[aTimeIter.toInt()] = 
-                  GetFloatValueOfTimeStamp(anEntity,
-                                          aFieldName.latin1(),
-                                           aTimeIter.toInt());
-              }
-            }
-          }
+       VISU::Storable::TRestoringMap aRestoringMap = VISU::Storable::GetStorableMap(aChildSObj);
+        if (!aRestoringMap.empty()) {
+         VISU::VISUType aType = VISU::Storable::RestoringMap2Type(aRestoringMap);
+         if (aType == VISU::TTIMESTAMP) {
+           QString aMeshName = aRestoringMap["myMeshName"];
+           CORBA::String_var aName = myPrsCopy->GetMeshName();
+           if (aMeshName != aName.in()) 
+             continue;
+           QString aFieldName = aRestoringMap["myFieldName"];
+           QString aTimeIter  = aRestoringMap["myTimeStampId"];
+           QString aEntity    = aRestoringMap["myEntityId"];
+           VISU::Entity anEntity;
+           switch (aEntity.toInt()) {
+           case 0: anEntity = VISU::NODE; break;
+           case 1: anEntity = VISU::EDGE; break;
+           case 2: anEntity = VISU::FACE; break;
+           case 3: anEntity = VISU::CELL; break;
+           }
+           TFieldName2TimeStamps& aFieldName2TimeStamps = myEntity2Fields[anEntity];
+           TTimeStampNumber2Time& aTimeStampNumber2Time = aFieldName2TimeStamps[aFieldName];
+           aTimeStampNumber2Time[aTimeIter.toInt()] = 
+             GetFloatValueOfTimeStamp(anEntity,
+                                      aFieldName.latin1(),
+                                      aTimeIter.toInt());
+         }
         }
       }
     }
-
     AddAllFieldNames();
   }
   myFieldsCombo->setCurrentText(aFieldName.in());
index 7d2b00919df6aa86830181424036c67f6b4153c2..e5608936bf635784ebc96d7dd92e025ee49108b7 100644 (file)
@@ -399,23 +399,15 @@ void VisuGUI_SelectionDlg::onSelectionEvent() {
   
 
   if (aPrs3d) {
-    VISU::Storable::TRestoringMap aMap;
+    QString aMeshName("NULL"), aFieldName("NULL");
     if (aSObject) {
-      _PTR(GenericAttribute) anAttr;
-      if (aSObject->FindAttribute(anAttr, "AttributeString")) {
-        _PTR(AttributeString) aComment (anAttr);
-        std::string aString = aComment->Value();
-        QString strIn( aString.c_str() );
-        VISU::Storable::StrToMap(strIn, aMap);
+      VISU::Storable::TRestoringMap aMap = VISU::Storable::GetStorableMap(aSObject);
+      if (!aMap.empty()) {
+       aMeshName  = VISU::Storable::FindValue(aMap, "myMeshName");
+       aFieldName = VISU::Storable::FindValue(aMap, "myFieldName");
       }
     }
 
-    QString aMeshName("NULL"), aFieldName("NULL");
-    if (!aMap.empty()) {
-      aMeshName  = VISU::Storable::FindValue(aMap, "myMeshName");
-      aFieldName = VISU::Storable::FindValue(aMap, "myFieldName");
-    }
-
     myMeshName ->setText((aMeshName  == "NULL") ? QString("No name") : aMeshName);
     myFieldName->setText((aFieldName == "NULL") ? QString("No name") : aFieldName);
 
index ed02c77b445cea3d4ea9e43d0ecaab1a043bb5f1..d58995ee7f13f3d59c51d00504289e39594c6ff2 100644 (file)
@@ -110,48 +110,33 @@ VisuGUI_StreamLinesDlg::VisuGUI_StreamLinesDlg (SalomeApp_Module* theModule)
     Handle(SALOME_InteractiveObject) aIO = selected.First();
     if (aIO->hasEntry()) {
       _PTR(SObject) aSObject = aActiveStudy->FindObjectID(aIO->getEntry());
-
-      _PTR(GenericAttribute) anTmpAttr;
-      if (aSObject->FindAttribute(anTmpAttr, "AttributeString")) {
-        _PTR(AttributeString) aTmpComment (anTmpAttr);
-        string aTmpComm = aTmpComment->Value();
-        QString aTmpstrIn (aTmpComm.c_str());
-        VISU::Storable::TRestoringMap aTmpaMap;
-        VISU::Storable::StrToMap(aTmpstrIn,aTmpaMap);
-        bool aTmpisExist;
-        VISU::VISUType aTmpType =
-          (VISU::VISUType)VISU::Storable::FindValue(aTmpaMap,"myType",&aTmpisExist).toInt();
-        switch (aTmpType) {
-        case VISU::TTIMESTAMP:
-          {
-            aSObject = aSObject->GetFather();
-            aSObject = aSObject->GetFather();
-            break;
-          }
-        case VISU::TFIELD:
-          {
-            _PTR(SObject) newSObject;
-            if(aSObject->ReferencedObject(newSObject)) aSObject = newSObject;
-            aSObject = aSObject->GetFather();
-            break;
-          }
-        case VISU::TANIMATION:
-          {
-            _PTR(ChildIterator) aTmpIter = aActiveStudy->NewChildIterator(aSObject);
-            for (aTmpIter->InitEx(true); aTmpIter->More(); aTmpIter->Next()) {
-              _PTR(SObject) aTmpChildSObj = aTmpIter->Value();
-              _PTR(SObject) newSObject;
-              if(aTmpChildSObj->ReferencedObject(newSObject)){
-                aSObject = newSObject;
-                aSObject->GetFather();
-                break;
-              }
-            }
-            break;
-          }
-        }
+      VISU::VISUType aType = VISU::Storable::SObject2Type(aSObject);
+      switch (aType) {
+      case VISU::TTIMESTAMP: {
+       aSObject = aSObject->GetFather();
+       aSObject = aSObject->GetFather();
+       break;
       }
-
+      case VISU::TFIELD: {
+       _PTR(SObject) newSObject;
+       if(aSObject->ReferencedObject(newSObject)) aSObject = newSObject;
+       aSObject = aSObject->GetFather();
+       break;
+      }
+      case VISU::TANIMATION: {
+       _PTR(ChildIterator) aTmpIter = aActiveStudy->NewChildIterator(aSObject);
+       for (aTmpIter->InitEx(true); aTmpIter->More(); aTmpIter->Next()) {
+         _PTR(SObject) aTmpChildSObj = aTmpIter->Value();
+         _PTR(SObject) newSObject;
+         if(aTmpChildSObj->ReferencedObject(newSObject)){
+           aSObject = newSObject;
+           aSObject->GetFather();
+           break;
+         }
+       }
+       break;
+      }}
+      
       aSObject = aSObject->GetFather();
       aSObject = aSObject->GetFather();
 
@@ -186,36 +171,25 @@ VisuGUI_StreamLinesDlg::VisuGUI_StreamLinesDlg (SalomeApp_Module* theModule)
         }
       }
 
-      _PTR(GenericAttribute) anAttr;
-      if (aChildSObj->FindAttribute(anAttr, "AttributeString")) {
-        _PTR(AttributeString) aComment (anAttr);
-        string aComm = aComment->Value();
-        QString strIn (aComm.c_str());
-        VISU::Storable::TRestoringMap aMap;
-        VISU::Storable::StrToMap(strIn,aMap);
-        bool isExist;
-        VISU::VISUType aType = (VISU::VISUType)VISU::Storable::FindValue(aMap,"myType",&isExist).toInt();
-        if (isExist) {
-          if ((aType == VISU::TFAMILY) || (aType == VISU::TGROUP) || (aType == VISU::TENTITY)) {
-            _PTR(GenericAttribute) aNameAttr;
-            if (aChildSObj->FindAttribute(aNameAttr, "AttributeName")) {
-              _PTR(AttributeName) aName (aNameAttr);
-              VISU::Prs3d_var aPrsObj = VISU::Prs3d::_narrow(aChildObject);
-              switch (aType) {
-              case VISU::TFAMILY:
-                myFamilisLst += QString(aName->Value().c_str());
-                myFamilyList.append(aPrsObj);
-                break;
-              case VISU::TGROUP:
-                myGroupsLst += QString(aName->Value().c_str());
-                myGroupList.append(aPrsObj);
-                break;
-              case VISU::TENTITY:
-                myEntitiesLst += QString(aName->Value().c_str());
-                myEntityList.append(aPrsObj);
-                break;
-              }
-            }
+      VISU::VISUType aType = VISU::Storable::SObject2Type(aChildSObj);
+      if ((aType == VISU::TFAMILY) || (aType == VISU::TGROUP) || (aType == VISU::TENTITY)) {
+       _PTR(GenericAttribute) aNameAttr;
+       if (aChildSObj->FindAttribute(aNameAttr, "AttributeName")) {
+         _PTR(AttributeName) aName (aNameAttr);
+         VISU::Prs3d_var aPrsObj = VISU::Prs3d::_narrow(aChildObject);
+         switch (aType) {
+         case VISU::TFAMILY:
+           myFamilisLst += QString(aName->Value().c_str());
+           myFamilyList.append(aPrsObj);
+           break;
+         case VISU::TGROUP:
+           myGroupsLst += QString(aName->Value().c_str());
+           myGroupList.append(aPrsObj);
+           break;
+         case VISU::TENTITY:
+           myEntitiesLst += QString(aName->Value().c_str());
+           myEntityList.append(aPrsObj);
+           break;
           }
         }
       }
@@ -546,84 +520,6 @@ void VisuGUI_StreamLinesDlg::onSourceTypeChange(int theIndex) {
 VISU::Mesh_ptr VisuGUI_StreamLinesDlg::createMesh (VISU::VISUType theType, QString theName)
 {
   return VISU::Mesh::_nil();
-/*
-  CORBA::Object_var anObject = VISU::ClientSObjectToObject(mySelectionObj);
-  VISU::Result_var aResult;
-  if (!CORBA::is_nil(anObject)) {
-    aResult = VISU::Result::_narrow(anObject);
-  }
-  if (CORBA::is_nil(aResult)) {
-    SUIT_MessageBox::warn1(VisuGUI::application()->desktop(), tr("VISU_WARNING"),
-                           tr("WRN_NO_AVAILABLE_DATA"),
-                           tr("BUT_OK"));
-    return VISU::Mesh::_nil();
-  }
-  SALOMEDSClient_ChildIterator* aIter = VisuGUI::GetStudyDocument()->NewChildIterator( mySelectionObj );
-  VISU::Storable::TRestoringMap aMap;
-
-  for (aIter->InitEx(true); aIter->More(); aIter->Next() ) {
-    SALOMEDSClient_SObject* aChildSObj = aIter->Value();
-    SALOMEDSClient_GenericAttribute* anAttr;
-    if (aChildSObj->FindAttribute(anAttr, "AttributeString")) {
-      SALOMEDSClient_AttributeString* aComment = dynamic_cast<SALOMEDSClient_AttributeString*>( anAttr );
-      CORBA::String_var aComm = aComment->Value().c_str();
-      QString strIn(aComm.in());
-      aMap.clear();
-      VISU::Storable::StrToMap(strIn,aMap);
-      bool isExist;
-      VISU::VISUType aType = (VISU::VISUType)VISU::Storable::FindValue(aMap,"myType",&isExist).toInt();
-      if (isExist) {
-       if (aType != theType) continue;
-
-       SALOMEDSClient_GenericAttribute* aNameAttr;
-       if ( aChildSObj->FindAttribute(aNameAttr, "AttributeName") ) {
-         SALOMEDSClient_AttributeName* aName = dynamic_cast<SALOMEDSClient_AttributeName*>(aNameAttr);
-         if (QString(aName->Value()) == theName) break; //use current map
-       }
-      }
-    }
-  }
-  VISU::Mesh_var aMesh;
-  QString aMeshName = VISU::Storable::FindValue(aMap,"myMeshName");
-  switch (theType) {
-  case VISU::TFAMILY:
-    {
-      VISU::Entity anEntity = (VISU::Entity)VISU::Storable::FindValue(aMap,"myEntityId").toInt();
-      aMesh = VisuGUI::GetVisuGen()->FamilyMeshOnEntity(aResult,aMeshName.latin1(),anEntity,theName.latin1());
-    }
-    break;
-  case VISU::TGROUP:
-    {
-      aMesh = VisuGUI::GetVisuGen()->GroupMesh(aResult,aMeshName.latin1(), theName.latin1());
-    }
-    break;
-  case VISU::TENTITY:
-    {
-      VISU::Entity anEntity = (VISU::Entity)VISU::Storable::FindValue(aMap,"myId").toInt();
-      aMesh = VisuGUI::GetVisuGen()->MeshOnEntity(aResult,aMeshName.latin1(),anEntity);
-    }
-    break;
-  }
-  if(!CORBA::is_nil(aMesh)){ // Create Actor
-    VISU::Mesh_i* pPresent = dynamic_cast<VISU::Mesh_i*>(VISU::GetServant(aMesh).in());
-    if(SVTK_ViewWindow* vf = VISU::GetViewWindow()){
-      try{
-       pPresent->SetPresentationType(VISU::POINT);
-       VISU_Actor *anActor = pPresent->CreateActor();
-       vf->AddActor(anActor);
-      }catch(...){
-       SUIT_MessageBox::warn1 ( VisuGUI::application()->desktop(), tr("VISU_WARNING"),
-                               tr("ERR_CANT_CREATE_ACTOR"),
-                               tr("BUT_OK") );
-      }
-    }
-  } else {
-    SUIT_MessageBox::warn1(VisuGUI::application()->desktop(), tr("VISU_WARNING"),
-                           tr("ERR_CANT_BUILD_PRESENTATION"),
-                           tr("BUT_OK"));
-  }
-  return aMesh._retn();
-*/
 }
 
 void VisuGUI_StreamLinesDlg::accept() {
index 1c18ca340fbdd9f0fa64c91bc26653fa888d885f..49ad4f9a2bb079be31e17a63ecfddd294d9fae92 100644 (file)
@@ -96,7 +96,9 @@ ArrangeDlg::ArrangeDlg(QWidget* theParent, VISU_TimeAnimation* theAnimator)
   QStringList aFieldNames;
   // Find names of fields
   for (int i = 0; i < myAnimator->getNbFields(); i++) {
-    aFieldNames.append(VISU::getValue(myAnimator->getFieldData(i).myField, "myName"));
+    _PTR(SObject) aSObject = myAnimator->getFieldData(i).myField;
+    VISU::Storable::TRestoringMap aRestoringMap = VISU::Storable::GetStorableMap(aSObject);
+    aFieldNames.append(aRestoringMap["myName"]);
     Offset aOffs;
     aOffs.myOffset[0] = myAnimator->getFieldData(i).myOffset[0];
     aOffs.myOffset[1] = myAnimator->getFieldData(i).myOffset[1];
@@ -548,11 +550,14 @@ SetupDlg::SetupDlg (QWidget* theParent,
   // Find names of fields
   for (int i = 0; i < myAnimator->getNbFields(); i++) {
     _PTR(SObject) aSO = myAnimator->getFieldData(i).myField;
-    QString aFieldName(VISU::getValue(aSO, "myName"));
+    VISU::Storable::TRestoringMap aRestoringMap = VISU::Storable::GetStorableMap(aSO);
+    QString aFieldName(aRestoringMap["myName"]);
     if ( myAnimator->getAnimationMode() == 0 )
       aFieldNames.append(aFieldName);
     else if ( myAnimator->getAnimationMode() == 1 ) {
-      QString aFileName(VISU::getValue(aSO->GetFather()->GetFather()->GetFather(),"myInitFileName"));
+      _PTR(SObject) aSObject = aSO->GetFather()->GetFather()->GetFather();
+      VISU::Storable::TRestoringMap aRestoringMap = VISU::Storable::GetStorableMap(aSObject);
+      QString aFileName(aRestoringMap["myInitFileName"]);
       aFileName = aFileName.right(aFileName.length() - (aFileName.findRev("/") + 1));
       aFieldNames.append(aFileName + QString(" : ") + aFieldName);
     }
@@ -651,10 +656,11 @@ void SetupDlg::onFieldChange (int theIndex)
     
     FieldData& aData = myAnimator->getFieldData(theIndex);
     _PTR(SObject) aSObject = aData.myField;
-    long aNumComp = VISU::getValue(aSObject, "myNumComponent").toLong();
+    VISU::Storable::TRestoringMap aRestoringMap = VISU::Storable::GetStorableMap(aSObject);
+    long aNumComp = aRestoringMap["myNumComponent"].toLong();
     anEnableItems = (aNumComp > 1);
     
-    long anEntityId = VISU::getValue(aSObject, "myEntityId").toLong();
+    long anEntityId = aRestoringMap["myEntityId"].toLong();
     anEnableGP = (anEntityId == VISU::CELL);
 
     aPrsType = aData.myPrsType;
@@ -664,10 +670,11 @@ void SetupDlg::onFieldChange (int theIndex)
     
     for (int i = 0; i < myAnimator->getNbFields(); i++) {
       _PTR(SObject) aSO = myAnimator->getFieldData(i).myField;
-      long aNumComp = VISU::getValue(aSO, "myNumComponent").toLong();
+      VISU::Storable::TRestoringMap aRestoringMap = VISU::Storable::GetStorableMap(aSO);
+      long aNumComp = aRestoringMap["myNumComponent"].toLong();
       anEnableItems = (aNumComp > 1);
      
-      long anEntityId = VISU::getValue(aSO, "myEntityId").toLong();
+      long anEntityId = aRestoringMap["myEntityId"].toLong();
       anEnableGP = (anEntityId == VISU::CELL);
 
       if ( !anEnableItems && !anEnableGP ) break;
index 187a120594626d7aedc3ecc13438b034e9be68b4..2156d7ddb1c9705d8b03800cc42e956813ae83a8 100644 (file)
@@ -243,35 +243,6 @@ namespace VISU
   }
 
 
-  //------------------------------------------------------------
-  VISU::Storable::TRestoringMap 
-  getMapOfValue(_PTR(SObject) theSObject)
-  {
-    VISU::Storable::TRestoringMap aMap;
-    if (theSObject) {
-      _PTR(GenericAttribute) anAttr;
-      if (theSObject->FindAttribute(anAttr, "AttributeString")) {
-       _PTR(AttributeString) aComment (anAttr);
-       std::string aValue = aComment->Value();
-       QString aString (aValue.c_str());
-       VISU::Storable::StrToMap(aString, aMap);
-      }
-    }
-    return aMap;
-  }
-
-  //------------------------------------------------------------
-  QString 
-  getValue(_PTR(SObject) theSObject, QString theKey)
-  {
-    QString aStr("");
-    VISU::Storable::TRestoringMap aMap = getMapOfValue(theSObject);
-    if (!aMap.empty())
-      aStr = VISU::Storable::FindValue(aMap, theKey.latin1());
-    return aStr;
-  }
-
-
   //----------------------------------------------------------------------------
   // Selection
   TSelectionInfo
@@ -346,21 +317,6 @@ namespace VISU
     return dynamic_cast<VISU::Prs3d_i*>(theBase);
   }
 
-  //----------------------------------------------------------------------------
-  Storable::TRestoringMap
-  GetStorableMap(_PTR(SObject) theSObject)
-  {
-    Storable::TRestoringMap aMap;
-    if(theSObject){
-      _PTR(GenericAttribute) anAttr;
-      if(theSObject->FindAttribute(anAttr,"AttributeString")){
-       _PTR(AttributeString) aComment (anAttr);
-       std::string aValue = aComment->Value();
-       VISU::Storable::StrToMap(aValue.c_str(), aMap);
-      }
-    }
-    return aMap;
-  }
 
   //----------------------------------------------------------------------------
   bool
@@ -389,6 +345,7 @@ namespace VISU
     return true;
   }
 
+
   //----------------------------------------------------------------------------
   void
   Add(LightApp_SelectionMgr* theSelectionMgr,
@@ -437,18 +394,6 @@ namespace VISU
     _PTR(Study) aStudy = GetCStudy(GetAppStudy(theModule));
     if (!aStudy) return false;
 
-    // In some cases single selection can have its own popup-menu item for deletion
-    /*if (aListIO.Extent() == 1) {
-      Handle(SALOME_InteractiveObject) anIO = aListIO.First();
-      _PTR(SObject) aSObject = aStudy->FindObjectID(anIO->getEntry());
-      if (aSObject) {
-        VISU::VISUType aType = (VISU::VISUType)getValue(aSObject, "myType").toInt();
-        if (aType == VISU::TVIEW3D) {
-          return false; // special case
-        }
-      }
-    }*/
-
     SALOME_ListIteratorOfListIO anIter (aListIO);
     for (; anIter.More(); anIter.Next()) {
       Handle(SALOME_InteractiveObject) anIO = anIter.Value();
@@ -661,12 +606,12 @@ namespace VISU
       TSelectionItem aSelectionItem = aSelectionInfo.front();
       theIO = aSelectionItem.myIO;
       theSObject = aSelectionItem.myObjectInfo.mySObject;
-      QString aValue = getValue(theSObject,"myType");
-      if (aValue.toInt() == int(VISU::TTIMESTAMP)){
+      VISU::VISUType aType = VISU::Storable::SObject2Type(theSObject);
+      if (VISU::TTIMESTAMP == aType){
        thePublishInStudyMode = ColoredPrs3d_i::EPublishUnderTimeStamp;
         return true;
       }
-      if (aValue.toInt() == int(VISU::TFIELD)){
+      if (VISU::TFIELD == aType){
        thePublishInStudyMode = ColoredPrs3d_i::EPublishIndependently;
        if(theSObject->FindSubObject(2,theSObject))
          return true;
@@ -1164,13 +1109,12 @@ namespace VISU
     if (pResult == NULL)
       return;
 
-    Storable::TRestoringMap aMap = getMapOfValue(aResultSObj);
-    bool isExist;
-    string aComment = Storable::FindValue(aMap,"myComment",&isExist).latin1();
-    if (!isExist)
+    Storable::TRestoringMap aMap = Storable::GetStorableMap(aResultSObj);
+    if (aMap.empty())
       return;
 
     CORBA::Object_var aMesh;
+    string aComment = Storable::FindValue(aMap,"myComment").latin1();
     string aMeshName = Storable::FindValue(aMap,"myMeshName").latin1();
 #ifdef CHECKTIME
     Utils_Timer timer;
@@ -1314,60 +1258,45 @@ namespace VISU
         }
       }
     } else {
-      _PTR(GenericAttribute) anAttr;
-      if (theObject->FindAttribute(anAttr, "AttributeString")) {
-        _PTR(AttributeString) aComment (anAttr);
-        string aComm = aComment->Value();
-        QString strIn (aComm.c_str());
-        VISU::Storable::TRestoringMap pMap;
-        VISU::Storable::StrToMap(strIn, pMap);
-        bool isExist;
-        VISU::VISUType aType =
-          (VISU::VISUType)VISU::Storable::FindValue(pMap,"myType",&isExist).toInt();
-        if (isExist) {
-          switch (aType) {
-          case VISU::TFIELD:
-            {
-              _PTR(ChildIterator) anIter = aCStudy->NewChildIterator(theObject);
-              _PTR(SObject) aTimeStamp;
-              anIter->Next(); // First is reference on support
-              for (; anIter->More(); anIter->Next()) {
-                aTimeStamp = anIter->Value();
-                if (!aTimeStamp) continue;
-                std::vector<VISU::Prs3d_i*> aSubList = GetPrs3dList(theModule, aTimeStamp);
-                if (!aSubList.empty()) {
-                  int n = aSubList.size();
-                  aList.resize(k+n);
-                  for (int i = 0; i < n; i++) {
-                    aList[k] = aSubList[i];
-                    k++;
-                  }
-                }
-              }
-            }
-            break;
-          case VISU::TTIMESTAMP:
-            {
-              _PTR(ChildIterator) anIter = aCStudy->NewChildIterator(theObject);
-              _PTR(SObject) aPrs;
-              for (; anIter->More(); anIter->Next()) {
-                aPrs = anIter->Value();
-                if (!aPrs) continue;
-                std::vector<VISU::Prs3d_i*> aSubList = GetPrs3dList(theModule, aPrs);
-                if (!aSubList.empty()) {
-                  int n = aSubList.size();
-                  aList.resize(k+n);
-                  for (int i = 0; i < n; i++) {
-                    aList[k] = aSubList[i];
-                    k++;
-                  }
-                }
-              }
-            }
-            break;
-          }
-        }
+      VISU::VISUType aType = VISU::Storable::SObject2Type(theObject);
+      switch (aType) {
+      case VISU::TFIELD: {
+       _PTR(ChildIterator) anIter = aCStudy->NewChildIterator(theObject);
+       _PTR(SObject) aTimeStamp;
+       anIter->Next(); // First is reference on support
+       for (; anIter->More(); anIter->Next()) {
+         aTimeStamp = anIter->Value();
+         if (!aTimeStamp) continue;
+         std::vector<VISU::Prs3d_i*> aSubList = GetPrs3dList(theModule, aTimeStamp);
+         if (!aSubList.empty()) {
+           int n = aSubList.size();
+           aList.resize(k+n);
+           for (int i = 0; i < n; i++) {
+             aList[k] = aSubList[i];
+             k++;
+           }
+         }
+       }
+       break;
       }
+      case VISU::TTIMESTAMP: {
+       _PTR(ChildIterator) anIter = aCStudy->NewChildIterator(theObject);
+       _PTR(SObject) aPrs;
+       for (; anIter->More(); anIter->Next()) {
+         aPrs = anIter->Value();
+         if (!aPrs) continue;
+         std::vector<VISU::Prs3d_i*> aSubList = GetPrs3dList(theModule, aPrs);
+         if (!aSubList.empty()) {
+           int n = aSubList.size();
+           aList.resize(k+n);
+           for (int i = 0; i < n; i++) {
+             aList[k] = aSubList[i];
+             k++;
+           }
+         }
+       }
+       break;
+      }}
     }
     return aList;
   }
index 8f62c287fab9fc924e7f1255dd51d23d58330797..e0e0eb9cad2eb3d943e3c9b9064400fc9d37a5f6 100644 (file)
@@ -88,9 +88,6 @@ namespace VISU
   VISU_Gen_i*                          GetVisuGen(const CAM_Module* theModule);
   SALOME_MED::MED_Gen_var              GetMEDEngine();
 
-  VISU::Storable::TRestoringMap        getMapOfValue(_PTR(SObject) theSObject);
-  QString                              getValue(_PTR(SObject) theSObject, QString theKey);
-
   // Selection
   LightApp_SelectionMgr*               GetSelectionMgr(const SalomeApp_Module* theModule);
 
@@ -121,8 +118,6 @@ namespace VISU
                                                        Base_i* theBase);
 
   VISU::Prs3d_i*                       GetPrs3dFromBase(Base_i* theBase);
-  
-  Storable::TRestoringMap              GetStorableMap(_PTR(SObject) theSObject);
 
   //----------------------------------------------------------------------------
   void                                 Add(LightApp_SelectionMgr* theSelectionMgr,
index acacfce5e50708d3dbf96a8f9d5d2d29369abcd0..0b7bad1fdee4a12af1bab758dbd32a89e1f57179 100644 (file)
@@ -83,13 +83,15 @@ namespace VISU{
   static int mySCnt = 0;
   static QMutex aMutex(TRUE);
 
-  Mutex::Mutex(QMutex* theMutex): myMutex(&aMutex){
+  Mutex::Mutex(QMutex* theMutex): myMutex(&aMutex)
+  {
     if(MYDEBUG) MESSAGE("Mutex::Mutex : "<<!mySCnt);
     if(!mySCnt++)
       myMutex->lock();
   }
 
-  Mutex::~Mutex(){
+  Mutex::~Mutex()
+  {
     if(!(--mySCnt))
       myMutex->unlock();
     if(MYDEBUG) MESSAGE("Mutex::~Mutex : "<<!mySCnt);
@@ -98,18 +100,21 @@ namespace VISU{
 
   //===========================================================================
   static Storable::TCallbackMap VisuStoreMap;
+
   std::string 
   Storable
   ::ToString()
   {
-    ostringstream strOut;
-    Storable::DataToStream( strOut, "myComment", GetComment() );
-    ToStream(strOut);
-    strOut<<ends;
-    if(MYDEBUG) MESSAGE("Storable::ToString - "<<strOut.str());
-    return strOut.str();
+    ostringstream anOutputStream;
+    Storable::DataToStream( anOutputStream, "myComment", GetComment() );
+    ToStream(anOutputStream);
+    anOutputStream<<ends;
+    if(MYDEBUG) MESSAGE("Storable::ToString - "<<anOutputStream.str());
+    return anOutputStream.str();
   }
 
+
+  //---------------------------------------------------------------
   void 
   Storable
   ::Registry(const std::string& theComment, 
@@ -121,6 +126,119 @@ namespace VISU{
     }
   }
 
+
+  //---------------------------------------------------------------
+  VISU::VISUType
+  Storable
+  ::Comment2Type(const std::string& theComment)
+  {
+    if ( theComment == "CURVE" ) 
+      return VISU::TCURVE;
+    if ( theComment == "TABLE" ) 
+      return VISU::TTABLE;
+    if ( theComment == "CONTAINER" ) 
+      return VISU::TCONTAINER;
+    if ( theComment == "MESH" ) 
+      return VISU::TMESH;
+    if ( theComment == "SCALARMAP" ) 
+      return VISU::TSCALARMAP;
+    if ( theComment == "PRSMERGER" ) 
+      return VISU::TSCALARMAP;
+    if ( theComment == "ISOSURFACE" ) 
+      return VISU::TISOSURFACES;
+    if ( theComment == "DEFORMEDSHAPE" ) 
+      return VISU::TDEFORMEDSHAPE;
+    if ( theComment == "SCALARMAPONDEFORMEDSHAPE" ) 
+      return VISU::TSCALARMAPONDEFORMEDSHAPE;
+    if ( theComment == "GAUSSPOINTS" ) 
+      return VISU::TGAUSSPOINTS;
+    if ( theComment == "PLOT3D" ) 
+      return VISU::TPLOT3D;
+    if ( theComment == "CUTPLANES" ) 
+      return VISU::TCUTPLANES;
+    if ( theComment == "CUTLINES" ) 
+      return VISU::TCUTLINES;
+    if ( theComment == "VECTORS" ) 
+      return VISU::TVECTORS;
+    if ( theComment == "STREAMLINES" ) 
+      return VISU::TSTREAMLINES;
+    if ( theComment == "VISUGEN" ) 
+      return VISU::TVISUGEN;
+    if ( theComment == "VIEWMANAGER" ) 
+      return VISU::TVIEWMANAGER;
+    if ( theComment == "RESULT" ) 
+      return VISU::TRESULT;
+    if ( theComment == "XYPLOT" ) 
+      return VISU::TXYPLOT;
+    if ( theComment == "TABLEVIEW" ) 
+      return VISU::TTABLEVIEW;
+    if ( theComment == "VIEW3D" ) 
+      return VISU::TVIEW3D;
+    if ( theComment == "GAUSSVIEW" ) 
+      return VISU::TGAUSSVIEW;
+    if ( theComment == "ENTITY" ) 
+      return VISU::TENTITY;
+    if ( theComment == "FAMILY" ) 
+      return VISU::TFAMILY;
+    if ( theComment == "PART" ) 
+      return VISU::TPART; // MULTIPR
+    if ( theComment == "GROUP" ) 
+      return VISU::TGROUP;
+    if ( theComment == "FIELD" ) 
+      return VISU::TFIELD;
+    if ( theComment == "TIMESTAMP" ) 
+      return VISU::TTIMESTAMP;
+    if ( theComment == "ANIMATION" ) 
+      return VISU::TANIMATION;
+    if ( theComment == "ALL" ) 
+      return VISU::TALL;
+    
+    return VISU::TNONE;
+  }
+  
+
+  //---------------------------------------------------------------
+  VISU::VISUType
+  Storable
+  ::RestoringMap2Type(const TRestoringMap& theRestoringMap)
+  {
+    QString aComment = Storable::FindValue( theRestoringMap, "myComment", "" );
+    return Comment2Type(aComment.latin1());
+  }
+
+
+  //---------------------------------------------------------------
+  VISU::VISUType
+  Storable
+  ::Stream2Type(const std::string& thePersistentString)
+  {
+    QString aString(thePersistentString.c_str());
+    if(aString.isEmpty())
+      return VISU::TNONE;
+
+    VISU::Storable::TRestoringMap aRestoringMap;
+    Storable::StringToMap( aString, aRestoringMap );
+    return RestoringMap2Type( aRestoringMap );   
+  }
+
+
+  //---------------------------------------------------------------
+  VISU::VISUType
+  Storable
+  ::SObject2Type(const _PTR(SObject)& theSObject)
+  {
+    _PTR(GenericAttribute) anAttr;
+    if (theSObject->FindAttribute(anAttr, "AttributeString")) {
+      _PTR(AttributeString) aDataAttr(anAttr);
+      std::string aData = aDataAttr->Value();
+      return Stream2Type(aData);
+    }
+
+    return VISU::TNONE;
+  }
+
+
+  //---------------------------------------------------------------
   std::string 
   Storable
   ::CorrectPersistentString(const std::string& thePersistentString)
@@ -130,97 +248,68 @@ namespace VISU{
       return aString.latin1();
 
     VISU::Storable::TRestoringMap aRestoringMap;
-    Storable::StrToMap( aString, aRestoringMap );
+    Storable::StringToMap( 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::TISOSURFACES;
-       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" );
     }
 
-    if ( aComment == "PRSMERGER" )
-      aString.replace( "myComment=PRSMERGER", "myComment=SCALARMAP" );
-
     return aString.latin1();
   }
 
+
+  //---------------------------------------------------------------
+  std::string
+  Storable
+  ::FindEntry(SALOMEDS::Study_ptr theStudyDocument, 
+             const std::string& theStartEntry,
+             const TRestoringMap& theRestoringMap, 
+             int IsAllLevels)
+  {
+    SALOMEDS::SObject_var aSObject = theStudyDocument->FindObjectID(theStartEntry.c_str());
+    SALOMEDS::ChildIterator_var anIter = theStudyDocument->NewChildIterator(aSObject);
+    anIter->InitEx(IsAllLevels);
+    for(; anIter->More(); anIter->Next()) {
+      aSObject = anIter->Value();
+      SALOMEDS::GenericAttribute_var anAttr;
+      if (aSObject->FindAttribute(anAttr,"AttributeString")) {
+       SALOMEDS::AttributeString_var aDataAttr = SALOMEDS::AttributeString::_narrow(anAttr);
+       CORBA::String_var aString = aDataAttr->Value();
+       VISU::Storable::TRestoringMap aRestoringMap;
+       Storable::StringToMap( aString.in(), aRestoringMap );
+       bool anIsSame = true;
+       TRestoringMap::const_iterator anIter = theRestoringMap.begin();
+       for(; anIter != theRestoringMap.end(); anIter++){
+         const TRestoringMap::key_type& aKey = anIter->first;
+         TRestoringMap::const_iterator anIter2 = aRestoringMap.find(aKey);
+         if(anIter2 != aRestoringMap.end()){
+           if (anIter->second == anIter2->second)
+             continue;
+         }
+         anIsSame = false;
+         break;
+       }
+       if(anIsSame){
+         CORBA::String_var anEntry = aSObject->GetID();
+         return anEntry.in();
+       }
+      }
+    }
+    return "";
+  }
+
+
+  //----------------------------------------------------------------------------
   void 
   Storable
-  ::StrToMap(const QString& theStr
-            VISU::Storable::TRestoringMap& theMap)
+  ::StringToMap(const QString& theString
+               TRestoringMap& theMap)
   {
-    if(0 && MYDEBUG) MESSAGE("Storable::StrToMap : string="<<theStr);
-    QStringList strList = QStringList::split( ";", theStr, false );
+    if(0 && MYDEBUG) MESSAGE("Storable::StringToMap : string="<<theString);
+    QStringList strList = QStringList::split( ";", theString, false );
     for ( int i = 0; i < strList.count(); i++ ) {
       QString next = strList[ i ];
       int pos = next.find("=");
@@ -240,6 +329,26 @@ namespace VISU{
     }
   }
 
+
+  //----------------------------------------------------------------------------
+  Storable::TRestoringMap
+  Storable
+  ::GetStorableMap(_PTR(SObject) theSObject)
+  {
+    Storable::TRestoringMap aRestoringMap;
+    if(theSObject){
+      _PTR(GenericAttribute) anAttr;
+      if(theSObject->FindAttribute(anAttr,"AttributeString")){
+       _PTR(AttributeString) aComment (anAttr);
+       std::string aValue = aComment->Value();
+       VISU::Storable::StringToMap(aValue.c_str(), aRestoringMap);
+      }
+    }
+    return aRestoringMap;
+  }
+
+
+  //----------------------------------------------------------------------------
   void
   Storable
   ::DataToStream(std::ostringstream& theStr, 
@@ -285,7 +394,7 @@ namespace VISU{
     try{
       QString aString( CorrectPersistentString( theLocalPersistentID ) );
       TRestoringMap aRestoringMap;
-      StrToMap(aString, aRestoringMap);
+      StringToMap(aString, aRestoringMap);
       bool anIsExists;
       QString aComment = VISU::Storable::FindValue(aRestoringMap, "myComment", &anIsExists);
       if ( anIsExists ) {
@@ -401,32 +510,6 @@ namespace VISU{
 
 
   //===========================================================================
-  std::string
-  FindEntryWithComment(SALOMEDS::Study_ptr theStudyDocument, 
-                      const std::string& theStartEntry,
-                      const std::string& theComment, 
-                      int IsAllLevels)
-  {
-    SALOMEDS::ChildIterator_var anIter =
-      theStudyDocument->NewChildIterator(theStudyDocument->FindObjectID(theStartEntry.c_str()));
-    anIter->InitEx(IsAllLevels);
-    SALOMEDS::SObject_var aFieldSO;
-    for(;anIter->More();anIter->Next()) {
-      SALOMEDS::GenericAttribute_var anAttr;
-      if (anIter->Value()->FindAttribute(anAttr,"AttributeString")) {
-       SALOMEDS::AttributeString_var aCmnt = SALOMEDS::AttributeString::_narrow(anAttr);
-       CORBA::String_var aString = aCmnt->Value();
-       string aValue(aString);
-       if (aValue == theComment) {
-         aFieldSO = anIter->Value();
-         aString = aFieldSO->GetID();
-         aValue = aString;
-         return aValue;
-       }
-      }
-    }
-    return "";
-  }
   //===========================================================================
   std::string
   CreateAttributes(SALOMEDS::Study_ptr theStudyDocument,
index 7d365a3179786f39196d871c4c67ca7b256880b7..ef3ff038d50b97784ab707a801e7e5c9fdd6289a 100644 (file)
@@ -129,17 +129,40 @@ namespace VISU
     const char* 
     GetComment() const = 0;
 
-    typedef std::map<std::string,QString> TRestoringMap;
+    typedef std::map<std::string, QString> TRestoringMap;
 
     typedef Storable* (*TStorableEngine)(SALOMEDS::SObject_ptr theSObject,
                                         const std::string& thePrefix,
                                         const TRestoringMap& theMap);
     typedef std::map<std::string,TStorableEngine> TCallbackMap;
 
+    static 
+    VISU::VISUType
+    Comment2Type(const std::string& theComment);
+
+    static 
+    VISU::VISUType
+    RestoringMap2Type(const TRestoringMap& theRestoringMap);
+
+    static 
+    VISU::VISUType
+    Stream2Type(const std::string& thePersistentString);
+
+    static 
+    VISU::VISUType
+    SObject2Type(const _PTR(SObject)& theSObject);
+
     static 
     std::string
     CorrectPersistentString(const std::string& thePersistentString);
 
+    static 
+    std::string 
+    FindEntry(SALOMEDS::Study_ptr theStudyDocument, 
+             const std::string& theStartEntry,
+             const TRestoringMap& theRestoringMap, 
+             int IsAllLevels = true);
+  
     static 
     void
     Registry(const std::string& theComment, 
@@ -155,7 +178,7 @@ namespace VISU
     QString 
     FindValue(const TRestoringMap& theMap, 
              const std::string& theArg, 
-             bool* isFind = NULL);
+             bool* theIsFind = NULL);
 
     static 
     QString
@@ -165,8 +188,12 @@ namespace VISU
 
     static
     void
-    StrToMap(const QString& theStr, 
-            VISU::Storable::TRestoringMap& theMap);
+    StringToMap(const QString& theString, 
+               TRestoringMap& theMap);
+
+    static
+    TRestoringMap
+    GetStorableMap(_PTR(SObject) theSObject);
 
     static
     SALOMEDS::SObject_ptr 
@@ -242,13 +269,6 @@ namespace VISU
                   const std::string& theComment,
                   CORBA::Boolean theCreateNew = true);
 
-  VISU_I_EXPORT
-  std::string 
-  FindEntryWithComment(SALOMEDS::Study_ptr theStudyDocument, 
-                      const std::string& theStartEntry,
-                      const std::string& theComment, 
-                      int IsAllLevels = true);
-  
   VISU_I_EXPORT
   SALOMEDS::SObject_var
   GetSObject(_PTR(SObject));
index 1fa8df8a670717c5315d8d2634859973e187cca7..72a0c0edaba90858a415ac613d77d327818a1c67 100644 (file)
@@ -1280,15 +1280,14 @@ VISU::ColoredPrs3d_i
     }
     if(myPublishInStudyMode == EPublishUnderTimeStamp){
       SetName(GenerateName().latin1(), false);
-      aComment.sprintf("myComment=TIMESTAMP;myType=%d;myMeshName=%s;myEntityId=%d;myFieldName=%s;myTimeStampId=%d;myNumComponent=%d",
-                      VISU::TTIMESTAMP,
-                      GetCMeshName().c_str(),
-                      GetEntity(),
-                      GetCFieldName().c_str(),
-                      GetTimeStampNumber(),
-                      GetField()->myNbComp);
-      std::string aResultEntry = GetCResult()->GetEntry();
-      std::string anEntry = GetCResult()->GetEntry(aComment.latin1());
+      VISU::Storable::TRestoringMap aRestoringMap;
+      aRestoringMap["myComment"] = "TIMESTAMP";
+      aRestoringMap["myMeshName"] = GetCMeshName();
+      aRestoringMap["myEntityId"] = QString::number(GetEntity());
+      aRestoringMap["myFieldName"] = GetCFieldName();
+      aRestoringMap["myTimeStampId"] = QString::number(GetTimeStampNumber());
+      aRestoringMap["myNumComponent"] = QString::number(GetField()->myNbComp);
+      std::string anEntry = GetCResult()->GetEntry(aRestoringMap);
       if(anEntry == "") 
        throw std::runtime_error("There is no Entry for binding the presentation !!!");
       aComment.sprintf("myComment=%s;myMeshName=%s;myEntityId=%d;myFieldName=%s;myTimeStampId=%d;myNumComponent=%d",
index 4ab275e6ea8286ee6ff24e8223cd0d2202c8edb3..688ec9945e6e2fe08ecb5990f657e21fc7de8fb6 100644 (file)
@@ -313,7 +313,7 @@ namespace VISU
        SALOMEDS::AttributeString::_narrow(anAttr);
       CORBA::String_var aValue = aComment->Value();
       Storable::TRestoringMap aMap;
-      Storable::StrToMap(aValue.in(),aMap);
+      Storable::StringToMap(aValue.in(),aMap);
       bool anIsExist;
       QString aMethodName = VISU::Storable::FindValue(aMap,"myComment",&anIsExist);
       if(anIsExist){
@@ -1034,7 +1034,7 @@ namespace VISU
              AttributeString_var aComment = AttributeString::_narrow(anAttr);
              CORBA::String_var aValue = aComment->Value();
              Storable::TRestoringMap aMap;
-             Storable::StrToMap(aValue.in(),aMap);
+             Storable::StringToMap(aValue.in(),aMap);
              bool anIsExist;
              QString aSourceId = VISU::Storable::FindValue(aMap,"mySourceId",&anIsExist);
              if(anIsExist){
@@ -1151,7 +1151,7 @@ namespace VISU
          SALOMEDS::AttributeString::_narrow(anAttr);
        CORBA::String_var aValue = aComment->Value();
        Storable::TRestoringMap aMap;
-       Storable::StrToMap(aValue.in(),aMap);
+       Storable::StringToMap(aValue.in(),aMap);
        bool anIsExist;
        QString aTypeName = VISU::Storable::FindValue(aMap,"myComment",&anIsExist);
        if (anIsExist) {
@@ -1355,7 +1355,7 @@ namespace VISU
       if(value.isEmpty()) continue;
 
       VISU::Storable::TRestoringMap aMap;
-      VISU::Storable::StrToMap(value, aMap);
+      VISU::Storable::StringToMap(value, aMap);
       bool isExist;
       
       QString aTypeName = VISU::Storable::FindValue(aMap,"myComment",&isExist);
index 8b152b688a8ae8733de2b2f3158ba8cfa9dbce87..72e23abab7498c93febd49c8fb7a370864f42a40 100644 (file)
@@ -746,11 +746,12 @@ namespace VISU
                      const std::string& theSubMeshName, // Family or Group name
                      const std::string& theNewName)
   {
-    if (myStudyDocument->GetProperties()->IsLocked()) return;
-    Mutex mt(myMutex);
+    if (myStudyDocument->GetProperties()->IsLocked()) 
+      return;
 
-    Result_i* pResult = dynamic_cast<Result_i*>(GetServant(theResult).in());
-    if (!pResult) return;
+    Result_i* aResult = dynamic_cast<Result_i*>(GetServant(theResult).in());
+    if (!aResult) 
+      return;
 
     QString aComment;
     VISU::VISUType aType;
@@ -762,24 +763,28 @@ namespace VISU
     else
       aType = VISU::TGROUP;
 
+    VISU::Storable::TRestoringMap aRestoringMap;
+    aRestoringMap["myMeshName"] = theMeshName;
+
     switch (aType) {
     case VISU::TENTITY:
-      aComment.sprintf("myComment=ENTITY;myType=%d;myMeshName=%s;myId=%d",
-                      VISU::TENTITY, theMeshName.c_str(), theEntity);
+      aRestoringMap["myComment"] = "ENTITY";
+      aRestoringMap["myId"] = QString::number(theEntity);
       break;
     case VISU::TFAMILY:
-      aComment.sprintf("myComment=FAMILY;myType=%d;myMeshName=%s;myEntityId=%d;myName=%s",
-                      VISU::TFAMILY, theMeshName.c_str(), theEntity, theSubMeshName.c_str());
+      aRestoringMap["myComment"] = "FAMILY";
+      aRestoringMap["myEntityId"] = QString::number(theEntity);
+      aRestoringMap["myName"] = theSubMeshName;
       break;
     case VISU::TGROUP:
-      aComment.sprintf("myComment=GROUP;myType=%d;myMeshName=%s;myName=%s",
-                      VISU::TGROUP, theMeshName.c_str(), theSubMeshName.c_str());
+      aRestoringMap["myComment"] = "GROUP";
+      aRestoringMap["myName"] = theSubMeshName;
       break;
     }
 
-    string aResultEntry = pResult->GetEntry();
-    string anEntry = pResult->GetEntry(aComment.latin1());
-    if (anEntry == "") return;
+    string anEntry = aResult->GetEntry(aRestoringMap);
+    if (anEntry == "") 
+      return;
 
     SALOMEDS::SObject_ptr aSObject = myStudyDocument->FindObjectID(anEntry.c_str());
 
index 9da28057e61dd1ce3c743d1709eea11bc743ce76..58f0a6ded26e172a5c83253df7508f0550cb0961 100755 (executable)
@@ -44,4 +44,4 @@
 
 
 
-#endif
\ No newline at end of file
+#endif
index 0c27e8c61128ee386658688073d551eb81a9e9eb..46f3b1511271fa3afd43a18915c3c73f937672f0 100644 (file)
@@ -168,7 +168,6 @@ VISU::Mesh_i
 }
 
 
-//----------------------------------------------------------------------------
 //----------------------------------------------------------------------------
 VISU::Mesh_i
 ::~Mesh_i()
@@ -208,43 +207,34 @@ VISU::Mesh_i
     if(MYDEBUG) MESSAGE("Mesh_i::Build - myType = "<<myType);
     QString aComment,aTmp;
 
+    std::string aMeshName = GetCMeshName();
+    VISU::TEntity anEntity = VISU::TEntity(myEntity);
+
+    VISU::Storable::TRestoringMap aRestoringMap;
+    aRestoringMap["myMeshName"] = GetCMeshName();
+
     VISU::PUnstructuredGridIDMapper anIDMapper;
     VISU::Result_i::TInput* anInput = GetCResult()->GetInput();
     switch(myType){
     case VISU::TENTITY :
-      anIDMapper = anInput->GetMeshOnEntity(GetCMeshName(),
-                                           (VISU::TEntity)myEntity);//jfa IPAL9284
-      aComment = "";
-      aComment.append(aTmp.sprintf("myComment=ENTITY;myType=%d;",VISU::TENTITY));
-      aComment.append("myMeshName=");
-      aComment.append(GetCMeshName().c_str());
-      aComment.append(";");
-      aComment.append(aTmp.sprintf("myId=%d",myEntity));
+      anIDMapper = anInput->GetMeshOnEntity(aMeshName,
+                                           anEntity);//jfa IPAL9284
+      aRestoringMap["myComment"] = "ENTITY";
+      aRestoringMap["myId"] = QString::number(anEntity);
       break;
     case VISU::TFAMILY :
-      anIDMapper = anInput->GetFamilyOnEntity(GetCMeshName(),
-                                             (VISU::TEntity)myEntity,
+      anIDMapper = anInput->GetFamilyOnEntity(aMeshName,
+                                             anEntity,
                                              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);
+      aRestoringMap["myComment"] = "FAMILY";
+      aRestoringMap["myEntityId"] = QString::number(anEntity);
+      aRestoringMap["myName"] = 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);
-      
+      aRestoringMap["myComment"] = "GROUP";
+      aRestoringMap["myName"] = mySubMeshName;
       break;
     }
     if(!anIDMapper) 
@@ -252,7 +242,7 @@ VISU::Mesh_i
 
     myMeshPL->SetUnstructuredGridIDMapper(anIDMapper);
 
-    string anEntry = GetCResult()->GetEntry(aComment.latin1());
+    string anEntry = GetCResult()->GetEntry(aRestoringMap);
     if(anEntry == "") 
       throw std::runtime_error("Mesh_i::Build - anEntry was not found !!!");
     SALOMEDS::SObject_var aSObject = GetStudyDocument()->FindObjectID(anEntry.c_str());
index 97f15e1442a94ee4d15d1a01bee49c8412adf59f..162842b96d4f44189266d565a6d1776215fc5f46 100644 (file)
@@ -437,10 +437,9 @@ namespace VISU
       const TMeshOnEntityMap& aMeshOnEntityMap = aMesh->myMeshOnEntityMap;
       if(aMeshOnEntityMap.empty()) 
        continue;
-      aComment = "";
-      aComment.append("myComment=MESH;");
-      aComment.append("myName=");aComment.append(aMeshName);aComment.append(";");
-      aComment.append(aTmp.sprintf("myDim=%d",aMesh->myDim));
+      aComment.sprintf("myComment=MESH;myName=%s;myDim=%d",
+                      aMeshName.c_str(),
+                      aMesh->myDim);
       aMesh->myEntry = 
        CreateAttributes(theStudy,
                         theResultEntry,
@@ -449,9 +448,8 @@ namespace VISU
                         aComment.latin1(),
                         true);
     
-      aComment = "";
-      aComment.append("myComment=FAMILIES;");
-      aComment.append("myMeshName=");aComment.append(aMeshName);
+      aComment.sprintf("myComment=FAMILIES;myMeshName=%s",
+                      aMeshName.c_str());
       string aSubMeshesEntry = 
        CreateAttributes(theStudy,
                         aMesh->myEntry,
@@ -515,11 +513,9 @@ namespace VISU
        continue;
        }
        
-       aComment = "";
-       aComment.append(aTmp.sprintf("myComment=ENTITY;myType=%d;",VISU::TENTITY));
-       aComment.append("myMeshName=");aComment.append(aMeshName);aComment.append(";");
-       aComment.append(aTmp.sprintf("myId=%d",anEntity));
-       
+       aComment.sprintf("myComment=ENTITY;myMeshName=%s;myId=%d",
+                        aMeshName.c_str(),
+                        anEntity);
        
        aMeshOnEntity->myEntry = 
          CreateAttributes(theStudy, 
@@ -576,11 +572,10 @@ namespace VISU
        for(; aFamilyMapIter != aFamilyMap.end(); aFamilyMapIter++){
          const string& aFamilyName = aFamilyMapIter->first;
          const PFamily& aFamily = aFamilyMapIter->second;
-         aComment = "";
-         aComment.append(aTmp.sprintf("myComment=FAMILY;myType=%d;",TFAMILY));
-         aComment.append("myMeshName=");aComment.append(aMeshName);aComment.append(";");
-         aComment.append(aTmp.sprintf("myEntityId=%d;",anEntity));
-         aComment.append("myName=");aComment.append(aFamilyName);
+         aComment.sprintf("myComment=FAMILY;myMeshName=%s;myEntityId=%d;myName=%s",
+                          aMeshName.c_str(),
+                          anEntity,
+                          aFamilyName.c_str());
          
          aFamily->myEntry =
            CreateAttributes(theStudy,
@@ -594,10 +589,9 @@ namespace VISU
       //Importing groups
       const TGroupMap& aGroupMap = aMesh->myGroupMap;
       if(!aGroupMap.empty()){
-       aComment = "";
-       aComment.append("myComment=GROUPS;");
-       aComment.append("myMeshName=");aComment.append(aMeshName);
-
+       aComment.sprintf("myComment=GROUPS;myMeshName=%s",
+                        aMeshName.c_str());
+       
        UpdateAttributes(theStudy,
                         aMesh->myGroupsEntry,
                         "",
@@ -608,11 +602,9 @@ namespace VISU
        for(; aGroupMapIter != aGroupMap.end(); aGroupMapIter++){
          const string& aGroupName = aGroupMapIter->first;
          const PGroup& aGroup = aGroupMapIter->second;
-         aComment = "";
-         aComment.sprintf("myComment=GROUP;myType=%d;",
-                          TGROUP);
-         aComment.append("myMeshName=");aComment.append(aMeshName);aComment.append(";");
-         aComment.append("myName=");aComment.append(aGroupName);
+         aComment.sprintf("myComment=GROUP;myMeshName=%s;myName=%s",
+                          aMeshName.c_str(),
+                          aGroupName.c_str());
          aGroup->myEntry = 
            CreateAttributes(theStudy,
                             aMesh->myGroupsEntry,
@@ -705,14 +697,13 @@ namespace VISU
          const PField& aField = aFieldMapIter->second;
          const TValField& aValField = aField->myValField;
          QString aFieldNameWithUnit = GenerateFieldName(aFieldName,aField->myUnitNames[0]);
-         aComment = "";
-         aComment.sprintf("myComment=FIELD;myType=%d;",TFIELD);
-         aComment.append("myMeshName=");aComment.append(aMeshName);aComment.append(";");
-         aComment.append(aTmp.sprintf("myEntityId=%d;",anEntity));
-         aComment.append("myName=");aComment.append(aFieldName);aComment.append(";");
-         aComment.append(aTmp.sprintf("myNbTimeStamps=%d;",aValField.size()));
-         aComment.append(aTmp.sprintf("myNumComponent=%d",aField->myNbComp));
-
+         aComment.sprintf("myComment=FIELD;myMeshName=%s;myEntityId=%d;myName=%s;myNbTimeStamps=%d;myNumComponent=%d",
+                          aMeshName.c_str(),
+                          anEntity,
+                          aFieldName.c_str(),
+                          aValField.size(),
+                          aField->myNbComp);
+         
          aField->myEntry = CreateAttributes(
                                             theStudy,
                                             aMesh->myFieldsEntry,
@@ -732,12 +723,12 @@ namespace VISU
          {
            int aTimeStamp = aValFieldIter->first;
            const PValForTime& aValForTime = aValFieldIter->second;
-           aComment = "";
-           aComment.sprintf("myComment=TIMESTAMP;myType=%d;",TTIMESTAMP);
-           aComment.append("myMeshName=");aComment.append(aMeshName);aComment.append(";");
-           aComment.append(aTmp.sprintf("myEntityId=%d;",anEntity));
-           aComment.append("myFieldName=");aComment.append(aFieldName);aComment.append(";");
-           aComment.append(aTmp.sprintf("myTimeStampId=%d;myNumComponent=%d",aTimeStamp,aField->myNbComp));
+           aComment.sprintf("myComment=TIMESTAMP;myMeshName=%s;myEntityId=%d;myFieldName=%s;myTimeStampId=%d;myNumComponent=%d",
+                            aMeshName.c_str(),
+                            anEntity,
+                            aFieldName.c_str(),
+                            aTimeStamp,
+                            aField->myNbComp);
 
            string aTimeStampId = VISU_Convertor::GenerateName(aValForTime->myTime);
 
@@ -1309,9 +1300,8 @@ VISU::Result_i
   CORBA::String_var aSComponentEntry = mySComponent->GetID();
   CORBA::String_var anIOR(GetID());
   QString aComment;
-  aComment.sprintf("myComment=%s;myType=%d;myFileName=%s;myInitFileName=%s",
+  aComment.sprintf("myComment=%s;myFileName=%s;myInitFileName=%s",
                   GetComment(),
-                  VISU::TRESULT,
                   myFileInfo.filePath().latin1(),
                   myInitFileName.c_str()); // Restoring of Python dump
   string aResultEntry =
@@ -1613,7 +1603,7 @@ VISU::Result_i
     mySComponent = mySObject->GetFatherComponent();
     myName = VISU::Storable::FindValue(theMap, "myName").latin1();
     myInitFileName = VISU::Storable::FindValue(theMap, "myInitFileName").latin1();
-
+    
     SALOMEDS::SObject_var aRefSObj, aTargetRefSObj;
     if (mySObject->FindSubObject(1, aRefSObj) &&
        aRefSObj->ReferencedObject(aTargetRefSObj)) 
@@ -1735,8 +1725,9 @@ VISU::Result_i
       }
 
       QString aComment;
-      aComment.sprintf("myComment=%s;myType=%d;myFileName=%s;myInitFileName=%s",
-                      GetComment(), VISU::TRESULT, myFileInfo.filePath().latin1(),
+      aComment.sprintf("myComment=%s;myFileName=%s;myInitFileName=%s",
+                      GetComment(), 
+                      myFileInfo.filePath().latin1(),
                       myInitFileName.c_str()); // Restoring of Python dump
       SALOMEDS::GenericAttribute_var anAttr;
       if (!theSObject->FindAttribute(anAttr, "AttributeString"))
@@ -1847,7 +1838,7 @@ VISU::Result_i
 {
   SALOMEDS::Study_var aStudy = theSObject->GetStudy();
 
-  ECreationId aCreationId = ECreationId(Storable::FindValue(theMap,"myCreationId").toInt());
+  ECreationId aCreationId = ECreationId(Storable::FindValue(theMap, "myCreationId").toInt());
   ESourceId aSourceId = eRestoredFile;
   if(aCreationId == eImportMed || aCreationId == eImportMedField)
     aSourceId = eRestoredComponent;
@@ -1908,9 +1899,11 @@ VISU::Result_i
 
 std::string 
 VISU::Result_i
-::GetEntry(const std::string& theComment)
+::GetEntry(const Storable::TRestoringMap& theRestoringMap)
 {
-  return FindEntryWithComment(myStudyDocument,GetEntry().c_str(),theComment.c_str());
+  return Storable::FindEntry(myStudyDocument,
+                            GetEntry(),
+                            theRestoringMap);
 }
 
 #include <stdio.h>
index 20e0b2c75febe06d20fbe0c292920e382f514ae3..ee66e69768befcc40990a5f69bf8c72ac55e9158 100644 (file)
@@ -204,7 +204,7 @@ namespace VISU
     const SALOMEDS::SObject_var& GetSObject() const;
     const SALOMEDS::Study_var& GetStudyDocument() const;
     const SALOMEDS::SComponent_var& GetSComponent() const;
-    std::string GetEntry(const std::string& theComment);
+    std::string GetEntry(const Storable::TRestoringMap& theRestoringMap);
 
     // Info on structured mesh contained in TInput
   public:
index adce191ecac95788f3db164f02a54041b5b5a1a1..5e037ba1dab12deae800fa74c80dda60325954b0 100644 (file)
@@ -226,21 +226,21 @@ VISU::Storable* VISU::Table_i::Build( int theRestoring )
        // create SObject and set attributes
        QString aComment;
        if(pCutLines)
-         aComment.sprintf("myComment=%s;myType=%d;mySourceId=CutLines",GetComment(),VISU::TTABLE);
+         aComment.sprintf("myComment=%s;mySourceId=CutLines",GetComment());
        else{
-         aComment.sprintf("myComment=%s;myType=%d;mySourceId=TableAttr",GetComment(),VISU::TTABLE);
+         aComment.sprintf("myComment=%s;mySourceId=TableAttr",GetComment());
          SALOMEDS::SObject_var aFatherSObject = SO->GetFather();
          if(aFatherSObject->FindAttribute(anAttr,"AttributeString")){
            SALOMEDS::AttributeString_var aCommentAttr =
              SALOMEDS::AttributeString::_narrow(anAttr);
            CORBA::String_var aValue = aCommentAttr->Value();
            Storable::TRestoringMap aMap;
-           Storable::StrToMap(aValue.in(),aMap);
+           Storable::StringToMap(aValue.in(),aMap);
            bool anIsExist;
            QString aMethodName = VISU::Storable::FindValue(aMap,"myComment",&anIsExist);
            if(anIsExist){
              if(strcmp(aMethodName.latin1(),"ImportTables") == 0){
-               aComment.sprintf("myComment=%s;myType=%d;mySourceId=TableFile",GetComment(),VISU::TTABLE);
+               aComment.sprintf("myComment=%s;mySourceId=TableFile",GetComment());
              }
            }
          }
@@ -503,7 +503,7 @@ VISU::Storable* VISU::Curve_i::Build(int theRestoring )
        SALOMEDS::SComponent_var SComponent = VISU::FindOrCreateVisuComponent( GetStudyDocument() );
        // create SObject and set attributes
        QString aComment;
-       aComment.sprintf("myComment=%s;myType=%d",GetComment(),VISU::TCURVE);
+       aComment.sprintf("myComment=%s",GetComment());
        string anEntry = CreateAttributes( GetStudyDocument(),
                                          myTable->GetObjectEntry(),
                                          "",
@@ -1017,7 +1017,7 @@ VISU::Storable* VISU::Container_i::Build( int theRestoring )
     SALOMEDS::SComponent_var SComponent = VISU::FindOrCreateVisuComponent( GetStudyDocument() );
     // create SObject and set attributes
     QString aComment;
-    aComment.sprintf("myComment=%s;myType=%d",GetComment(),VISU::TCONTAINER);
+    aComment.sprintf("myComment=%s",GetComment());
     string anEntry = CreateAttributes( GetStudyDocument(),
                                       SComponent->GetID(),
                                       "",
index b745ca80cc131bea1bd7290722e3d1139031e216..11ff50f3ecbe1a8a9e1ac172bb2e66bc56217f33 100644 (file)
@@ -199,8 +199,8 @@ bool VISU_TimeAnimation::addField (_PTR(SObject) theField)
   aNewData.myNbFrames = 0;
   aNewData.myPrsType = VISU::TSCALARMAP;
   aNewData.myOffset[0] = aNewData.myOffset[1] = aNewData.myOffset[2] = 0;
-  VISU::Storable::TRestoringMap aMap = getMapOfValue(aNewData.myField);
-  if(VISU::Storable::FindValue(aMap,"myComment") != QString("FIELD"))
+  VISU::Storable::TRestoringMap aMap = VISU::Storable::GetStorableMap(aNewData.myField);
+  if(VISU::Storable::FindValue(aMap,"myComment") != "FIELD")
     return false;
 
   aNewData.myNbTimes = VISU::Storable::FindValue(aMap,"myNbTimeStamps").toLong();
@@ -219,7 +219,7 @@ bool VISU_TimeAnimation::addField (_PTR(SObject) theField)
 
     long aNumCompCurr = VISU::Storable::FindValue(aMap, "myNumComponent").toLong();
     if ( !myFieldsLst.isEmpty() ) {
-      VISU::Storable::TRestoringMap aFMap = getMapOfValue(myFieldsLst.first().myField);
+      VISU::Storable::TRestoringMap aFMap = VISU::Storable::GetStorableMap(myFieldsLst.first().myField);
       long aNumComp = VISU::Storable::FindValue(aFMap, "myNumComponent").toLong();
       if ( aNumCompCurr != aNumComp )
        return false;
@@ -327,7 +327,7 @@ namespace
          break;
       }
 
-      VISU::Storable::TRestoringMap aTimeMap = VISU_TimeAnimation::getMapOfValue(aTimeStamp);
+      VISU::Storable::TRestoringMap aTimeMap = VISU::Storable::GetStorableMap(aTimeStamp);
       QString aMeshName = VISU::Storable::FindValue(aTimeMap,"myMeshName");
       VISU::Entity anEntity = (VISU::Entity) VISU::Storable::FindValue(aTimeMap,"myEntityId").toInt();
       QString aFieldName = VISU::Storable::FindValue(aTimeMap,"myFieldName");
@@ -439,7 +439,7 @@ void VISU_TimeAnimation::generatePresentations(CORBA::Long theFieldNum) {
   clearData(aData);
 
   VISU::Result_i* aResult = createPresent(aData.myField);
-  VISU::Storable::TRestoringMap aMap = getMapOfValue(aData.myField);
+  VISU::Storable::TRestoringMap aMap = VISU::Storable::GetStorableMap(aData.myField);
   aData.myNbFrames = aData.myNbTimes;
   //VISU::Storable::FindValue(aMap,"myNbTimeStamps").toLong();
 
@@ -1400,22 +1400,6 @@ VISU::Result_i* VISU_TimeAnimation::createPresent (_PTR(SObject) theField)
   return dynamic_cast<VISU::Result_i*>(VISU::GetServant(anObject).in());
 }
 
-//------------------------------------------------------------------------
-VISU::Storable::TRestoringMap VISU_TimeAnimation::getMapOfValue (_PTR(SObject) theSObject)
-{
-  VISU::Storable::TRestoringMap aMap;
-  if (theSObject) {
-    _PTR(GenericAttribute) anAttr;
-    if (theSObject->FindAttribute(anAttr, "AttributeString")) {
-      _PTR(AttributeString) aComment (anAttr);
-      std::string aString = aComment->Value();
-      QString strIn (aString.c_str());
-      VISU::Storable::StrToMap(strIn, aMap);
-    }
-  }
-  return aMap;
-}
-
 //------------------------------------------------------------------------
 double VISU_TimeAnimation::getTimeValue (_PTR(SObject) theTimeStamp)
 {
@@ -1526,8 +1510,10 @@ SALOMEDS::SObject_ptr VISU_TimeAnimation::publishInStudy()
   std::string aSComponentEntry = aSComponent->GetID();
 
   QString aComment;
-  aComment.sprintf("myComment=ANIMATION;myType=%d;myTimeMinVal=%g;myTimeMaxVal=%g;myMode=%d",
-                   VISU::TANIMATION,myTimeMinVal,myTimeMaxVal,myAnimationMode);
+  aComment.sprintf("myComment=ANIMATION;myTimeMinVal=%g;myTimeMaxVal=%g;myMode=%d",
+                   myTimeMinVal,
+                  myTimeMaxVal,
+                  myAnimationMode);
 
   string anEntry = VISU::CreateAttributes(myStudy,aSComponentEntry.c_str(),"","",
                                           GenerateName(),"",aComment,true);
@@ -1573,8 +1559,10 @@ void VISU_TimeAnimation::saveAnimation()
   std::string aSComponentEntry = aSComponent->GetID();
 
   QString aComment;
-  aComment.sprintf("myComment=ANIMATION;myType=%d;myTimeMinVal=%g;myTimeMaxVal=%g;myMode=%d",
-                   VISU::TANIMATION,myTimeMinVal,myTimeMaxVal,myAnimationMode);
+  aComment.sprintf("myComment=ANIMATION;myTimeMinVal=%g;myTimeMaxVal=%g;myMode=%d",
+                   myTimeMinVal,
+                  myTimeMaxVal,
+                  myAnimationMode);
 
   _PTR(GenericAttribute) anAttr;
   anAttr = aStudyBuilder->FindOrCreateAttribute(aAnimSObject, "AttributeString");
@@ -1631,16 +1619,11 @@ void VISU_TimeAnimation::restoreFromStudy(_PTR(SObject) theField)
 {
   _PTR(SObject) aAnimSObject = theField;
 
-  VISU::Storable::TRestoringMap aMap;
-  _PTR(GenericAttribute) anAttr;
-  if (!aAnimSObject->FindAttribute(anAttr, "AttributeString")) return;
+  VISU::Storable::TRestoringMap aMap = VISU::Storable::GetStorableMap(aAnimSObject);
+  if (aMap.empty()) 
+    return;
 
-  _PTR(AttributeString) aComment (anAttr);
-  string aComm = aComment->Value();
-  QString strIn (aComm.c_str());
-  VISU::Storable::StrToMap(strIn,aMap);
   bool isExist;
-
   myTimeMinVal = VISU::Storable::FindValue(aMap,"myTimeMinVal",&isExist).toDouble();
   myTimeMaxVal = VISU::Storable::FindValue(aMap,"myTimeMaxVal",&isExist).toDouble();
   myAnimationMode = VISU::Storable::FindValue(aMap,"myMode",&isExist).toInt();
@@ -1661,8 +1644,10 @@ void VISU_TimeAnimation::restoreFromStudy(_PTR(SObject) theField)
     // Get Presentation object
     _PTR(ChildIterator) anPrsIter = myStudy->NewChildIterator(aRefObj);
     anPrsIter->Init();
-    if (!anPrsIter->More()) continue;
+    if (!anPrsIter->More()) 
+      continue;
     _PTR(SObject) aPrsObj = anPrsIter->Value();
+    _PTR(GenericAttribute) anAttr;
     if (!aPrsObj->FindAttribute(anAttr, "AttributeName")) 
       continue;
     _PTR(AttributeName) aName (anAttr);
@@ -1693,17 +1678,10 @@ void VISU_TimeAnimation::restoreFromStudy(_PTR(SObject) theField)
       continue;
     generatePresentations(getNbFields()-1);
 
-    if (!aPrsObj->FindAttribute(anAttr, "AttributeString"))
+    VISU::Storable::TRestoringMap aPrsMap = VISU::Storable::GetStorableMap(aPrsObj);
+    if (aPrsMap.empty())
       continue;
-    _PTR(AttributeString) aPrsComment (anAttr);
-    string aPrsComm = aPrsComment->Value();
-    if (aPrsComm.length() > 0) {
-      QString strPrsIn (aPrsComm.c_str());
-      VISU::Storable::TRestoringMap aPrsMap;
-      VISU::Storable::StrToMap(strPrsIn,aPrsMap);
-
-      aData.myPrs[0]->Restore(VISU::GetSObject(aData.myField), aPrsMap);
-    }
+    aData.myPrs[0]->Restore(VISU::GetSObject(aData.myField), aPrsMap);
     aData.myPrs[0]->GetOffset(aData.myOffset);
     for (int i = 1; i < aData.myNbFrames; i++) {
       bool anIsFixedRange = false;
index 1cee7a313eb3081588ce6d4d40f6377c74154716..3ee70f4cc82b35f6a9d85724349a11905a17affe 100644 (file)
@@ -84,7 +84,6 @@ class VISU_I_EXPORT VISU_TimeAnimation: public QObject, public QThread
   //static double getTimeValue (SALOMEDS::SObject_var theTimestamp);
 
   static VISU::Result_i* createPresent (_PTR(SObject) theField);
-  static VISU::Storable::TRestoringMap getMapOfValue (_PTR(SObject) theSObject);
   static double getTimeValue (_PTR(SObject) theTimestamp);
 
   VISU_TimeAnimation(_PTR(Study) theStudy,
index add80327a48b0c929f5e332ff6be4e2970a93e78..c950f0dabeb6b717408c6e487101c238afc60642 100644 (file)
@@ -1687,17 +1687,10 @@ namespace VISU {
       _PTR(SObject) anObj = aList[i];
       string anEntry = anObj->GetID();
       if (MYDEBUG) MESSAGE("View3D_i::RestoreViewPoint - anEntry = " << anEntry);
-      if (anObj->FindAttribute(anAttr, "AttributeString")) {
-       _PTR(AttributeString) aCmnt (anAttr);
-       QString strIn(aCmnt->Value().c_str());
-       Storable::TRestoringMap aMap;
-       Storable::StrToMap(strIn, aMap);
-       if (Storable::FindValue(aMap, "myComment").compare
-           (View3D_i::myComment.c_str()) >= 0) {
-         if (MYDEBUG) MESSAGE("View3D_i::RestoreViewPoint - aComm = " << strIn);
-         Restore(theViewManager->getActiveView(), aMap);
-         return true;
-       }
+      Storable::TRestoringMap aMap = Storable::GetStorableMap(anObj);
+      if (Storable::FindValue(aMap, "myComment") == View3D_i::myComment) {
+       Restore(theViewManager->getActiveView(), aMap);
+       return true;
       }
     }
     return false;
@@ -1780,8 +1773,6 @@ namespace VISU {
 
   void View3D_i::ToStream (SUIT_ViewWindow* theViewWindow, std::ostringstream& theStr)
   {
-    Storable::DataToStream(theStr,"myType",VISU::TVIEW3D);
-
     vtkFloatingPointType backint[3];
     GetRenderer(theViewWindow)->GetBackground(backint);
     Storable::DataToStream(theStr,"myColor.R",backint[0]);