]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
NRI : Merge from V1_2.
authornri <nri@opencascade.com>
Thu, 10 Jul 2003 16:57:58 +0000 (16:57 +0000)
committernri <nri@opencascade.com>
Thu, 10 Jul 2003 16:57:58 +0000 (16:57 +0000)
12 files changed:
src/VISU_I/VISU_Convertor.cxx
src/VISU_I/VISU_Convertor.hxx
src/VISU_I/VISU_Convertor_impl.cxx
src/VISU_I/VISU_Convertor_impl.hxx
src/VISU_I/VISU_CorbaMedConvertor.hxx
src/VISU_I/VISU_DatConvertor.cxx
src/VISU_I/VISU_PrsObject_i.cc
src/VISU_I/VISU_PrsObject_i.hh
src/VISU_I/VISU_Result_i.cc
src/VISU_I/VISU_Table_i.cc
src/VISU_I/VISU_TimeAnimation.cxx
src/VISU_I/VISU_ViewManager_i.cc

index 6f66024fc8db30fbb6b166874514d36850f83a42..c0d655c6a3df75edb4ea0ceb2075ba8b0c86e520 100644 (file)
@@ -8,6 +8,8 @@
 
 using namespace std;
 #include "VISU_Convertor.hxx"
+#include <fstream>     
+#include <strstream>
 #include <vtkCellType.h>
 #include <qdir.h>
 #include <qfileinfo.h>
@@ -122,26 +124,30 @@ namespace VISU{
   }
 }
 
-const VISU::TMesh* VISU_Convertor::GetMesh(const string& theMeshName) const {
-  string aMeshName(theMeshName == ""? myMeshMap.begin()->first: theMeshName);
-  VISU::TMeshMap::const_iterator aMeshMapIter = myMeshMap.find(theMeshName);
-  if(aMeshMapIter == myMeshMap.end()) return NULL;
-  return &(aMeshMapIter->second);
+const VISU::TMeshMap& VISU_Convertor::GetMeshMap() throw(std::runtime_error&){ 
+  if(!myIsDone) { myIsDone = true;  Build();}
+  return myMeshMap;
 }
 
-const VISU::TField* VISU_Convertor::GetField(const string& theMeshName, VISU::TEntity theEntity, 
-                                            const string& theFieldName) const
+const VISU::TField& VISU_Convertor::GetField(const string& theMeshName, 
+                                            VISU::TEntity theEntity, 
+                                            const string& theFieldName) 
+     throw (std::runtime_error&)
 {
+  if(!myIsDone) { myIsDone = true;  Build();}
   VISU::TMeshMap::const_iterator aMeshMapIter = myMeshMap.find(theMeshName);
-  if(aMeshMapIter == myMeshMap.end()) return NULL;
+  if(aMeshMapIter == myMeshMap.end())
+    throw std::runtime_error("GetField >> There is no mesh with the name !!!");
   const VISU::TMesh& aMesh = aMeshMapIter->second;
   VISU::TMeshOnEntityMap::const_iterator aMeshOnEntityMapIter = aMesh.myMeshOnEntityMap.find(theEntity);
-  if(aMeshOnEntityMapIter == aMesh.myMeshOnEntityMap.end()) return NULL;
+  if(aMeshOnEntityMapIter == aMesh.myMeshOnEntityMap.end())
+    throw std::runtime_error("GetField >> There is no mesh with the entity !!!");
   const VISU::TMeshOnEntity& aMeshOnEntity = aMeshOnEntityMapIter->second;
   const VISU::TFieldMap& aFieldMap = aMeshOnEntity.myFieldMap;
   VISU::TFieldMap::const_iterator aFieldMapIter = aFieldMap.find(theFieldName);
-  if(aFieldMapIter == aFieldMap.end()) return NULL;
-  return &(aFieldMapIter->second);
+  if(aFieldMapIter == aFieldMap.end())
+    throw std::runtime_error("GetField >> There is no field with the name !!!");
+  return aFieldMapIter->second;
 }
 
 string VISU_Convertor::GenerateName(const VISU::TField::TTime& aTime){
@@ -176,7 +182,7 @@ string VISU_Convertor::GenerateName(const string& theName, unsigned int theTimeI
 void parseFile(const char* theFileName) throw(std::runtime_error&){
   try{
     auto_ptr<VISU_Convertor> aCon(CreateConvertor(theFileName));
-    const VISU::TMeshMap& aMeshMap = *(aCon->GetMeshMap());
+    const VISU::TMeshMap& aMeshMap = aCon->GetMeshMap();
     VISU::TMeshMap::const_iterator aMeshMapIter = aMeshMap.begin();
     for(; aMeshMapIter != aMeshMap.end(); aMeshMapIter++){
       const string& aMeshName = aMeshMapIter->first;
@@ -366,9 +372,9 @@ int main(int argc, char** argv){
       return 0;
     }
   }catch(std::runtime_error& exc){
-    MESSAGE("Follow exception was accured :\n"<<exc.what());
+    cout<<"Follow exception was accured :\n"<<exc.what()<<endl;
   }catch(...){
-    MESSAGE("Unknown exception was accured in VISU_Convertor_impl");
+    cout<<"Unknown exception was accured in VISU_Convertor_impl"<<endl;
   } 
   return 1;
 }
index f71d5d35958c9237dea5c62a52f688f5158c57b2..6af06f582fbd817ecead604926344a51e39b85a1 100644 (file)
@@ -47,6 +47,7 @@ namespace VISU{
   extern TVtkCellInfoMap aVtkCellInfoMap;
 
   enum  TEntity {NODE_ENTITY, EDGE_ENTITY, FACE_ENTITY, CELL_ENTITY};
+  //enum  TEntity {CELL_ENTITY, FACE_ENTITY, EDGE_ENTITY, NODE_ENTITY};
   template <class _Tp> class vtk_ptr {
   private:
     _Tp* _M_ptr;
@@ -169,34 +170,29 @@ class VISU_Convertor{
 protected:
   std::string myName;
   VISU::TMeshMap myMeshMap;
+  int myIsDone;
 public:
   virtual ~VISU_Convertor(){};
+  virtual const string& GetName() { return myName;}
+  virtual int IsDone() const { return myIsDone;}
   typedef vtkUnstructuredGridReader OutputType;
-  const char* GetName() { return myName.c_str();}
-
+  virtual VISU_Convertor* Build() throw (std::runtime_error&) = 0;
   virtual OutputType* GetMeshOnEntity(const string& theMeshName, 
                                      const VISU::TEntity& theEntity,
                                      const string& theFamilyName = "")
     throw(std::runtime_error&) = 0;
-
   virtual OutputType* GetMeshOnGroup(const string& theMeshName, 
                                     const string& theGroupName)
     throw(std::runtime_error&) = 0;
-
   virtual OutputType* GetFieldOnMesh(const string& theMeshName, 
                                     const VISU::TEntity& theEntity,
                                     const string& theFieldName,
                                     int theStampsNum)
     throw(std::runtime_error&) = 0;
-
-  virtual int ToMedFile(const string& theFileName) throw(std::runtime_error&) = 0;
-  virtual int ToDatFile(const string& theFileName) throw(std::runtime_error&) = 0;
-  virtual int ToFile(const string& theFileName) throw(std::runtime_error&) = 0;
-
-  const VISU::TMeshMap* GetMeshMap() const { return &myMeshMap;}
-  const VISU::TMesh* GetMesh(const string& theMeshName = "") const;
-  const VISU::TField* GetField(const string& theMeshName, VISU::TEntity theEntity, 
-                              const string& theFieldName) const;
+  virtual const VISU::TMeshMap& GetMeshMap() throw(std::runtime_error&);
+  virtual const VISU::TField& GetField(const string& theMeshName, VISU::TEntity theEntity, 
+                                      const string& theFieldName)
+    throw(std::runtime_error&);
   static string GenerateName(const VISU::TField::TTime& aTime);
   static string GenerateName(const string& theName, unsigned int theTimeId);
 };
index cca6e5880fea7bd551c63c657bd1d128cdaf1ef9..353b12c00f1e5e52dce4800b6d7bbc55580ceab9 100644 (file)
@@ -72,15 +72,10 @@ extern "C" {
   }
 }
 
-int VISU_Convertor_impl::ToFile(const string& theFileName) throw(std::runtime_error&){
-  if(QFileInfo(theFileName.c_str()).extension(false) == "med")
-    return ToMedFile(theFileName);
-  else
-    return ToDatFile(theFileName);
+VISU_Convertor_impl::VISU_Convertor_impl() {
+  myIsDone = false;
 }
 
-VISU_Convertor_impl::VISU_Convertor_impl() : myIsDone(false) {}
-
 VISU_Convertor_impl::~VISU_Convertor_impl() {}
 
 VISU_Convertor::OutputType* VISU_Convertor_impl::GetMeshOnEntity(const string& theMeshName, 
@@ -88,6 +83,7 @@ VISU_Convertor::OutputType* VISU_Convertor_impl::GetMeshOnEntity(const string& t
                                                                 const string& theFamilyName)
   throw (std::runtime_error&)
 {
+  if(!myIsDone) { myIsDone = true;  Build();}
   if(MYDEBUG) 
     MESSAGE("GetMeshOnEntity - theMeshName = '"<<theMeshName<<
            "'; theEntity = "<<theEntity<<"; theFamilyName = '"<<theFamilyName<<"'");
@@ -119,15 +115,18 @@ VISU_Convertor::OutputType* VISU_Convertor_impl::GetMeshOnEntity(const string& t
     strCellsOut<<ends;
     strTypesOut<<ends;
     strOut<<"CELLS "<<aNbCells<<"\t"<<aCellsSize<<endl;
-    strOut<<strCellsOut.str()<<endl;
+    auto_ptr<char> aRet(strCellsOut.str());
+    strOut<<aRet.get()<<endl;
     strOut<<"CELL_TYPES "<<aNbCells<<endl;
-    strOut<<strTypesOut.str()<<endl;
+    aRet.reset(strTypesOut.str());
+    strOut<<aRet.get()<<endl;
     strOut<<ends;
     aReader.reset(OutputType::New());
     //aReader = OutputType::New();
     //aReader->DebugOn();
     aReader->ReadFromInputStringOn();
-    aReader->SetInputString(strOut.str());
+    aRet.reset(strOut.str());
+    aReader->SetInputString(aRet.get());
     //aReader->Update();
     //aReader->Print(cout);
     if(MYDEBUGWITHFILES){
@@ -136,7 +135,7 @@ VISU_Convertor::OutputType* VISU_Convertor_impl::GetMeshOnEntity(const string& t
       string aFileName = string("/users/")+getenv("USER")+"/"+getenv("USER")+"-";
       aFileName += aMeshName + dtos("-%d-",theEntity) + aFamilyName + "-Conv.vtk";
       ofstream stmOut(aFileName.c_str(),ios::out);
-      stmOut<<strOut.str();
+      stmOut<<aRet.get();
     }
   }
   return aReader.get();
@@ -147,6 +146,7 @@ VISU_Convertor::OutputType* VISU_Convertor_impl::GetMeshOnGroup(const string& th
                                                                const string& theGroupName)
      throw(std::runtime_error&)
 {
+  if(!myIsDone) { myIsDone = true;  Build();}
   if(MYDEBUG) MESSAGE("GetMeshOnGroup - theMeshName = '"<<theMeshName<<
                      "'; theGroupName = '"<<theGroupName<<"'");
   //Cheching possibility do the query
@@ -181,21 +181,24 @@ VISU_Convertor::OutputType* VISU_Convertor_impl::GetMeshOnGroup(const string& th
     strCellsOut<<ends;
     strTypesOut<<ends;
     strOut<<"CELLS "<<aNbCells<<"\t"<<aCellsSize<<endl;
-    strOut<<strCellsOut.str()<<endl;
+    auto_ptr<char> aRet(strCellsOut.str());
+    strOut<<aRet.get()<<endl;
     strOut<<"CELL_TYPES "<<aNbCells<<endl;
-    strOut<<strTypesOut.str()<<endl;
+    aRet.reset(strTypesOut.str());
+    strOut<<aRet.get()<<endl;
     strOut<<ends;
     aReader.reset(OutputType::New());
     //aReader = OutputType::New();
     aReader->ReadFromInputStringOn();
-    aReader->SetInputString(strOut.str());
+    aRet.reset(strOut.str());
+    aReader->SetInputString(aRet.get());
     if(MYDEBUGWITHFILES){
       string aMeshName = QString(theMeshName.c_str()).simplifyWhiteSpace().latin1();
       string aGroupName = QString(theGroupName.c_str()).simplifyWhiteSpace().latin1();
       string aFileName = string("/users/")+getenv("USER")+"/"+getenv("USER")+"-";
       aFileName += aMeshName + "-" + aGroupName + "-Conv.vtk";
       ofstream stmOut(aFileName.c_str(),ios::out);
-      stmOut<<strOut.str();
+      stmOut<<aRet.get();
     }
   }
   return aReader.get();
@@ -208,6 +211,7 @@ VISU_Convertor::OutputType* VISU_Convertor_impl::GetFieldOnMesh(const string& th
                                                                int theStampsNum)
      throw(std::runtime_error&)
 {
+  if(!myIsDone) { myIsDone = true;  Build();}
   if(MYDEBUG){
     MESSAGE("GetFieldOnMesh - theMeshName = '"<<theMeshName<<"; theEntity = "<<theEntity);
     MESSAGE("GetFieldOnMesh - theFieldName = '"<<theFieldName<<"'; theStampsNum = "<<theStampsNum);
@@ -258,22 +262,26 @@ VISU_Convertor::OutputType* VISU_Convertor_impl::GetFieldOnMesh(const string& th
     strCellsOut<<ends;
     strTypesOut<<ends;
     strOut<<"CELLS "<<aNbCells<<"\t"<<aCellsSize<<endl;
-    strOut<<strCellsOut.str()<<endl;
+    auto_ptr<char> aRet(strCellsOut.str());
+    strOut<<aRet.get()<<endl;
     strOut<<"CELL_TYPES "<<aNbCells<<endl;
-    strOut<<strTypesOut.str()<<endl;
+    aRet.reset(strTypesOut.str());
+    strOut<<aRet.get()<<endl;
     int aNbPoints = aMesh.myPointsCoord.size()/aMesh.myDim;
     strOut<<GetField(aField,aValForTime,aMesh.myDim,aNbPoints,aNbCells);
+    strOut<<ends;
     aReader.reset(OutputType::New());
     //aReader = OutputType::New();
     aReader->ReadFromInputStringOn();
-    aReader->SetInputString(strOut.str());
+    aRet.reset(strOut.str());
+    aReader->SetInputString(aRet.get());
     if(MYDEBUGWITHFILES){
       string aMeshName = QString(theMeshName.c_str()).simplifyWhiteSpace().latin1();
       string aFieldName = QString(theFieldName.c_str()).simplifyWhiteSpace().latin1();
       string aFileName = string("/users/")+getenv("USER")+"/"+getenv("USER")+"-";
       aFileName += aMeshName + dtos("-%d-",theEntity) + aFieldName + dtos("-%d",theStampsNum) + "-Conv.vtk";
       ofstream stmOut(aFileName.c_str(),ios::out);
-      stmOut<<strOut.str();
+      stmOut<<aRet.get();
     }
   }
   return aReader.get();
@@ -306,15 +314,18 @@ int VISU_Convertor_impl::GetCells(ostrstream& strCellsOut, ostrstream& strTypesO
   VISU::TMeshOnEntity::TCellsConn::const_iterator aCellsConnIter = aCellsConn.begin();
   for(; aCellsConnIter != aCellsConn.end(); aCellsConnIter++){
     const VISU::TMeshOnEntity::TConnForCellType& anArray = aCellsConnIter->second;
-    if(MYDEBUG) MESSAGE("GetCells - anArray.size() = "<<anArray.size());
     int aVtkType = aCellsConnIter->first;
+    if(MYDEBUG) MESSAGE("GetCells - aVtkType = "<<aVtkType<<"; anArray.size() = "<<anArray.size());
     if(!isFamilyPresent)
       for(int j = 0, jEnd = anArray.size(); j < jEnd; j++)
        PrintCells(strCellsOut,anArray[j],strTypesOut,aVtkType);
     else{
       const VISU::TFamily::TSubMesh& aSubMesh = aFamily.mySubMesh;
+      if(aSubMesh.empty()) throw std::runtime_error("GetCells >> There is no elements on the family !!!");
       VISU::TFamily::TSubMesh::const_iterator aSubMeshIter = aSubMesh.find(aVtkType);
+      if(aSubMeshIter == aSubMesh.end()) continue;
       const VISU::TFamily::TSubMeshOnCellType& aSubMeshOnCellType = aSubMeshIter->second;
+      if(MYDEBUG) MESSAGE("GetCells - aSubMeshOnCellType.size() = "<<aSubMeshOnCellType.size());
       VISU::TFamily::TSubMeshOnCellType::const_iterator aSubMeshOnCellTypeIter = aSubMeshOnCellType.begin();
       for(; aSubMeshOnCellTypeIter != aSubMeshOnCellType.end(); aSubMeshOnCellTypeIter++)
        PrintCells(strCellsOut,anArray[*aSubMeshOnCellTypeIter],strTypesOut,aVtkType);
@@ -330,7 +341,8 @@ string VISU_Convertor_impl::GetHead(const string& theMeshName) const throw (std:
   strOut<<"ASCII\n";
   strOut<<"DATASET UNSTRUCTURED_GRID\n";
   strOut<<ends;
-  return strOut.str(); 
+  auto_ptr<char> aRet(strOut.str());
+  return aRet.get(); 
 }
 
 string VISU_Convertor_impl::GetPoints(const VISU::TMesh& theMesh) const 
@@ -365,7 +377,8 @@ string VISU_Convertor_impl::GetPoints(const VISU::TMesh& theMesh) const
     break;
   }
   strOut<<ends;
-  return strOut.str(); 
+  auto_ptr<char> aRet(strOut.str());
+  return aRet.get(); 
 }
 
 string VISU_Convertor_impl::GetField(const VISU::TField& theField, 
@@ -418,5 +431,6 @@ string VISU_Convertor_impl::GetField(const VISU::TField& theField,
       throw std::runtime_error("GetField - There is algorithm for representation the field !!!");
   }
   strOut<<ends;
-  return strOut.str(); 
+  auto_ptr<char> aRet(strOut.str());
+  return aRet.get(); 
 }
index 6550070ec736bf4d32bcae433e77c35eb974a8bd..e444271991e0487e50cedb79510c76aaafa39faf 100644 (file)
@@ -23,8 +23,6 @@ extern "C"{
 using namespace std;
 
 class VISU_Convertor_impl: public VISU_Convertor{
- protected:
-  bool myIsDone;
  private:
   string GetHead(const string& theMeshName) const throw (std::runtime_error&);
   string GetPoints(const VISU::TMesh& theMesh) const throw (std::runtime_error&);
@@ -39,10 +37,6 @@ class VISU_Convertor_impl: public VISU_Convertor{
   VISU_Convertor_impl();
   virtual ~VISU_Convertor_impl();
   virtual VISU_Convertor* Build() throw (std::runtime_error&) { return this;};
-  virtual int ToMedFile(const string& theFileName) throw(std::runtime_error&);
-  virtual int ToDatFile(const string& theFileName) throw(std::runtime_error&);
-  virtual int ToFile(const string& theFileName) throw(std::runtime_error&);
-
   virtual OutputType* GetMeshOnEntity(const string& theMeshName, 
                                      const VISU::TEntity& theEntity,
                                      const string& theFamilyName = "")
index 312180c99b891a30ed297f519676c84eee61d943..e850515dca2e0da3db52de578917cef3998b971c 100644 (file)
@@ -16,7 +16,6 @@ extern "C"{
 #include <med.h>
 }  
 
-
 namespace VISUMED{
   struct TFamily{
     SALOME_MED::FAMILY_var myFamily;
@@ -99,3 +98,4 @@ extern "C" {
 }
 
 #endif
+
index 55714d2e06fa46e84ecb6de280258c6bf44fd117..91151aff3e4850c1fe814679e4bebccc10bfe909 100644 (file)
@@ -153,8 +153,8 @@ int VISU_DatConvertor::ImportCells(ifstream* pStmIn, vector<int>* pCellsType)
   return 0;
 }
 
+/*
 int VISU_Convertor_impl::ToDatFile(const string& theFileName) throw(std::runtime_error&){
-  /*
   if(MYDEBUG) MESSAGE("VISU_Convertor_impl::ToDatFile - "<<theFileName);
   if(!myIsDone && Build() != NULL) myIsDone = true;
   ofstream stmOut(theFileName.c_str(),ios::out);
@@ -248,6 +248,6 @@ int VISU_Convertor_impl::ToDatFile(const string& theFileName) throw(std::runtime
       }
     }
   }
-  */
   return 1;
 }
+*/
index 4595e48e2e27b2423e87c58094850c77ecf29195..a021b42c29597a3aafbb69ade2c33011222bbd54 100644 (file)
@@ -370,18 +370,18 @@ VISU::Storable* VISU::Mesh_i::Build(int theRestoring){
     switch(myType){
     case VISU::TENTITY : 
       myInput = myResult->GetInput()->GetMeshOnEntity(myMeshName,(VISU::TEntity)myEntity); 
-      aComment.sprintf("myComment=ENTITY;myType=%d;myResultName=%s;myMeshName=%s;myId=%d",
-                      VISU::TENTITY,myResult->GetName(),myMeshName.c_str(),myEntity);
+      aComment.sprintf("myComment=ENTITY;myType=%d;myMeshName=%s;myId=%d",
+                      VISU::TENTITY,myMeshName.c_str(),myEntity);
       break;
     case VISU::TFAMILY : 
       myInput = myResult->GetInput()->GetMeshOnEntity(myMeshName,(VISU::TEntity)myEntity,mySubMeshName);
-      aComment.sprintf("myComment=FAMILY;myType=%d;myResultName=%s;myMeshName=%s;myEntityId=%d;myName=%s",
-                      VISU::TFAMILY,myResult->GetName(),myMeshName.c_str(),myEntity,mySubMeshName.c_str());
+      aComment.sprintf("myComment=FAMILY;myType=%d;myMeshName=%s;myEntityId=%d;myName=%s",
+                      VISU::TFAMILY,myMeshName.c_str(),myEntity,mySubMeshName.c_str());
       break;
     case VISU::TGROUP : 
       myInput = myResult->GetInput()->GetMeshOnGroup(myMeshName,mySubMeshName);
-      aComment.sprintf("myComment=GROUP;myType=%d;myResultName=%s;myMeshName=%s;myName=%s",
-                      VISU::TGROUP,myResult->GetName(),myMeshName.c_str(),mySubMeshName.c_str());
+      aComment.sprintf("myComment=GROUP;myType=%d;myMeshName=%s;myName=%s",
+                      VISU::TGROUP,myMeshName.c_str(),mySubMeshName.c_str());
       break;
     }
     if(myInput == NULL) throw std::runtime_error("Mesh_i::Build - myInput == NULL !!!");
@@ -869,13 +869,19 @@ void VISU::ScalarMap_i::UpdateActor(VISU_Actor* theActor) {
   }
 }
 
-
 //==============================================================================
 int VISU::DeformedShape_i::IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity, 
                                      const char* theFieldName, double theIteration){
-  if(!VISU::ScalarMap_i::IsPossible(theResult,theMeshName,theEntity,theFieldName,theIteration)) return 0;
-  const VISU::TField* aField = theResult->GetInput()->GetField(theMeshName,(VISU::TEntity)theEntity,theFieldName);
-  return aField->myNbComp > 1;
+  try{
+    if(!VISU::ScalarMap_i::IsPossible(theResult,theMeshName,theEntity,theFieldName,theIteration)) return 0;
+    const VISU::TField& aField = theResult->GetInput()->GetField(theMeshName,(VISU::TEntity)theEntity,theFieldName);
+    return aField.myNbComp > 1;
+  }catch(std::runtime_error& exc){
+    MESSAGE("Follow exception was accured :\n"<<exc.what());
+  }catch(...){
+    MESSAGE("Unknown exception was accured!");
+  }
+  return 0;
 }
 
 int VISU::DeformedShape_i::myNbPresent = 0;
index e8d441e1fa57cc4e887f94133877ed7dc7968b3c..cd6230199b9906707cd9bbd58105b0cb459770c7 100644 (file)
@@ -261,6 +261,7 @@ namespace VISU{
                          const char* theFieldName, double theIteration);
     InputType* GetInput() { return myInput;}
 
+    virtual void Update();
     const VISU::TField*  GetField() const { return myField;}
     const string&  GetFieldName() const { return myFieldName;}
     int GetScalarMode() const { return myScalarMode;}
index 1061ce929de6f8ce290037625bb888a2c1e1040a..f0a16be6886f7079876be3e31c8e476e13006e81 100644 (file)
@@ -104,6 +104,12 @@ void CreateReference(SALOMEDS::Study_ptr theStudyDocument,
   aStudyBuilder->Addreference(newObj,aRefSObj);
 }
 
+string GetComponentDataType(SALOMEDS::SObject_ptr theSObject){
+  SALOMEDS::SComponent_var aCompRefSObj = theSObject->GetFatherComponent();
+  CORBA::String_var aDataType = aCompRefSObj->ComponentDataType();
+  return aDataType.in();
+}
+
 //==============================================================================
 
 const string VISU::Result_i::myComment = "RESULT";
@@ -111,9 +117,12 @@ const char* VISU::Result_i::GetComment() const { return myComment.c_str();}
 
 VISU::Result_i::Result_i(SALOMEDS::Study_ptr theStudy) {
   myStudyDocument = SALOMEDS::Study::_duplicate(theStudy);
+  myInput = NULL;
 }
 
-VISU::Storable* VISU::Result_i::Build() {
+VISU::Storable* VISU::Result_i::Build(SALOMEDS::SObject_ptr theSObject) 
+     throw (std::runtime_error&)
+{
   if(MYDEBUG) MESSAGE("Result_i::Build");
   const TMeshMap& aMeshMap = myInput->GetMeshMap();
   if(!aMeshMap.empty()) {//apo
@@ -174,31 +183,31 @@ VISU::Storable* VISU::Result_i::Build() {
          CreateAttributes(myStudyDocument,aEntity2Entry[anEntity].c_str(),aRefFatherEntry.c_str(),
                           "",aFamilyName.c_str(),"",aComment.latin1(),true);
        }
-       //Importing groups
-       const VISU::TGroupMap& aGroupMap = aMesh.myGroupMap;
-       if(aGroupMap.size() > 0){
-         aComment.sprintf("myComment=GROUPS;myResultName=%s;myMeshName=%s",myName.c_str(),aMeshName.c_str());
-         string aGroupsEntry = CreateAttributes(myStudyDocument,aMeshEntry.c_str(),aRefFatherEntry.c_str(),
-                                                "","Groups","",aComment.latin1(),true);
-         VISU::TGroupMap::const_iterator aGroupMapIter = aGroupMap.begin();
-         for(; aGroupMapIter != aGroupMap.end(); aGroupMapIter++){
-           const string& aGroupName = aGroupMapIter->first;
-           aComment.sprintf("myComment=GROUP;myType=%d;myResultName=%s;myMeshName=%s;myName=%s",
-                            VISU::TGROUP,myName.c_str(),aMeshName.c_str(),aGroupName.c_str());
-           string aGroupEntry = CreateAttributes(myStudyDocument,aGroupsEntry.c_str(),aRefFatherEntry.c_str(),
-                                                 "",aGroupName.c_str(),"",aComment.latin1(),true);
-           const VISU::TGroup& aGroup = aGroupMapIter->second;
-           const VISU::TFamilyAndEntitySet& aFamilyAndEntitySet = aGroup.myFamilyAndEntitySet;
-           VISU::TFamilyAndEntitySet::const_iterator aFamilyAndEntitySetIter = aFamilyAndEntitySet.begin();
-           for(; aFamilyAndEntitySetIter != aFamilyAndEntitySet.end(); aFamilyAndEntitySetIter++){
-             const VISU::TFamilyAndEntity& aFamilyAndEntity = *aFamilyAndEntitySetIter;
-             const string& aFamilyName = aFamilyAndEntity.first;
-             const VISU::TEntity& anEntity = aFamilyAndEntity.second;
-             aComment.sprintf("myComment=FAMILY;myType=%d;myResultName=%s;myMeshName=%s;myEntityId=%d;myName=%s",
-                              VISU::TFAMILY,myName.c_str(),aMeshName.c_str(),anEntity,aFamilyName.c_str());
-             string anEntry = FindEntryWithComment(myStudyDocument,aEntity2Entry[anEntity].c_str(),aComment);
-             CreateReference(myStudyDocument,aGroupEntry,anEntry);
-           }
+      }
+      //Importing groups
+      const VISU::TGroupMap& aGroupMap = aMesh.myGroupMap;
+      if(aGroupMap.size() > 0){
+       aComment.sprintf("myComment=GROUPS;myMeshName=%s",aMeshName.c_str());
+       string aGroupsEntry = CreateAttributes(myStudyDocument,aMeshEntry.c_str(),aRefFatherEntry.c_str(),
+                                              "","Groups","",aComment.latin1(),true);
+       VISU::TGroupMap::const_iterator aGroupMapIter = aGroupMap.begin();
+       for(; aGroupMapIter != aGroupMap.end(); aGroupMapIter++){
+         const string& aGroupName = aGroupMapIter->first;
+         aComment.sprintf("myComment=GROUP;myType=%d;myMeshName=%s;myName=%s",
+                          VISU::TGROUP,aMeshName.c_str(),aGroupName.c_str());
+         string aGroupEntry = CreateAttributes(myStudyDocument,aGroupsEntry.c_str(),aRefFatherEntry.c_str(),
+                                               "",aGroupName.c_str(),"",aComment.latin1(),true);
+         const VISU::TGroup& aGroup = aGroupMapIter->second;
+         const VISU::TFamilyAndEntitySet& aFamilyAndEntitySet = aGroup.myFamilyAndEntitySet;
+         VISU::TFamilyAndEntitySet::const_iterator aFamilyAndEntitySetIter = aFamilyAndEntitySet.begin();
+         for(; aFamilyAndEntitySetIter != aFamilyAndEntitySet.end(); aFamilyAndEntitySetIter++){
+           const VISU::TFamilyAndEntity& aFamilyAndEntity = *aFamilyAndEntitySetIter;
+           const string& aFamilyName = aFamilyAndEntity.first;
+           const VISU::TEntity& anEntity = aFamilyAndEntity.second;
+           aComment.sprintf("myComment=FAMILY;myType=%d;myMeshName=%s;myEntityId=%d;myName=%s",
+                            VISU::TFAMILY,aMeshName.c_str(),anEntity,aFamilyName.c_str());
+           string anEntry = FindEntryWithComment(myStudyDocument,aEntity2Entry[anEntity].c_str(),aComment);
+           CreateReference(myStudyDocument,aGroupEntry,anEntry);
          }
        }
       }
@@ -305,7 +314,6 @@ VISU::Storable* VISU::Result_i::Restore(SALOMEDS::SObject_ptr theSObject,
 {
   if(MYDEBUG)  MESSAGE("Result_i::Restore - "<<thePrefix);
   try{
-    myIsRestored = 1;
     mySObject = SALOMEDS::SObject::_duplicate(theSObject);
     myStudyDocument = mySObject->GetStudy();
     mySComponent = mySObject->GetFatherComponent();
index 80ce8c100ecd80b238b00fea647f5708fba52a64..5d01988c6912034fa248cb6b74cf5b30ae14e3db 100644 (file)
@@ -935,6 +935,8 @@ int getLine(ifstream& theStmIn, QString& theString){
 
 void ImportTables(const char* theFileName, TTableCont& theTableCont){
   ifstream aStmIn;
+  QFileInfo aFileInfo(theFileName);
+  if(!aFileInfo.isFile() || !aFileInfo.isReadable() || !aFileInfo.size()) return;
   aStmIn.open(theFileName);
   QString aTmp;
   do{
index a8dcc57a6388383417d245251adb6892ca10473c..d5f4cc64cfe6ba8233d36399fc12699f6092d736 100644 (file)
@@ -437,7 +437,6 @@ void VISU_TimeAnimation::run() {
        aName.replace(aPos, 1, "_");
       aFile += aName;
       aFile += ".jpeg";
-      //cout<<"### save:"<<aFile<<endl;
       px.save(aFile, "JPEG");
     }
     if (!isDumping) {
index 1306d5d1f213d8de63240a166258005f2e8ccd84..f93106df75988359da56207404875a65cfe781c1 100644 (file)
@@ -819,7 +819,7 @@ namespace VISU{
          string aComm(aString);
          if(MYDEBUG)  MESSAGE("View3D_i::SaveViewPoint - aComm = "<<aComm);
          if(aComm.compare(View3D_i::myComment) >= 0){
-           aCmnt->SetValue(ToString());
+           aCmnt->SetValue(ToString().c_str());
            return 1;
          }
        }
@@ -833,7 +833,7 @@ namespace VISU{
     SALOMEDS::SComponent_var aSComponent = 
       FindOrCreateVisuComponent(myStudy->getStudyDocument());
     CORBA::String_var aSComponentEntry = aSComponent->GetID(), anIOR(GetID());
-    string anEntry = CreateAttributes(myStudy->getStudyDocument(),aSComponentEntry,"","",newName.latin1(),"",ToString());
+    string anEntry = CreateAttributes(myStudy->getStudyDocument(),aSComponentEntry,"","",newName.latin1(),"",ToString().c_str());
     return 1;
   }