Salome HOME
Merge with version on tag OCC-V2_1_0d
[modules/visu.git] / src / VISU_I / VISU_Result_i.cc
index 3fcdc2b1432ab76a7253956a0146c7996e63c961..dc8b0903070e0742a47b00644e6307152b5924bf 100644 (file)
@@ -150,10 +150,10 @@ int VISU::Result_i::IsPossible(){
     bool aResult = VISU_PipeLine::CheckAvailableMemory(aSize);
     MESSAGE("Result_i::IsPossible - CheckAvailableMemory = "<<float(aSize)<<"; aResult = "<<float(aResult));
     return aResult;
-  }catch(std::runtime_error& exc){
-    INFOS("Follow exception was accured :\n"<<exc.what());
+  }catch(std::exception& exc){
+    INFOS("Follow exception was occured :\n"<<exc.what());
   }catch(...){
-    INFOS("Unknown exception was accured!");
+    INFOS("Unknown exception was occured!");
   }
   return 0;
 }
@@ -187,10 +187,10 @@ CORBA::Boolean VISU::Result_i::BuildAll(){
            int aTimeStamp = aValFieldIter->first;
            try{
              myInput->GetTimeStampOnMesh(aMeshName,anEntity,aFieldName,aTimeStamp);
-           }catch(std::runtime_error& exc){
-             INFOS("Follow exception was accured :\n"<<exc.what());
+           }catch(std::exception& exc){
+             INFOS("Follow exception was occured :\n"<<exc.what());
            }catch(...){
-             INFOS("Unknown exception was accured!!!");
+             INFOS("Unknown exception was occured!!!");
            }
          }
        }
@@ -201,10 +201,10 @@ CORBA::Boolean VISU::Result_i::BuildAll(){
          const string& aGroupName = aGroupMapIter->first;
          try{
            myInput->GetMeshOnGroup(aMeshName,aGroupName);
-         }catch(std::runtime_error& exc){
-           INFOS("Follow exception was accured :\n"<<exc.what());
+         }catch(std::exception& exc){
+           INFOS("Follow exception was occured :\n"<<exc.what());
          }catch(...){
-           INFOS("Unknown exception was accured!!!");
+           INFOS("Unknown exception was occured!!!");
          }
        }
        //Import families
@@ -214,27 +214,27 @@ CORBA::Boolean VISU::Result_i::BuildAll(){
          const string& aFamilyName = aFamilyMapIter->first;
          try{
            myInput->GetMeshOnEntity(aMeshName,anEntity,aFamilyName);
-         }catch(std::runtime_error& exc){
-           INFOS("Follow exception was accured :\n"<<exc.what());
+         }catch(std::exception& exc){
+           INFOS("Follow exception was occured :\n"<<exc.what());
          }catch(...){
-           INFOS("Unknown exception was accured!!!");
+           INFOS("Unknown exception was occured!!!");
          }
        }
        //Import mesh on entity
        try{
          myInput->GetMeshOnEntity(aMeshName,anEntity);
-       }catch(std::runtime_error& exc){
-         INFOS("Follow exception was accured :\n"<<exc.what());
+       }catch(std::exception& exc){
+         INFOS("Follow exception was occured :\n"<<exc.what());
        }catch(...){
-         INFOS("Unknown exception was accured!!!");
+         INFOS("Unknown exception was occured!!!");
        }
       }
     }
     myIsDone = 1;
-  }catch(std::runtime_error& exc){
-    INFOS("Follow exception was accured :\n"<<exc.what());
+  }catch(std::exception& exc){
+    INFOS("Follow exception was occured :\n"<<exc.what());
   }catch(...){
-    INFOS("Unknown exception was accured!!!");
+    INFOS("Unknown exception was occured!!!");
   }
   return myIsDone;
 }
@@ -376,11 +376,11 @@ VISU::Storable* VISU::Result_i::Build(SALOMEDS::SObject_ptr theSObject)
     QString aIsBuild = QAD_CONFIG->getSetting("Visu:BuildResult");
     bool isBuildAll = aIsBuild.isEmpty()? 0 : aIsBuild.toInt();
     if(isBuildAll) BuildAll();
-  }catch(std::runtime_error& exc){
-    INFOS("Follow exception was accured :\n"<<exc.what());
+  }catch(std::exception& exc){
+    INFOS("Follow exception was occured :\n"<<exc.what());
     return NULL;
   }catch(...){
-    INFOS("Unknown exception was accured!!!");
+    INFOS("Unknown exception was occured!!!");
     return NULL;
   }
   aStudyBuilder->CommitCommand();
@@ -393,7 +393,7 @@ VISU::Storable* VISU::Result_i::Create(const char* theFileName){
     myInitFileName = myFileInfo.filePath().latin1();
     myName = ::GenerateName(myFileInfo.fileName()).latin1();
     if(GetSourceId() == eRestoredFile){
-      auto_ptr<char> aTmpDir(SALOMEDS_Tool::GetTmpDir());
+      auto_ptr<char> aTmpDir((char*)SALOMEDS_Tool::GetTmpDir().c_str());
       static QString aCommand;
       aCommand.sprintf("cp %s %s",myFileInfo.absFilePath().latin1(),aTmpDir.get());
       if(system(aCommand) == -1){
@@ -405,12 +405,11 @@ VISU::Storable* VISU::Result_i::Create(const char* theFileName){
     }
     myInput = CreateConvertor(myFileInfo.absFilePath().latin1());
     if(!myInput) 
-      throw std::runtime_error("Create - Cannot create a Convertor for this file!!!");
-    return Build();
-  }catch(std::runtime_error& exc){
-    INFOS("Follow exception was accured :\n"<<exc.what());
+      throw std::runtime_error("Create - Cannot create a Convertor for this file!!!"); return Build();
+  }catch(std::exception& exc){
+    INFOS("Follow exception was occured :\n"<<exc.what());
   }catch(...){
-    INFOS("Unknown exception was accured!!!");
+    INFOS("Unknown exception was occured!!!");
   }
   return NULL;
 }
@@ -426,10 +425,10 @@ VISU::Storable* VISU::Result_i::Create(SALOMEDS::SObject_ptr theMedSObject){
     myName = ::GenerateName("aResult").latin1();
     VISU::Storable* aStorable = Build(theMedSObject);
     return aStorable;
-  }catch(std::runtime_error& exc){
-    INFOS("Follow exception was accured :\n"<<exc.what());
+  }catch(std::exception& exc){
+    INFOS("Follow exception was occured :\n"<<exc.what());
   }catch(...){
-    INFOS("Unknown exception was accured!!!");
+    INFOS("Unknown exception was occured!!!");
   }
   return NULL;
 }
@@ -444,12 +443,14 @@ VISU::Storable* VISU::Result_i::Create(SALOME_MED::FIELD_ptr theField){
     myFileInfo.setFile(aCompDataType.c_str());
     myInitFileName = aCompDataType;
     myName = ::GenerateName("aResult").latin1();
-    VISU::Storable* aStorable = Build();
+    CORBA::String_var anIOR = myStudyDocument->ConvertObjectToIOR(theField);
+    SALOMEDS::SObject_var aFieldSObject = myStudyDocument->FindObjectIOR(anIOR);
+    VISU::Storable* aStorable = Build(aFieldSObject);
     return aStorable;
-  }catch(std::runtime_error& exc){
-    INFOS("Follow exception was accured :\n"<<exc.what());
+  }catch(std::exception& exc){
+    INFOS("Follow exception was occured :\n"<<exc.what());
   }catch(...){
-    INFOS("Unknown exception was accured!!!");
+    INFOS("Unknown exception was occured!!!");
   }
   return NULL;
 }
@@ -540,10 +541,10 @@ VISU::Storable* VISU::Result_i::Restore(SALOMEDS::SObject_ptr theSObject,
     if(aIsBuild.isEmpty()? 0 : aIsBuild.toInt()) 
       BuildAll();
     return this;
-  }catch(std::runtime_error& exc){
-    INFOS("Follow exception was accured :\n"<<exc.what());
+  }catch(std::exception& exc){
+    INFOS("Follow exception was occured :\n"<<exc.what());
   }catch(...){
-    INFOS("Unknown exception was accured!!!");
+    INFOS("Unknown exception was occured!!!");
   }
   return NULL;
 }