mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2025-01-04 05:40:35 +05:00
Bug 0020065: EDF 876 GEOM : Deleting an object leads to unusable dump. Refix.
This commit is contained in:
parent
9fb1bbc452
commit
43be6f7c18
@ -36,6 +36,7 @@
|
|||||||
|
|
||||||
#include <TDF_Tool.hxx>
|
#include <TDF_Tool.hxx>
|
||||||
#include <TDF_Data.hxx>
|
#include <TDF_Data.hxx>
|
||||||
|
#include <TDF_Reference.hxx>
|
||||||
#include <TDF_LabelSequence.hxx>
|
#include <TDF_LabelSequence.hxx>
|
||||||
#include <TDataStd_Integer.hxx>
|
#include <TDataStd_Integer.hxx>
|
||||||
#include <TDataStd_ChildNodeIterator.hxx>
|
#include <TDataStd_ChildNodeIterator.hxx>
|
||||||
@ -54,6 +55,7 @@
|
|||||||
#include <Interface_DataMapIteratorOfDataMapOfIntegerTransient.hxx>
|
#include <Interface_DataMapIteratorOfDataMapOfIntegerTransient.hxx>
|
||||||
#include <Resource_DataMapIteratorOfDataMapOfAsciiStringAsciiString.hxx>
|
#include <Resource_DataMapIteratorOfDataMapOfAsciiStringAsciiString.hxx>
|
||||||
|
|
||||||
|
#include <set>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
@ -84,9 +86,10 @@ static Standard_Integer ExtractDocID(TCollection_AsciiString& theID)
|
|||||||
return aDocID.IntegerValue();
|
return aDocID.IntegerValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProcessFunction(Handle(GEOM_Function)& theFunction,
|
void ProcessFunction(Handle(GEOM_Function)& theFunction,
|
||||||
TCollection_AsciiString& theScript,
|
TCollection_AsciiString& theScript,
|
||||||
TColStd_MapOfTransient& theProcessed);
|
TDF_LabelMap& theProcessed,
|
||||||
|
std::set<std::string>& theDumpedObjs);
|
||||||
|
|
||||||
Handle(TColStd_HSequenceOfInteger) FindEntries(TCollection_AsciiString& theString);
|
Handle(TColStd_HSequenceOfInteger) FindEntries(TCollection_AsciiString& theString);
|
||||||
|
|
||||||
@ -440,7 +443,8 @@ TCollection_AsciiString GEOM_Engine::DumpPython(int theDocID,
|
|||||||
|
|
||||||
Handle(TDataStd_TreeNode) aNode, aRoot;
|
Handle(TDataStd_TreeNode) aNode, aRoot;
|
||||||
Handle(GEOM_Function) aFunction;
|
Handle(GEOM_Function) aFunction;
|
||||||
TColStd_MapOfTransient aMap;
|
TDF_LabelMap aFuncMap;
|
||||||
|
std::set<std::string> anObjMap;
|
||||||
|
|
||||||
if (aDoc->Main().FindAttribute(GEOM_Function::GetFunctionTreeID(), aRoot)) {
|
if (aDoc->Main().FindAttribute(GEOM_Function::GetFunctionTreeID(), aRoot)) {
|
||||||
TDataStd_ChildNodeIterator Itr(aRoot);
|
TDataStd_ChildNodeIterator Itr(aRoot);
|
||||||
@ -451,7 +455,7 @@ TCollection_AsciiString GEOM_Engine::DumpPython(int theDocID,
|
|||||||
MESSAGE ( "Null function !!!!" );
|
MESSAGE ( "Null function !!!!" );
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
ProcessFunction(aFunction, aScript, aMap);
|
ProcessFunction(aFunction, aScript, aFuncMap, anObjMap);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -578,6 +582,8 @@ TCollection_AsciiString GEOM_Engine::DumpPython(int theDocID,
|
|||||||
{
|
{
|
||||||
const TCollection_AsciiString& aEntry = anEntryToNameIt.Key();
|
const TCollection_AsciiString& aEntry = anEntryToNameIt.Key();
|
||||||
const TCollection_AsciiString& aName = anEntryToNameIt.Value();
|
const TCollection_AsciiString& aName = anEntryToNameIt.Value();
|
||||||
|
if (!anObjMap.count(aEntry.ToCString()))
|
||||||
|
continue; // was not dumped
|
||||||
if ( !aEntry2StEntry.IsBound( aEntry ))
|
if ( !aEntry2StEntry.IsBound( aEntry ))
|
||||||
continue; // was not published
|
continue; // was not published
|
||||||
TCollection_AsciiString aCommand("\n\tgeompy."), aFatherEntry;
|
TCollection_AsciiString aCommand("\n\tgeompy."), aFatherEntry;
|
||||||
@ -674,11 +680,13 @@ Handle(TColStd_HSequenceOfAsciiString) GEOM_Engine::GetAllDumpNames() const
|
|||||||
//===========================================================================
|
//===========================================================================
|
||||||
// Internal functions
|
// Internal functions
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
void ProcessFunction(Handle(GEOM_Function)& theFunction,
|
void ProcessFunction(Handle(GEOM_Function)& theFunction,
|
||||||
TCollection_AsciiString& theScript,
|
TCollection_AsciiString& theScript,
|
||||||
TColStd_MapOfTransient& theProcessed)
|
TDF_LabelMap& theProcessed,
|
||||||
|
std::set<std::string>& theDumpedObjs)
|
||||||
{
|
{
|
||||||
if(theFunction.IsNull() || theProcessed.Contains(theFunction)) return;
|
if (theFunction.IsNull()) return;
|
||||||
|
if (theProcessed.Contains(theFunction->GetEntry())) return;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
TDF_LabelSequence aSeq;
|
TDF_LabelSequence aSeq;
|
||||||
@ -692,19 +700,38 @@ void ProcessFunction(Handle(GEOM_Function)& theFunction,
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// pass functions, that depends on nonexisting ones
|
// pass functions, that depends on nonexisting ones
|
||||||
//jfa:test//bool doComment = false;
|
bool doNotProcess = false;
|
||||||
TDF_LabelSequence aSeq;
|
TDF_LabelSequence aSeq;
|
||||||
theFunction->GetDependency(aSeq);
|
theFunction->GetDependency(aSeq);
|
||||||
Standard_Integer aLen = aSeq.Length();
|
Standard_Integer aLen = aSeq.Length();
|
||||||
//jfa:test//for (Standard_Integer i = 1; i <= aLen && !doComment; i++) {
|
for (Standard_Integer i = 1; i <= aLen && !doNotProcess; i++) {
|
||||||
for (Standard_Integer i = 1; i <= aLen; i++) {
|
TDF_Label aRefLabel = aSeq.Value(i);
|
||||||
Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(aSeq.Value(i));
|
Handle(TDF_Reference) aRef;
|
||||||
//jfa:test//if (aFunction.IsNull()) doComment = true;
|
if (!aRefLabel.FindAttribute(TDF_Reference::GetID(), aRef)) {
|
||||||
//jfa:test//else if (!theProcessed.Contains(aFunction)) doComment = true;
|
doNotProcess = true;
|
||||||
if (aFunction.IsNull()) return;
|
}
|
||||||
if (!theProcessed.Contains(aFunction)) return;
|
else {
|
||||||
|
if (aRef.IsNull() || aRef->Get().IsNull()) {
|
||||||
|
doNotProcess = true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Handle(TDataStd_TreeNode) aT;
|
||||||
|
if (!TDataStd_TreeNode::Find(aRef->Get(), aT)) {
|
||||||
|
doNotProcess = true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
TDF_Label aDepLabel = aT->Label();
|
||||||
|
Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(aDepLabel);
|
||||||
|
|
||||||
|
if (aFunction.IsNull()) doNotProcess = true;
|
||||||
|
else if (!theProcessed.Contains(aDepLabel)) doNotProcess = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (doNotProcess) return;
|
||||||
|
|
||||||
TCollection_AsciiString aDescr = theFunction->GetDescription();
|
TCollection_AsciiString aDescr = theFunction->GetDescription();
|
||||||
if(aDescr.Length() == 0) {
|
if(aDescr.Length() == 0) {
|
||||||
//cout << "Warning: the function has no description" << endl;
|
//cout << "Warning: the function has no description" << endl;
|
||||||
@ -715,10 +742,13 @@ void ProcessFunction(Handle(GEOM_Function)& theFunction,
|
|||||||
if(aDescr == "None") return;
|
if(aDescr == "None") return;
|
||||||
|
|
||||||
theScript += "\n\t";
|
theScript += "\n\t";
|
||||||
//jfa:test//if (doComment) theScript += "#";
|
|
||||||
theScript += aDescr;
|
theScript += aDescr;
|
||||||
|
|
||||||
theProcessed.Add(theFunction);
|
theProcessed.Add(theFunction->GetEntry());
|
||||||
|
|
||||||
|
TCollection_AsciiString anObjEntry;
|
||||||
|
TDF_Tool::Entry(theFunction->GetOwnerEntry(), anObjEntry);
|
||||||
|
theDumpedObjs.insert(anObjEntry.ToCString());
|
||||||
}
|
}
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
|
Loading…
Reference in New Issue
Block a user