Mantis issue 0020768: Some Dump with RestoreSubShapes not loadable. Fix 2.

This commit is contained in:
jfa 2010-03-18 14:30:09 +00:00
parent c251f8fc85
commit f52f3839b7

View File

@ -125,7 +125,9 @@ void ReplaceEntriesByNames (TCollection_AsciiString& theScript,
Resource_DataMapOfAsciiStringAsciiString& theObjectNames,
const bool theIsPublished,
Resource_DataMapOfAsciiStringAsciiString& theEntryToBadName,
TColStd_SequenceOfAsciiString& theObjListToPublish);
TColStd_SequenceOfAsciiString& theObjListToPublish,
Standard_Integer& objectCounter,
Resource_DataMapOfAsciiStringAsciiString& aNameToEntry);
void AddObjectColors (int theDocID,
TCollection_AsciiString& theScript,
@ -575,6 +577,10 @@ TCollection_AsciiString GEOM_Engine::DumpPython(int theDocID,
TCollection_AsciiString aFuncScript;
Resource_DataMapOfAsciiStringAsciiString anEntryToBadName;
// Mantis issue 0020768
Standard_Integer objectCounter = 0;
Resource_DataMapOfAsciiStringAsciiString aNameToEntry;
if (aDoc->Main().FindAttribute(GEOM_Function::GetFunctionTreeID(), aRoot)) {
TDataStd_ChildNodeIterator Itr(aRoot);
for (; Itr.More(); Itr.Next()) {
@ -596,7 +602,8 @@ TCollection_AsciiString GEOM_Engine::DumpPython(int theDocID,
if (isDumpCollected ) {
// Replace entries by the names
ReplaceEntriesByNames( aFuncScript, theObjectNames,
isPublished, anEntryToBadName, aObjListToPublish );
isPublished, anEntryToBadName, aObjListToPublish,
objectCounter, aNameToEntry );
// publish collected objects
std::map< int, std::string > anEntryToCommandMap; // sort publishing commands by object entry
@ -641,7 +648,8 @@ TCollection_AsciiString GEOM_Engine::DumpPython(int theDocID,
// Replace entries by the names
aObjListToPublish.Clear();
ReplaceEntriesByNames( aFuncScript, theObjectNames,
isPublished, anEntryToBadName, aObjListToPublish );
isPublished, anEntryToBadName, aObjListToPublish,
objectCounter, aNameToEntry );
aScript += aFuncScript;
@ -1237,11 +1245,14 @@ void ReplaceEntriesByNames (TCollection_AsciiString& theScript,
Resource_DataMapOfAsciiStringAsciiString& theObjectNames,
const bool theIsPublished,
Resource_DataMapOfAsciiStringAsciiString& theEntryToBadName,
TColStd_SequenceOfAsciiString& theObjListToPublish)
TColStd_SequenceOfAsciiString& theObjListToPublish,
Standard_Integer& objectCounter,
Resource_DataMapOfAsciiStringAsciiString& aNameToEntry)
{
Handle(TColStd_HSequenceOfInteger) aSeq = FindEntries(theScript);
Standard_Integer aLen = aSeq->Length(), objectCounter = 0, aStart = 1, aScriptLength = theScript.Length();
Resource_DataMapOfAsciiStringAsciiString aNameToEntry;
//Standard_Integer objectCounter = 0;
Standard_Integer aLen = aSeq->Length(), aStart = 1, aScriptLength = theScript.Length();
//Resource_DataMapOfAsciiStringAsciiString aNameToEntry;
//Replace entries by the names
TCollection_AsciiString anUpdatedScript, anEntry, aName, aBaseName("geomObj_"),