]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
Fix on [Bug PAL7023] Problem loading MED file with a large number of families (same... OCC_development_01
authorapo <apo@opencascade.com>
Tue, 18 Jan 2005 05:18:51 +0000 (05:18 +0000)
committerapo <apo@opencascade.com>
Tue, 18 Jan 2005 05:18:51 +0000 (05:18 +0000)
src/VISU_I/VISU_Result_i.cc
src/VISU_I/VISU_Result_i.hh

index 963c438d98344ac197ca58bae389703a927c1cc1..5897b421ddb6c7a252820687533396a718011c55 100644 (file)
@@ -266,7 +266,6 @@ VISU::Storable* VISU::Result_i::Build(SALOMEDS::SObject_ptr theSObject)
                       "",
                       aComment.latin1(),
                       true);
-    myComment2EntryMap[aComment.latin1()] = aResultEntry;
     mySObject = myStudyDocument->FindObjectID(aResultEntry.c_str());
     if(mySObject->_is_nil()) throw std::runtime_error("Build - There is no SObject for the Result !!!");
     if(!CORBA::is_nil(theSObject)){
@@ -291,7 +290,6 @@ VISU::Storable* VISU::Result_i::Build(SALOMEDS::SObject_ptr theSObject)
                         "",
                         aComment.latin1(),
                         true);
-      myComment2EntryMap[aComment.latin1()] = aMeshEntry;
       if(aMeshOnEntityMap.empty()) 
        continue;
       aComment.sprintf("myComment=FAMILIES;myMeshName=%s",
@@ -305,11 +303,12 @@ VISU::Storable* VISU::Result_i::Build(SALOMEDS::SObject_ptr theSObject)
                         "",
                         aComment.latin1(),
                         true);
-      myComment2EntryMap[aComment.latin1()] = aSubMeshesEntry;
       //Import entities and according families
       aMeshOnEntityMapIter = aMeshOnEntityMap.begin();
-      typedef map<VISU::TEntity,string> TEntity2Entry;
-      TEntity2Entry aEntity2Entry;
+      typedef std::map<std::string,std::string> TComment2EntryMap;
+      TComment2EntryMap aComment2EntryMap;
+      typedef std::map<VISU::TEntity,std::string> TEntity2EntryMap;
+      TEntity2EntryMap aEntity2EntryMap;
       for(; aMeshOnEntityMapIter != aMeshOnEntityMap.end(); aMeshOnEntityMapIter++){
        const VISU::TEntity& anEntity = aMeshOnEntityMapIter->first;
        aComment.sprintf("myComment=ENTITY;myType=%d;myMeshName=%s;myId=%d",
@@ -325,7 +324,7 @@ VISU::Storable* VISU::Result_i::Build(SALOMEDS::SObject_ptr theSObject)
        default:
          throw std::runtime_error("Build >> Value of entity is incorrect!");
        }
-       string aTmpEntry = 
+       aEntity2EntryMap[anEntity] = 
          CreateAttributes(myStudyDocument,
                           aSubMeshesEntry.c_str(),
                           aRefFatherEntry.c_str(),
@@ -334,8 +333,6 @@ VISU::Storable* VISU::Result_i::Build(SALOMEDS::SObject_ptr theSObject)
                           "",
                           aComment.latin1(),
                           true);
-       aEntity2Entry[anEntity] = aTmpEntry;
-       myComment2EntryMap[aComment.latin1()] = aTmpEntry;
        const VISU::TMeshOnEntity& aMeshOnEntity = aMeshOnEntityMapIter->second;
        const VISU::TFamilyMap& aFamilyMap = aMeshOnEntity.myFamilyMap;
        VISU::TFamilyMap::const_iterator aFamilyMapIter = aFamilyMap.begin();
@@ -347,16 +344,15 @@ VISU::Storable* VISU::Result_i::Build(SALOMEDS::SObject_ptr theSObject)
                           aMeshName.c_str(),
                           anEntity,
                           aFamilyName.c_str());
-         aTmpEntry = 
+         aComment2EntryMap[aComment.latin1()] = 
            CreateAttributes(myStudyDocument,
-                            aEntity2Entry[anEntity].c_str(),
+                            aEntity2EntryMap[anEntity].c_str(),
                             aRefFatherEntry.c_str(),
                             "",
                             aFamilyName.c_str(),
                             "",
                             aComment.latin1(),
                             true);
-         myComment2EntryMap[aComment.latin1()] = aTmpEntry;
        }
       }
       //Importing groups
@@ -373,7 +369,6 @@ VISU::Storable* VISU::Result_i::Build(SALOMEDS::SObject_ptr theSObject)
                           "",
                           aComment.latin1(),
                           true);
-       myComment2EntryMap[aComment.latin1()] = aGroupsEntry;
        VISU::TGroupMap::const_iterator aGroupMapIter = aGroupMap.begin();
        for(; aGroupMapIter != aGroupMap.end(); aGroupMapIter++){
          const string& aGroupName = aGroupMapIter->first;
@@ -390,7 +385,6 @@ VISU::Storable* VISU::Result_i::Build(SALOMEDS::SObject_ptr theSObject)
                             "",
                             aComment.latin1(),
                             true);
-         myComment2EntryMap[aComment.latin1()] = aGroupEntry;
          const VISU::TGroup& aGroup = aGroupMapIter->second;
          const VISU::TFamilyAndEntitySet& aFamilyAndEntitySet = aGroup.myFamilyAndEntitySet;
          VISU::TFamilyAndEntitySet::const_iterator aFamilyAndEntitySetIter = aFamilyAndEntitySet.begin();
@@ -403,8 +397,7 @@ VISU::Storable* VISU::Result_i::Build(SALOMEDS::SObject_ptr theSObject)
                             aMeshName.c_str(),
                             anEntity,
                             aFamilyName.c_str());
-           string anEntry = myComment2EntryMap[aComment.latin1()];
-           CreateReference(myStudyDocument,aGroupEntry,anEntry);
+           CreateReference(myStudyDocument,aGroupEntry,aComment2EntryMap[aComment.latin1()]);
          }
        }
       }
@@ -430,7 +423,6 @@ VISU::Storable* VISU::Result_i::Build(SALOMEDS::SObject_ptr theSObject)
                               "",
                               aComment.latin1(),
                               true);
-           myComment2EntryMap[aComment.latin1()] = aFieldsEntry;
            isFieldEntryCreated = true;
          }
          const string& aFieldName = aFieldMapIter->first;
@@ -453,8 +445,7 @@ VISU::Storable* VISU::Result_i::Build(SALOMEDS::SObject_ptr theSObject)
                             "",
                             aComment.latin1(),
                             true);
-         myComment2EntryMap[aComment.latin1()] = aFieldEntry;
-         CreateReference(myStudyDocument,aFieldEntry,aEntity2Entry[anEntity]);
+         CreateReference(myStudyDocument,aFieldEntry,aEntity2EntryMap[anEntity]);
          VISU::TField::TValField::const_iterator aValFieldIter = aValField.begin();
          for(; aValFieldIter != aValField.end(); aValFieldIter++){
            int aTimeStamp = aValFieldIter->first;
@@ -476,7 +467,6 @@ VISU::Storable* VISU::Result_i::Build(SALOMEDS::SObject_ptr theSObject)
                               "",
                               aComment.latin1(),
                               true);
-           myComment2EntryMap[aComment.latin1()] = aTimeStampEntry;
          }
        }
       }
@@ -689,12 +679,9 @@ string VISU::Result_i::GetEntry(){
 const SALOMEDS::SObject_var& VISU::Result_i::GetSObject() const { return mySObject;}
 const SALOMEDS::Study_var& VISU::Result_i::GetStudyDocument() const { return myStudyDocument;}
 const SALOMEDS::SComponent_var& VISU::Result_i::GetSComponent() const { return mySComponent;}
-std::string VISU::Result_i::GetEntry(const std::string& theComment) const 
+std::string VISU::Result_i::GetEntry(const std::string& theComment) 
 { 
-  TComment2EntryMap::const_iterator aComment2EntryMapIter = myComment2EntryMap.find(theComment);
-  if(aComment2EntryMapIter == myComment2EntryMap.end())
-    return "";
-  return aComment2EntryMapIter->second;
+  return FindEntryWithComment(myStudyDocument,GetEntry().c_str(),theComment.c_str());
 }
 
 VISU::Result_i::~Result_i() {
index 28e0a1ab634560538aa0e6af2fec2174e21cb493..d172f3f94ec1442b9c41b865635cd200b93b8d31 100644 (file)
@@ -86,16 +86,13 @@ namespace VISU{
     SALOMEDS::Study_var myStudyDocument;
     SALOMEDS::SComponent_var mySComponent;
     
-    typedef std::map<std::string,std::string> TComment2EntryMap;
-    TComment2EntryMap myComment2EntryMap;
-
   public:
     std::string GetRefFatherEntry();
     std::string GetEntry();
     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) const;
+    std::string GetEntry(const std::string& theComment);
 
   };