]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
Minor changes
authorapo <apo@opencascade.com>
Fri, 29 Jun 2007 07:11:03 +0000 (07:11 +0000)
committerapo <apo@opencascade.com>
Fri, 29 Jun 2007 07:11:03 +0000 (07:11 +0000)
src/VISU_I/VISU_Gen_i.cc
src/VISU_I/VISU_MultiResult_i.cc
src/VISU_I/VISU_MultiResult_i.hh

index cddc42c436282231ab82aca837400564a73bcd0b..fe61c34fed1daeac545bf2835b7933c42f6b59ba 100644 (file)
@@ -108,7 +108,7 @@ GetImpl(CORBA::ORB_ptr theORB,
 namespace VISU
 {
   //----------------------------------------------------------------------------
-  static string VisuTmpDir;
+  static std::string VISU_TMP_DIR;
 
   static CORBA::Boolean myIsMultiFile;
   const CORBA::Boolean IsMultifile() { return myIsMultiFile;}
@@ -296,7 +296,7 @@ namespace VISU
   ::Load(SALOMEDS::SComponent_ptr theComponent,
         const SALOMEDS::TMPFile & theStream,
         const char* theURL,
-        bool isMultiFile)
+        bool theIsMultiFile)
   {
     Mutex mt(myMutex);
     SALOMEDS::Study_var aStudy = theComponent->GetStudy();
@@ -310,12 +310,10 @@ namespace VISU
     }
 
    
-    string aDir = isMultiFile ? theURL : SALOMEDS_Tool::GetTmpDir();
-    TCollection_AsciiString aTmpDir (const_cast<char*>(aDir.c_str()));
-    VisuTmpDir = aTmpDir.ToCString();
+    VISU_TMP_DIR = theIsMultiFile ? theURL : SALOMEDS_Tool::GetTmpDir();
     SALOMEDS::ListOfFileNames_var aSeq =
-      SALOMEDS_Tool::PutStreamToFiles(theStream, aTmpDir.ToCString(),isMultiFile);
-    myIsMultiFile = isMultiFile;
+      SALOMEDS_Tool::PutStreamToFiles(theStream, VISU_TMP_DIR, theIsMultiFile);
+    myIsMultiFile = theIsMultiFile;
     return true;
   }
 
@@ -326,9 +324,9 @@ namespace VISU
   ::LoadASCII(SALOMEDS::SComponent_ptr theComponent,
              const SALOMEDS::TMPFile & theStream,
              const char* theURL,
-             bool isMultiFile)
+             bool theIsMultiFile)
   {
-    return Load(theComponent, theStream, theURL, isMultiFile);
+    return Load(theComponent, theStream, theURL, theIsMultiFile);
   }
 
 
@@ -337,15 +335,16 @@ namespace VISU
   VISU_Gen_i
   ::LocalPersistentIDToIOR(SALOMEDS::SObject_ptr theSObject,
                           const char* aLocalPersistentID,
-                          CORBA::Boolean isMultiFile,
-                          CORBA::Boolean isASCII)
+                          CORBA::Boolean theIsMultiFile,
+                          CORBA::Boolean theIsASCII)
   {
     CORBA::String_var aString("");
     if(strcmp(aLocalPersistentID,"") != 0) {
       Mutex mt(myMutex);
       Storable* aStorable =
-       Storable::Create(theSObject,VisuTmpDir.c_str(),aLocalPersistentID);
-      if(aStorable != NULL) aString = aStorable->GetID();
+       Storable::Create(theSObject, VISU_TMP_DIR.c_str(), aLocalPersistentID);
+      if(aStorable != NULL) 
+       aString = aStorable->GetID();
     }
     return aString._retn();
   }
@@ -428,10 +427,10 @@ namespace VISU
   VISU_Gen_i
   ::SaveASCII(SALOMEDS::SComponent_ptr theComponent,
              const char* theURL,
-             bool isMultiFile)
+             bool theIsMultiFile)
   {
     Mutex mt(myMutex);
-    string aDir = isMultiFile ? theURL : SALOMEDS_Tool::GetTmpDir();
+    string aDir = theIsMultiFile ? theURL : SALOMEDS_Tool::GetTmpDir();
     TCollection_AsciiString aTmpDir (const_cast<char*>(aDir.c_str()));
     if(MYDEBUG) MESSAGE("VISU_Gen_i::Save - "<<aTmpDir);
     int aCounter = 0;
@@ -448,24 +447,24 @@ namespace VISU
        case Result_i::eCopyAndImportFile: {
          const QFileInfo& aFileInfo = pResult->GetFileInfo();
          QString aPrefix("");
-         if (isMultiFile) aPrefix = SALOMEDS_Tool::GetNameFromPath(aStudy->URL()).c_str();
+         if (theIsMultiFile) aPrefix = SALOMEDS_Tool::GetNameFromPath(aStudy->URL()).c_str();
          QString aFileName = aPrefix + "_" + (pResult->GetName()).c_str();
                QString tmpDir = QDir::convertSeparators( QString(aTmpDir.ToCString()) );;
          static QString aCommand;
-    aCommand.sprintf(" %s %s%s",aFileInfo.filePath().latin1(),tmpDir.latin1(),aFileName.latin1());
-    aCommand = QDir::convertSeparators( aCommand );
-    aCommand.prepend( COPY_COMMAND );
-
-               if(system(aCommand.latin1())){
+         aCommand.sprintf(" %s %s%s",aFileInfo.filePath().latin1(),tmpDir.latin1(),aFileName.latin1());
+         aCommand = QDir::convertSeparators( aCommand );
+         aCommand.prepend( COPY_COMMAND );
+         
+         if(system(aCommand.latin1())){
            if(MYDEBUG) MESSAGE("VISU_Gen_i::Save - Can't execute the command :"<<aCommand);
            continue;
          }else
            if(MYDEBUG) MESSAGE("VISU_Gen_i::Save - "<<aCommand);
 
-               QString studyPath = tmpDir.append(aFileName);
+         QString studyPath = tmpDir.append(aFileName);
          TCollection_AsciiString aString((char *)(aFileName.latin1()));
-
-               HDFascii::ConvertFromHDFToASCII(strdup(studyPath.latin1()), true);
+         
+         HDFascii::ConvertFromHDFToASCII(strdup(studyPath.latin1()), true);
 
          aFileNames.Append(aString);
        }}
@@ -478,8 +477,8 @@ namespace VISU
       aSeq->length(aFileNames.Length());
       for(aCounter = aFileNames.Length(); aCounter > 0; aCounter--)
        aSeq[aCounter-1] = CORBA::string_dup(aFileNames.Value(aCounter).ToCString());
-      aStreamFile = SALOMEDS_Tool::PutFilesToStream(aTmpDir.ToCString(), aSeq.in(), isMultiFile);
-      if(!isMultiFile)
+      aStreamFile = SALOMEDS_Tool::PutFilesToStream(aTmpDir.ToCString(), aSeq.in(), theIsMultiFile);
+      if(!theIsMultiFile)
        SALOMEDS_Tool::RemoveTemporaryFiles(aTmpDir.ToCString(), aSeq.in(), true);
     }
     return aStreamFile._retn();
@@ -491,8 +490,8 @@ namespace VISU
   VISU_Gen_i
   ::IORToLocalPersistentID(SALOMEDS::SObject_ptr theSObject,
                           const char* IORString,
-                          CORBA::Boolean isMultiFile,
-                          CORBA::Boolean isASCII)
+                          CORBA::Boolean theIsMultiFile,
+                          CORBA::Boolean theIsASCII)
   {
     CORBA::String_var aString(IORString);
     if(strcmp(IORString,"") != 0){
@@ -621,7 +620,6 @@ namespace VISU
   {
     if(myStudyDocument->GetProperties()->IsLocked())
       return SALOMEDS::SObject::_nil();
-    Mutex mt(myMutex);
     SALOMEDS::SObject_var aRes = VISU::ImportTables(theFileName,myStudyDocument);
     return aRes._retn();
   }
@@ -644,17 +642,17 @@ namespace VISU
   {
     if(myStudyDocument->GetProperties()->IsLocked())
       return Result::_nil();
-    Mutex mt(myMutex);
-    aFileInfo.setFile(theFileName);
-    Result_i* pResult = Result_i::New(myStudyDocument,
+
+    Result_i* aResult = Result_i::New(myStudyDocument,
                                      Result_i::eFile,
                                      Result_i::eImportFile);
-    if(pResult->Create(theFileName) != NULL)
-      return pResult->_this();
-    else{
-      pResult->_remove_ref();
-      return VISU::Result::_nil();
-    }
+
+    if(aResult->Create(theFileName) != NULL)
+      return aResult->_this();
+    else
+      aResult->_remove_ref();
+
+    return VISU::Result::_nil();
   }
 
 
@@ -665,18 +663,18 @@ namespace VISU
   {
     if(myStudyDocument->GetProperties()->IsLocked())
       return Result::_nil();
-    Mutex mt(myMutex);
-    aFileInfo.setFile(theFileName);
-    Result_i* pResult = Result_i::New(myStudyDocument,
+
+    Result_i* aResult = Result_i::New(myStudyDocument,
                                      Result_i::eFile,
                                      Result_i::eImportFile,
                                      false);
-    if(pResult->Create(theFileName) != NULL)
-      return pResult->_this();
-    else{
-      pResult->_remove_ref();
-      return VISU::Result::_nil();
-    }
+
+    if(aResult->Create(theFileName) != NULL)
+      return aResult->_this();
+    else
+      aResult->_remove_ref();
+
+    return VISU::Result::_nil();
   }
 
 
@@ -687,15 +685,16 @@ namespace VISU
   {
     if(myStudyDocument->GetProperties()->IsLocked())
       return Result::_nil();
-    Mutex mt(myMutex);
-    VISU::Result_var aResult;
-    aFileInfo.setFile(theFileName);
-    Result_i* pResult = Result_i::New(myStudyDocument,
+
+    Result_i* aResult = Result_i::New(myStudyDocument,
                                      Result_i::eRestoredFile,
                                      Result_i::eCopyAndImportFile);
-    if(pResult->Create(theFileName) != NULL)
-      aResult = pResult->_this();
-    return aResult._retn();
+    if(aResult->Create(theFileName) != NULL)
+      return aResult->_this();
+    else
+      aResult->_remove_ref();
+
+    return VISU::Result::_nil();
   }
 
 
@@ -706,16 +705,16 @@ namespace VISU
   {
     if (myStudyDocument->GetProperties()->IsLocked())
       return Result::_nil();
-    Mutex mt(myMutex);
-    Result_i* pResult = Result_i::New(myStudyDocument,
+
+    Result_i* aResult = Result_i::New(myStudyDocument,
                                      Result_i::eComponent,
                                      Result_i::eImportMed);
-    if (pResult->Create(theMedSObject) != NULL) {
-      return pResult->_this();
-    } else {
-      pResult->_remove_ref();
-      return VISU::Result::_nil();
-    }
+    if (aResult->Create(theMedSObject) != NULL)
+      return aResult->_this();
+    else
+      aResult->_remove_ref();
+    
+    return VISU::Result::_nil();
   }
 
 
@@ -726,16 +725,17 @@ namespace VISU
   {
     if (myStudyDocument->GetProperties()->IsLocked())
       return Result::_nil();
-    Mutex mt(myMutex);
-    Result_i* pResult = Result_i::New(myStudyDocument,
+
+    Result_i* aResult = Result_i::New(myStudyDocument,
                                      Result_i::eComponent,
                                      Result_i::eImportMedField);
-    if (pResult->Create(theField) != NULL) {
-      return pResult->_this();
-    } else {
-      pResult->_remove_ref();
-      return VISU::Result::_nil();
-    }
+
+    if (aResult->Create(theField) != NULL)
+      return aResult->_this();
+    else
+      aResult->_remove_ref();
+    
+    return VISU::Result::_nil();
   }
 
   void
@@ -937,6 +937,8 @@ namespace VISU
                                             theIteration)._retn();
   }
 
+
+  //---------------------------------------------------------------
   DeformedShape_ptr 
   VISU_Gen_i
   ::DeformedShapeOnField(Result_ptr theResult,
@@ -952,6 +954,8 @@ namespace VISU
                                               theIteration)._retn();
   }
 
+
+  //---------------------------------------------------------------
   ScalarMapOnDeformedShape_ptr 
   VISU_Gen_i
   ::ScalarMapOnDeformedShapeOnField(Result_ptr theResult,
@@ -967,6 +971,8 @@ namespace VISU
                                                          theIteration)._retn();
   }
   
+
+  //---------------------------------------------------------------
   Vectors_ptr 
   VISU_Gen_i
   ::VectorsOnField(Result_ptr theResult,
@@ -982,6 +988,8 @@ namespace VISU
                                         theIteration)._retn();
   }
 
+
+  //---------------------------------------------------------------
   IsoSurfaces_ptr 
   VISU_Gen_i
   ::IsoSurfacesOnField(Result_ptr theResult,
@@ -997,6 +1005,8 @@ namespace VISU
                                             theIteration)._retn();
   }
 
+
+  //---------------------------------------------------------------
   StreamLines_ptr 
   VISU_Gen_i
   ::StreamLinesOnField(Result_ptr theResult,
@@ -1012,6 +1022,8 @@ namespace VISU
                                             theIteration)._retn();
   }
 
+
+  //---------------------------------------------------------------
   Plot3D_ptr 
   VISU_Gen_i
   ::Plot3DOnField(Result_ptr theResult,
@@ -1027,11 +1039,15 @@ namespace VISU
                                        theIteration)._retn();
   }
 
-  CutPlanes_ptr VISU_Gen_i::CutPlanesOnField(Result_ptr theResult,
-                                            const char* theMeshName,
-                                            VISU::Entity theEntity,
-                                            const char* theFieldName,
-                                            CORBA::Long theIteration)
+
+  //---------------------------------------------------------------
+  CutPlanes_ptr
+  VISU_Gen_i
+  ::CutPlanesOnField(Result_ptr theResult,
+                    const char* theMeshName,
+                    VISU::Entity theEntity,
+                    const char* theFieldName,
+                    CORBA::Long theIteration)
   {
     return Prs3dOnField<VISU::CutPlanes_i>(theResult,
                                           theMeshName,
@@ -1040,11 +1056,15 @@ namespace VISU
                                           theIteration)._retn();
   }
 
-  CutLines_ptr VISU_Gen_i::CutLinesOnField(Result_ptr theResult,
-                                          const char* theMeshName,
-                                          VISU::Entity theEntity,
-                                          const char* theFieldName,
-                                          CORBA::Long theIteration)
+
+  //---------------------------------------------------------------
+  CutLines_ptr
+  VISU_Gen_i
+  ::CutLinesOnField(Result_ptr theResult,
+                   const char* theMeshName,
+                   VISU::Entity theEntity,
+                   const char* theFieldName,
+                   CORBA::Long theIteration)
   {
     return Prs3dOnField<VISU::CutLines_i>(theResult,
                                          theMeshName,
@@ -1053,6 +1073,8 @@ namespace VISU
                                          theIteration)._retn();
   }
 
+
+  //---------------------------------------------------------------
   struct CreateTableEvent: public SALOME_Event
   {
     SALOMEDS::Study_var myStudyDocument;
@@ -1082,7 +1104,10 @@ namespace VISU
   };
 
 
-  Table_ptr VISU_Gen_i::CreateTable(const char* theTableEntry)
+  //---------------------------------------------------------------
+  Table_ptr
+  VISU_Gen_i
+  ::CreateTable(const char* theTableEntry)
   {
     if(myStudyDocument->GetProperties()->IsLocked())
       return Table::_nil();
@@ -1090,17 +1115,25 @@ namespace VISU
     return ProcessEvent(new CreateTableEvent(myStudyDocument, theTableEntry));
   }
 
-  Curve_ptr VISU_Gen_i::CreateCurve(Table_ptr theTable,
-                                   CORBA::Long theHRow,
-                                   CORBA::Long theVRow)
+
+  //---------------------------------------------------------------
+  Curve_ptr
+  VISU_Gen_i
+  ::CreateCurve(Table_ptr theTable,
+               CORBA::Long theHRow,
+               CORBA::Long theVRow)
   {
     return CreateCurveWithZ( theTable, theHRow, theVRow, 0 );
   }
 
-  Curve_ptr VISU_Gen_i::CreateCurveWithZ(Table_ptr theTable,
-                                   CORBA::Long theHRow,
-                                   CORBA::Long theVRow,
-                                   CORBA::Long theZRow)
+
+  //---------------------------------------------------------------
+  Curve_ptr
+  VISU_Gen_i
+  ::CreateCurveWithZ(Table_ptr theTable,
+                    CORBA::Long theHRow,
+                    CORBA::Long theVRow,
+                    CORBA::Long theZRow)
   {
     if(myStudyDocument->GetProperties()->IsLocked())
       return Curve::_nil();
@@ -1116,7 +1149,13 @@ namespace VISU
     }
   }
 
-  Container_ptr VISU_Gen_i::CreateContainer(){
+
+
+  //---------------------------------------------------------------
+  Container_ptr
+  VISU_Gen_i
+  ::CreateContainer()
+  {
     if(myStudyDocument->GetProperties()->IsLocked())
       return Container::_nil();
     Mutex mt(myMutex);
@@ -1129,7 +1168,12 @@ namespace VISU
     }
   }
 
-  Animation_ptr VISU_Gen_i::CreateAnimation(View3D_ptr theView3D){
+
+  //---------------------------------------------------------------
+  Animation_ptr
+  VISU_Gen_i
+  ::CreateAnimation(View3D_ptr theView3D)
+  {
     if(myStudyDocument->GetProperties()->IsLocked())
       return Animation::_nil();
     Mutex mt(myMutex);
@@ -1139,32 +1183,58 @@ namespace VISU
       return VISU::Animation::_nil();
   }
 
-  void VISU_Gen_i::DeleteResult (Result_ptr theResult)
+
+  //---------------------------------------------------------------
+  void
+  VISU_Gen_i
+  ::DeleteResult (Result_ptr theResult)
   {
     theResult->RemoveFromStudy();
   }
 
-  void VISU_Gen_i::DeletePrs3d (Prs3d_ptr thePrs3d)
+
+  //---------------------------------------------------------------
+  void
+  VISU_Gen_i
+  ::DeletePrs3d(Prs3d_ptr thePrs3d)
   {
     thePrs3d->RemoveFromStudy();
   }
 
-  void VISU_Gen_i::Close(SALOMEDS::SComponent_ptr theComponent){
-  }
 
-  char* VISU_Gen_i::ComponentDataType(){
+  //---------------------------------------------------------------
+  void
+  VISU_Gen_i
+  ::Close(SALOMEDS::SComponent_ptr theComponent)
+  {}
+
+
+  //---------------------------------------------------------------
+  char* 
+  VISU_Gen_i
+  ::ComponentDataType()
+  {
     return CORBA::string_dup("VISU");
   }
 
-  bool VISU_Gen_i::CanPublishInStudy(CORBA::Object_ptr theIOR) {
+
+  //---------------------------------------------------------------
+  bool
+  VISU_Gen_i
+  ::CanPublishInStudy(CORBA::Object_ptr theIOR) 
+  {
     Result_var aResultObj = Result::_narrow(theIOR);
     return !(aResultObj->_is_nil());
   }
 
-  SALOMEDS::SObject_ptr VISU_Gen_i::PublishInStudy(SALOMEDS::Study_ptr theStudy,
-                                                  SALOMEDS::SObject_ptr theSObject,
-                                                  CORBA::Object_ptr theObject,
-                                                  const char* theName)
+
+  //---------------------------------------------------------------
+  SALOMEDS::SObject_ptr
+  VISU_Gen_i
+  ::PublishInStudy(SALOMEDS::Study_ptr theStudy,
+                  SALOMEDS::SObject_ptr theSObject,
+                  CORBA::Object_ptr theObject,
+                  const char* theName)
     throw (SALOME::SALOME_Exception)
   {
     Unexpect aCatch(SalomeException);
@@ -1172,14 +1242,20 @@ namespace VISU
     Mutex mt(myMutex);
     SALOMEDS::SObject_var aResultSO;
     Result_i* aResultObj = dynamic_cast<Result_i*>(GetServant(theObject).in());
-    if (!aResultObj) return aResultSO._retn();
+    if (!aResultObj) 
+      return aResultSO._retn();
     const QFileInfo& aFileInfo = aResultObj->GetFileInfo();
     CORBA::String_var anEntry = aResultObj->Create(aFileInfo.filePath().latin1())->GetID();
     aResultSO = theStudy->FindObjectID(anEntry);
     return aResultSO._retn();
   }
 
-  CORBA::Boolean VISU_Gen_i::CanCopy(SALOMEDS::SObject_ptr theObject) {
+
+  //---------------------------------------------------------------
+  CORBA::Boolean 
+  VISU_Gen_i
+  ::CanCopy(SALOMEDS::SObject_ptr theObject) 
+  {
     Mutex mt(myMutex);
     SALOMEDS::GenericAttribute_var anAttr;
     if (!theObject->FindAttribute(anAttr, "AttributeIOR")) return false;
@@ -1209,6 +1285,8 @@ namespace VISU
     return false;
   }
 
+
+  //---------------------------------------------------------------
   SALOMEDS::TMPFile* 
   VISU_Gen_i
   ::CopyFrom(SALOMEDS::SObject_ptr theObject, CORBA::Long& theObjectID) 
@@ -1280,7 +1358,11 @@ namespace VISU
     return aStreamFile._retn();
   }
 
-  CORBA::Boolean VISU_Gen_i::CanPaste(const char* theComponentName, CORBA::Long theObjectID) {
+
+  //---------------------------------------------------------------
+  CORBA::Boolean 
+  VISU_Gen_i
+  ::CanPaste(const char* theComponentName, CORBA::Long theObjectID) {
     // The VISU component can paste only objects copied by VISU component
     // and with the object type = 1
     if (strcmp(theComponentName, ComponentDataType()) != 0 || theObjectID != 1)
@@ -1288,9 +1370,13 @@ namespace VISU
     return true;
   }
 
-  SALOMEDS::SObject_ptr VISU_Gen_i::PasteInto(const SALOMEDS::TMPFile& theStream,
-                                             CORBA::Long theObjectID,
-                                             SALOMEDS::SObject_ptr theObject)
+
+  //---------------------------------------------------------------
+  SALOMEDS::SObject_ptr
+  VISU_Gen_i
+  ::PasteInto(const SALOMEDS::TMPFile& theStream,
+             CORBA::Long theObjectID,
+             SALOMEDS::SObject_ptr theObject)
   {
     Mutex mt(myMutex);
     SALOMEDS::SObject_var aResultSO;
@@ -1345,9 +1431,11 @@ namespace VISU
     return aResultSO._retn();
   }
 
+
+  //---------------------------------------------------------------
   VISU::ColoredPrs3dCache_ptr
-  VISU_Gen_i::
-  GetColoredPrs3dCache(SALOMEDS::Study_ptr theStudy)
+  VISU_Gen_i
+  ::GetColoredPrs3dCache(SALOMEDS::Study_ptr theStudy)
   {
     return ColoredPrs3dCache_i::GetInstance(theStudy);
   }
index e46382aa57e7fce7a182f07d535612d54efc240c..ff71ddce1b8ed65eb11b997e0652129ce1bd8966 100644 (file)
@@ -174,12 +174,12 @@ namespace VISU
   void 
   BuildParts(Result_i* theResult,
             Result_i::PInput theInput,
-            const QFileInfo& theMPFileInfo,
+            const QFileInfo& theMultiFileInfo,
+            MultiResult_i::TPartInfos* thePartInfos,
             MultiResult_i::TPartName2FileName* thePartName2FileName,
             MultiResult_i::TPartName2ResolutionID* thePartName2ResolutionID,
             CORBA::Boolean* theIsDone,
             CORBA::Boolean theIsBuild,
-            CORBA::Boolean theIsAtOnce,
             _PTR(Study) theStudy)
   {
     if(!theIsBuild || *theIsDone)
@@ -187,12 +187,12 @@ namespace VISU
 
     // if MED file is not a distributed MED file (created with MULTIPR),
     // then it is not necessary to build parts
-    if (theMPFileInfo.filePath().isEmpty())
+    if (theMultiFileInfo.filePath().isEmpty())
       return;
 
     try {
       multipr::Obj aMultiprObj;
-      aMultiprObj.create(theMPFileInfo.filePath().latin1());
+      aMultiprObj.create(theMultiFileInfo.filePath().latin1());
       if (aMultiprObj.isValidDistributedMEDFile()) {
        const VISU::TMeshMap& aMeshMap = theInput->GetMeshMap();
        VISU::TMeshMap::const_iterator aMeshMapIter = aMeshMap.begin();
@@ -213,6 +213,7 @@ namespace VISU
                         aComment.latin1(),
                         false);
 
+       MultiResult_i::TPartInfos& myPartInfos = *thePartInfos;
        MultiResult_i::TPartName2FileName& aPartName2FileName = *thePartName2FileName;
        MultiResult_i::TPartName2ResolutionID& aPartName2ResolutionID = *thePartName2ResolutionID;
 
@@ -227,50 +228,45 @@ namespace VISU
        std::string aLastEntry;
        for (size_t aPartID = 0 ; aPartID < aParts.size() ; aPartID++) {
          const MultiResult_i::TPartName& aPartName = aParts[aPartID];
-         std::string aPartInfo = aMultiprObj.getPartInfo(aPartName.c_str());
+         std::string aStringInfo = aMultiprObj.getPartInfo(aPartName.c_str());
 
-         std::istrstream anOutputStream(aPartInfo.c_str());
-         std::string aMeshName;
-         anOutputStream>>aMeshName;
+         MultiResult_i::TPartInfo aPartInfo;
+         std::istrstream anOutputStream(aStringInfo.c_str());
+         anOutputStream>>(aPartInfo.myMeshName);
+         anOutputStream>>(aPartInfo.myPartID);
+         anOutputStream>>(aPartInfo.myName);
+         anOutputStream>>(aPartInfo.myPath);
+         anOutputStream>>(aPartInfo.myFileName);
 
-         int anID;
-         anOutputStream>>anID;
+         QFileInfo aFileInfo(aPartInfo.myFileName.c_str());
+         myPartInfos[aFileInfo.fileName()] = aPartInfo;
 
-         std::string aName;
-         anOutputStream>>aName;
-
-         std::string aPath;
-         anOutputStream>>aPath;
-
-         std::string aFileName;
-         anOutputStream>>aFileName;
-
-         aPartName2FileName[aName] = aFileName;
+         aPartName2FileName[aPartInfo.myName] = aPartInfo.myFileName;
 
          QString aComment = "";
-         std::string aResoltutions = GetResolutions(aMain2SubParts, aName);
-         if ( IsFullResolution(aName) ) {
-           std::string anIconName = GetIconName(aMain2SubParts, aName);
-           MultiResult_i::TResolutionID aResolutionID = GetResolutionID(aMain2SubParts, aName);
+         std::string aResoltutions = GetResolutions(aMain2SubParts, aPartInfo.myName);
+         if ( IsFullResolution(aPartInfo.myName) ) {
+           std::string anIconName = GetIconName(aMain2SubParts, aPartInfo.myName);
+           MultiResult_i::TResolutionID aResolutionID = GetResolutionID(aMain2SubParts, aPartInfo.myName);
            aComment.sprintf("myComment=PART;myFile=%s;myResolutions=%s;myState=%c", 
-                            aFileName.c_str(), aResoltutions.c_str(), aResolutionID); 
+                            aPartInfo.myFileName.c_str(), aResoltutions.c_str(), aResolutionID); 
            aLastEntry = CreateAttributes(theStudy,
                                          aMesh->myPartsEntry,
                                          anIconName,
                                          NO_IOR,
-                                         aName,
+                                         aPartInfo.myName,
                                          NO_PERFSITENT_REF,
                                          aComment.latin1(),
                                          true);
-           aPartName2ResolutionID[aName] = aResolutionID;
+           aPartName2ResolutionID[aPartInfo.myName] = aResolutionID;
          } else {
            aComment.sprintf("myComment=PART;myFile=%s;myResolutions=%s", 
-                            aFileName.c_str(), aResoltutions.c_str()); 
+                            aPartInfo.myFileName.c_str(), aResoltutions.c_str()); 
            CreateAttributes(theStudy,
                             aLastEntry,
                             NO_ICON,
                             NO_IOR,
-                            aName,
+                            aPartInfo.myName,
                             NO_PERFSITENT_REF,
                             aComment.latin1(),
                             true);
@@ -337,12 +333,12 @@ VISU::MultiResult_i
   if(theIsAtOnce){
     BuildParts(this,
               GetInput(),
-              myMPFileInfo,
+              myMultiFileInfo,
+              &myPartInfos,
               &myPartName2FileName,
               &myPartName2ResolutionID,
               &myIsPartsDone,
               myIsBuildParts,
-              theIsAtOnce,
               myStudy);
   }
 
@@ -368,12 +364,12 @@ VISU::MultiResult_i
     boost::thread aThread(boost::bind(&BuildParts,
                                      this,
                                      GetInput(),
-                                     myMPFileInfo,
+                                     myMultiFileInfo,
+                                     &myPartInfos,
                                      &myPartName2FileName,
                                      &myPartName2ResolutionID,
                                      &myIsPartsDone,
                                      myIsBuildParts,
-                                     false,
                                      myStudy));
   }
   {
@@ -426,7 +422,7 @@ VISU::MultiResult_i
     if (aSourceFileName.isEmpty()) 
       throw std::runtime_error("distributed MED file; bad format"); 
 
-    myMPFileInfo.setFile(theFileName);
+    myMultiFileInfo.setFile(theFileName);
     aTargetFileName = aSourceFileName;
     myIsBuildParts = true;
   }
@@ -435,6 +431,30 @@ VISU::MultiResult_i
 }
 
 
+//---------------------------------------------------------------
+void 
+VISU::MultiResult_i
+::ToStream(std::ostringstream& theStr)
+{
+  TSuperClass::ToStream(theStr);
+
+  std::ostringstream aPartNames, aResolutions;
+  TPartName2ResolutionID::const_iterator anIter = myPartName2ResolutionID.begin();
+  for ( ; anIter != myPartName2ResolutionID.end() ; anIter++) {
+    const TPartName& aPartName = anIter->first;
+    aPartNames<<aPartName<<"|";
+    const TResolutionID& aResolution = anIter->second;
+    aResolutions<<aResolution<<"|";
+  }
+
+  Storable::DataToStream( theStr, "myPartNames",  aPartNames.str().c_str());
+  if(MYDEBUG) MESSAGE("MultiResult_i::ToStream - aPartNames = "<<aPartNames.str());
+
+  Storable::DataToStream( theStr, "myResolutions", aResolutions.str().c_str());
+  if(MYDEBUG) MESSAGE("MultiResult_i::ToStream - aResolutions = "<<aResolutions.str());
+}
+
+
 //---------------------------------------------------------------
 VISU::Storable*
 VISU::MultiResult_i
@@ -442,9 +462,19 @@ VISU::MultiResult_i
          const Storable::TRestoringMap& theMap,
          const string& thePrefix)
 {
-  return TSuperClass::Restore(theSObject,
-                             theMap,
-                             thePrefix);
+  if(!TSuperClass::Restore(theSObject, theMap, thePrefix))
+    return NULL;
+
+  QStringList aResolutions = QStringList::split("|", VISU::Storable::FindValue(theMap, "myResolutions"));
+  QStringList aPartNames = QStringList::split("|",VISU::Storable::FindValue(theMap, "myPartNames") );
+  for(size_t anId = 0, anEnd = aPartNames.size(); anId < anEnd; anId++){
+    const QString& aPartName = aPartNames[anId];
+    const QString& aResolution = aResolutions[anId];
+    if(MYDEBUG) MESSAGE("MultiResult_i::Restore - aPartName = '"<<aPartName<<"' = "<<aResolution);
+    myPartName2ResolutionID[aPartName.latin1()] = aResolution[0];
+  }
+  
+  return this;
 }
 
 
@@ -458,15 +488,6 @@ VISU::MultiResult_i
 }
 
 
-//---------------------------------------------------------------
-void 
-VISU::MultiResult_i
-::ToStream(std::ostringstream& theStr)
-{
-  TSuperClass::ToStream(theStr);
-}
-
-
 //---------------------------------------------------------------
 VISU::MultiResult_i
 ::~MultiResult_i()
index b05dd5fc34b1f022d528e04f70c1b614e7dab97e..49d6bc890007d43cf8e364886be33e44ce8b43a2 100644 (file)
@@ -61,8 +61,24 @@ namespace VISU
     CORBA::Boolean
     IsDone();
 
+    typedef std::string TMeshName;
     typedef std::string TPartName;
+    typedef size_t TPartID;
+    typedef std::string TPath;
     typedef std::string TFileName;
+
+    struct TPartInfo
+    {
+      TMeshName myMeshName;
+      TPartName myName;
+      TPartID myPartID;
+      TPath myPath;
+      TFileName myFileName;
+    };
+
+    typedef std::map<TFileName, TPartInfo> TPartInfos;
+    TPartInfos myPartInfos;
+
     typedef std::map<TPartName, TFileName> TPartName2FileName;
     typedef std::map<TPartName, TResolutionID> TPartName2ResolutionID;
 
@@ -70,7 +86,7 @@ namespace VISU
     typedef std::map<TRepresentationKey, PInput> TRepresentation2Input;
 
   private:
-    QFileInfo myMPFileInfo;
+    QFileInfo myMultiFileInfo;
     TPartName2FileName myPartName2FileName;
     TPartName2ResolutionID myPartName2ResolutionID;