#include <TDF_Tool.hxx>
#include <TDF_Data.hxx>
+#include <TDF_Reference.hxx>
#include <TDF_LabelSequence.hxx>
#include <TDataStd_Integer.hxx>
#include <TDataStd_ChildNodeIterator.hxx>
#include <Interface_DataMapIteratorOfDataMapOfIntegerTransient.hxx>
#include <Resource_DataMapIteratorOfDataMapOfAsciiStringAsciiString.hxx>
+#include <set>
#include <map>
#include <string>
return aDocID.IntegerValue();
}
-void ProcessFunction(Handle(GEOM_Function)& theFunction,
+void ProcessFunction(Handle(GEOM_Function)& theFunction,
TCollection_AsciiString& theScript,
- TColStd_MapOfTransient& theProcessed);
+ TDF_LabelMap& theProcessed,
+ std::set<std::string>& theDumpedObjs);
Handle(TColStd_HSequenceOfInteger) FindEntries(TCollection_AsciiString& theString);
Handle(TDataStd_TreeNode) aNode, aRoot;
Handle(GEOM_Function) aFunction;
- TColStd_MapOfTransient aMap;
+ TDF_LabelMap aFuncMap;
+ std::set<std::string> anObjMap;
if (aDoc->Main().FindAttribute(GEOM_Function::GetFunctionTreeID(), aRoot)) {
TDataStd_ChildNodeIterator Itr(aRoot);
MESSAGE ( "Null function !!!!" );
continue;
}
- ProcessFunction(aFunction, aScript, aMap);
+ ProcessFunction(aFunction, aScript, aFuncMap, anObjMap);
}
}
{
const TCollection_AsciiString& aEntry = anEntryToNameIt.Key();
const TCollection_AsciiString& aName = anEntryToNameIt.Value();
+ if (!anObjMap.count(aEntry.ToCString()))
+ continue; // was not dumped
if ( !aEntry2StEntry.IsBound( aEntry ))
continue; // was not published
TCollection_AsciiString aCommand("\n\tgeompy."), aFatherEntry;
//===========================================================================
// Internal functions
//===========================================================================
-void ProcessFunction(Handle(GEOM_Function)& theFunction,
+void ProcessFunction(Handle(GEOM_Function)& theFunction,
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;
*/
// pass functions, that depends on nonexisting ones
- //jfa:test//bool doComment = false;
+ bool doNotProcess = 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;
+ for (Standard_Integer i = 1; i <= aLen && !doNotProcess; i++) {
+ TDF_Label aRefLabel = aSeq.Value(i);
+ Handle(TDF_Reference) aRef;
+ if (!aRefLabel.FindAttribute(TDF_Reference::GetID(), aRef)) {
+ doNotProcess = true;
+ }
+ 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();
if(aDescr.Length() == 0) {
//cout << "Warning: the function has no description" << endl;
if(aDescr == "None") return;
theScript += "\n\t";
- //jfa:test//if (doComment) theScript += "#";
theScript += aDescr;
- theProcessed.Add(theFunction);
+ theProcessed.Add(theFunction->GetEntry());
+
+ TCollection_AsciiString anObjEntry;
+ TDF_Tool::Entry(theFunction->GetOwnerEntry(), anObjEntry);
+ theDumpedObjs.insert(anObjEntry.ToCString());
}
//=============================================================================