Bug 0020065: EDF 876 GEOM : Deleting an object leads to unusable dump.

This commit is contained in:
jfa 2008-12-18 09:38:28 +00:00
parent 2ca357cd29
commit b19d40e8dd

View File

@ -437,7 +437,7 @@ TCollection_AsciiString GEOM_Engine::DumpPython(int theDocID,
aScript += "def RebuildData(theStudy):";
aScript += "\n\tgeompy.init_geom(theStudy)";
Standard_Integer posToInertGlobalVars = aScript.Length() + 1;
Standard_Integer posToInsertGlobalVars = aScript.Length() + 1;
Handle(TDataStd_TreeNode) aNode, aRoot;
Handle(GEOM_Function) aFunction;
@ -532,7 +532,8 @@ TCollection_AsciiString GEOM_Engine::DumpPython(int theDocID,
}
//Add final part of the script
if(aLen && aSeq->Value(aLen) < aScriptLength) anUpdatedScript += aScript.SubString(aSeq->Value(aLen)+1, aScriptLength); // mkr : IPAL11865
if (aLen && aSeq->Value(aLen) < aScriptLength)
anUpdatedScript += aScript.SubString(aSeq->Value(aLen)+1, aScriptLength); // mkr : IPAL11865
// ouv : NPAL12872
for (anEntryToNameIt.Initialize( theObjectNames );
@ -633,7 +634,7 @@ TCollection_AsciiString GEOM_Engine::DumpPython(int theDocID,
}
if ( !globalVars.IsEmpty() ) {
globalVars.Insert( 1, "\n\tglobal " );
anUpdatedScript.Insert( posToInertGlobalVars, globalVars );
anUpdatedScript.Insert( posToInsertGlobalVars, globalVars );
}
return anUpdatedScript;
@ -690,19 +691,34 @@ void ProcessFunction(Handle(GEOM_Function)& theFunction,
}
*/
// pass functions, that depends on nonexisting ones
//jfa:test//bool doComment = false;
TDF_LabelSequence aSeq;
theFunction->GetDependency(aSeq);
Standard_Integer aLen = aSeq.Length();
//jfa:test//for (Standard_Integer i = 1; i <= aLen && !doComment; i++) {
for (Standard_Integer i = 1; i <= aLen; i++) {
Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(aSeq.Value(i));
//jfa:test//if (aFunction.IsNull()) doComment = true;
//jfa:test//else if (!theProcessed.Contains(aFunction)) doComment = true;
if (aFunction.IsNull()) return;
if (!theProcessed.Contains(aFunction)) return;
}
TCollection_AsciiString aDescr = theFunction->GetDescription();
if(aDescr.Length() == 0) {
//cout << "Warning: the function has no description" << endl;
return;
}
//Check if its internal function which doesn't requires dumping
if(aDescr == "None") return;
theScript += "\n\t";
//jfa:test//if (doComment) theScript += "#";
theScript += aDescr;
theProcessed.Add(theFunction);
return;
}
//=============================================================================